Changeset: 579886367c16 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=579886367c16 Modified Files: gdk/gdk_atoms.c Branch: default Log Message:
Encore on Bug #3519 Unterschiede (47 Zeilen): diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c --- a/gdk/gdk_atoms.c +++ b/gdk/gdk_atoms.c @@ -431,6 +431,20 @@ voidWrite(const void *a, stream *s, size return GDK_SUCCEED; } +/* + * Windows calls strncasecmp _strnicmp, and we need it for the function below. + * Interface is the same, see http://msdn.microsoft.com/en-us/library/chd90w8e.aspx + */ +#ifdef NATIVE_WIN32 + #define strncasecmp _strnicmp +#endif + +/* + * Converts string values such as TRUE/FALSE/true/false etc to 1/0/NULL. + * Switched from byte-to-byte compare to library function strncasecmp, + * experiments showed that library function is even slightly faster and we + * now also support True/False (and trUe/FAlSE should this become a thing). + */ int bitFromStr(const char *src, int *len, bit **dst) { @@ -447,19 +461,13 @@ bitFromStr(const char *src, int *len, bi } else if (*p == '1') { **dst = TRUE; p++; - } else if (p[0] == 't' && p[1] == 'r' && p[2] == 'u' && p[3] == 'e') { + } else if (strncasecmp(p, "true", 4) == 0) { **dst = TRUE; p += 4; - } else if (p[0] == 'T' && p[1] == 'R' && p[2] == 'U' && p[3] == 'E') { - **dst = TRUE; - p += 4; - } else if (p[0] == 'f' && p[1] == 'a' && p[2] == 'l' && p[3] == 's' && p[4] == 'e') { + } else if (strncasecmp(p, "false", 5) == 0) { **dst = FALSE; p += 5; - } else if (p[0] == 'F' && p[1] == 'A' && p[2] == 'L' && p[3] == 'S' && p[4] == 'E') { - **dst = FALSE; - p += 5; - } else if (p[0] == 'n' && p[1] == 'i' && p[2] == 'l') { + } else if (strncasecmp(p, "nil", 3) == 0) { p += 3; } else { p = src; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list