mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-06 22:50:44 +00:00
Fix check for operation on nonblocking socket
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33967 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ccbd4060d9
commit
3cc9fb2c50
3 changed files with 16 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
||||||
* Source/NSString.m: Fix boundary error when getting cString into a
|
* Source/NSString.m: Fix boundary error when getting cString into a
|
||||||
buffer. Fix floatValue and doubleValue to support arbitrary length
|
buffer. Fix floatValue and doubleValue to support arbitrary length
|
||||||
of leading white space.
|
of leading white space.
|
||||||
|
* Source/GSNetwork.h: Check for EAGAIN on nonblocking socket.
|
||||||
|
|
||||||
2011-10-08 Niels Grewe <niels.grewe@halbordnung.de>
|
2011-10-08 Niels Grewe <niels.grewe@halbordnung.de>
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@
|
||||||
#define INVALID_SOCKET -1
|
#define INVALID_SOCKET -1
|
||||||
#define BADSOCKET(X) ((X) < 0)
|
#define BADSOCKET(X) ((X) < 0)
|
||||||
#define GSNETERROR errno
|
#define GSNETERROR errno
|
||||||
#define GSWOULDBLOCK (errno == EINPROGRESS || errno == EALREADY)
|
#define GSWOULDBLOCK (EINPROGRESS == GSNETERROR\
|
||||||
|
|| EALREADY == GSNETERROR || EAGAIN == errno)
|
||||||
|
|
||||||
#endif /* __MINGW__ */
|
#endif /* __MINGW__ */
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,17 @@ static NSData *whitespaceBitmap;
|
||||||
static unsigned const char *whitespaceBitmapRep = NULL;
|
static unsigned const char *whitespaceBitmapRep = NULL;
|
||||||
#define GS_IS_WHITESPACE(X) IS_BIT_SET(whitespaceBitmapRep[(X)/8], (X) % 8)
|
#define GS_IS_WHITESPACE(X) IS_BIT_SET(whitespaceBitmapRep[(X)/8], (X) % 8)
|
||||||
|
|
||||||
|
static void setupNonspace(void)
|
||||||
|
{
|
||||||
|
if (nil == nonspace)
|
||||||
|
{
|
||||||
|
NSCharacterSet *whitespace;
|
||||||
|
|
||||||
|
whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
|
nonspace = [[whitespace invertedSet] retain];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void setupWhitespace(void)
|
static void setupWhitespace(void)
|
||||||
{
|
{
|
||||||
if (whitespaceBitmapRep == NULL)
|
if (whitespaceBitmapRep == NULL)
|
||||||
|
@ -149,7 +160,6 @@ static void setupWhitespace(void)
|
||||||
*/
|
*/
|
||||||
whitespace = [NSCharacterSet characterSetWithCharactersInString:
|
whitespace = [NSCharacterSet characterSetWithCharactersInString:
|
||||||
@" \t\r\n\f\b"];
|
@" \t\r\n\f\b"];
|
||||||
nonspace = [[whitespace invertedSet] retain];
|
|
||||||
whitespaceBitmap = RETAIN([whitespace bitmapRepresentation]);
|
whitespaceBitmap = RETAIN([whitespace bitmapRepresentation]);
|
||||||
whitespaceBitmapRep = [whitespaceBitmap bytes];
|
whitespaceBitmapRep = [whitespaceBitmap bytes];
|
||||||
}
|
}
|
||||||
|
@ -3112,7 +3122,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
double d = 0.0;
|
double d = 0.0;
|
||||||
NSRange r;
|
NSRange r;
|
||||||
|
|
||||||
setupWhitespace();
|
setupNonspace();
|
||||||
r = [self rangeOfCharacterFromSet: nonspace];
|
r = [self rangeOfCharacterFromSet: nonspace];
|
||||||
if (NSNotFound == r.location) return 0.0;
|
if (NSNotFound == r.location) return 0.0;
|
||||||
r.length = [self length] - r.location;
|
r.length = [self length] - r.location;
|
||||||
|
@ -3133,7 +3143,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
double d = 0.0;
|
double d = 0.0;
|
||||||
NSRange r;
|
NSRange r;
|
||||||
|
|
||||||
setupWhitespace();
|
setupNonspace();
|
||||||
r = [self rangeOfCharacterFromSet: nonspace];
|
r = [self rangeOfCharacterFromSet: nonspace];
|
||||||
if (NSNotFound == r.location) return 0.0;
|
if (NSNotFound == r.location) return 0.0;
|
||||||
r.length = [self length] - r.location;
|
r.length = [self length] - r.location;
|
||||||
|
|
Loading…
Reference in a new issue