Upgraded to trio baseline 1.4
diff --git a/strio.c b/strio.c
index bbb2056..f1ab5b8 100644
--- a/strio.c
+++ b/strio.c
@@ -22,7 +22,7 @@
static const char rcsid[] = "@(#)$Id$";
-#if defined(unix) || defined(__xlC__)
+#if defined(unix) || defined(__xlC__) || defined(__QNX__)
# define PLATFORM_UNIX
#elif defined(WIN32) || defined(_WIN32)
# define PLATFORM_WIN32
@@ -36,6 +36,7 @@
#include "strio.h"
#include <string.h>
+#include <locale.h>
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
@@ -61,8 +62,13 @@
# define USE_STRCASECMP
# define USE_STRNCASECMP
# define USE_STRERROR
+# if defined(__QNX__)
+# define strcasecmp(x,y) stricmp(x,y)
+# define strncasecmp(x,y,n) strnicmp(x,y,n)
+# endif
#elif defined(PLATFORM_WIN32)
-# define USE_STRCMPI
+# define USE_STRCASECMP
+# define strcasecmp(x,y) strcmpi(x,y)
#endif
/*************************************************************************
@@ -101,7 +107,7 @@
assert(VALID(source));
- target = (char *)malloc(StrLength(source) + 1);
+ target = StrAlloc(StrLength(source) + 1);
if (target)
{
StrCopy(target, source);
@@ -126,7 +132,7 @@
{
len = max;
}
- target = (char *)malloc(len);
+ target = StrAlloc(len);
if (target)
{
StrCopyMax(target, len, source);
@@ -146,8 +152,6 @@
{
#if defined(USE_STRCASECMP)
return (0 == strcasecmp(first, second));
-#elif defined(USE_STRCMPI)
- return (0 == strcmpi(first, second));
#else
while ((*first != NIL) && (*second != NIL))
{
@@ -195,6 +199,21 @@
}
/*************************************************************************
+ * StrEqualLocale
+ */
+int StrEqualLocale(const char *first, const char *second)
+{
+ assert(VALID(first));
+ assert(VALID(second));
+
+#if defined(LC_COLLATE)
+ return (strcoll(first, second) == 0);
+#else
+ return StrEqual(first, second);
+#endif
+}
+
+/*************************************************************************
* StrEqualMax
*/
int StrEqualMax(const char *first, size_t max, const char *second)
@@ -293,7 +312,7 @@
{
return (NIL == *pattern);
}
- if ((toupper(*string) != toupper(*pattern))
+ if ((toupper((int)*string) != toupper((int)*pattern))
&& ('?' != *pattern))
{
return FALSE;
@@ -435,9 +454,9 @@
while (isxdigit((int)*source))
{
integer *= 16;
- integer += (isdigit((int)*source) ? (*source - '0') :
- (isupper((int)*source) ? (*source - 'A') :
- (*source - 'a')));
+ integer += (isdigit((int)*source)
+ ? (*source - '0')
+ : 10 + (toupper((int)*source) - 'A'));
source++;
}
if (*source == '.')
@@ -446,9 +465,9 @@
while (isxdigit((int)*source))
{
fraction *= 16;
- fraction += (isdigit((int)*source) ? (*source - '0') :
- (isupper((int)*source) ? (*source - 'A') :
- (*source - 'a')));
+ fraction += (isdigit((int)*source)
+ ? (*source - '0')
+ : 10 + (toupper((int)*source) - 'A'));
fracdiv *= 16;
source++;
}
@@ -554,7 +573,7 @@
while (NIL != *target)
{
- *target = toupper(*target);
+ *target = toupper((int)*target);
target++;
i++;
}