Am 10.03.2011 08:27, schrieb clemens.zeidler@xxxxxxxxxxxxxx:
Author: czeidler Date: 2011-03-10 08:27:51 +0100 (Thu, 10 Mar 2011) New Revision: 40896 Changeset: http://dev.haiku-os.org/changeset/40896 Modified: haiku/trunk/src/preferences/mail/DNSQuery.cpp haiku/trunk/src/preferences/mail/DNSQuery.h Log: Fix gcc2 build. Modified: haiku/trunk/src/preferences/mail/DNSQuery.cpp =================================================================== --- haiku/trunk/src/preferences/mail/DNSQuery.cpp 2011-03-10 06:25:57 UTC (rev 40895) +++ haiku/trunk/src/preferences/mail/DNSQuery.cpp 2011-03-10 07:27:51 UTC (rev 40896) @@ -95,7 +95,7 @@ BRawNetBuffer::ReadString(BString& string) { string = ""; - size_t readed = _ReadStringAt(string, fReadPosition); + int32 readed = _ReadStringAt(string, fReadPosition); if (readed< 0) return B_ERROR; fReadPosition += readed; @@ -122,13 +122,13 @@ } -size_t +int32 BRawNetBuffer::_ReadStringAt(BString& string, off_t pos) { if (pos>= fBuffer.BufferLength()) return -1; - size_t readed = 0; + int32 readed = 0; char* buffer = (char*)fBuffer.Buffer(); buffer =&buffer[pos]; // if the string is compressed we have to follow the links to the Modified: haiku/trunk/src/preferences/mail/DNSQuery.h =================================================================== --- haiku/trunk/src/preferences/mail/DNSQuery.h 2011-03-10 06:25:57 UTC (rev 40895) +++ haiku/trunk/src/preferences/mail/DNSQuery.h 2011-03-10 07:27:51 UTC (rev 40896) @@ -42,7 +42,7 @@ private: void _Init(const void* buf, size_t size); - size_t _ReadStringAt(BString& string, off_t pos); + int32 _ReadStringAt(BString& string, off_t pos); off_t fWritePosition; off_t fReadPosition;
That was not a GCC2 build problem, the code was just plain wrong. You can't return a negative number in a size_t, which is an unsigned type. As has been mentioned, the correct type for this situation is ssize_t.
Best regards, -Stephan