- // buffer were large enough
- // also, it may return an errno may be something like EILSEQ,
- // in which case we need to break out
- if ( (len >= 0 && len <= size)
- // No EOVERFLOW on Windows nor Palm 6.0 nor OpenVMS nor MacOS (not X)
- // not OS/2 (not Innotek libc).
-#if !defined(__WXMSW__) && \
- !defined(__WXPALMOS__) && \
- !defined(__OpenBSD__) && \
- !defined(__DJGPP__) && \
- !defined( __VMS ) && \
- !(defined(__WXMAC__) && !defined(__WXMAC_OSX__)) && \
- !(defined(__EMX__) && !defined(__INNOTEK_LIBC__))
- || errno != EOVERFLOW
-#endif
- )
+ // buffer were large enough (newer standards such as Unix98)
+ if ( len < 0 )
+ {
+ // still not enough, as we don't know how much we need, double the
+ // current size of the buffer
+ size *= 2;
+ }
+ else if ( len > size )
+ {
+ size = len;
+ }
+ else // ok, there was enough space