[sword-cvs] swordreader/src/Dll1/winceSword/src swordce.cpp,1.3,1.4
sword@www.crosswire.org
sword@www.crosswire.org
Sat, 24 Jan 2004 12:45:54 -0700
- Previous message: [sword-cvs] swordreader/src/Dll1 Dll1.vcl,1.8,1.9
- Next message: [sword-cvs] swordreader/src/gui Main.cpp,1.1.1.1,1.2 Main.h,1.1.1.1,1.2 Navigator.cpp,1.1.1.1,1.2 Navigator.h,1.1.1.1,1.2 SwordIndex.h,1.2,1.3 gui.vcl,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/core/swordreader/src/Dll1/winceSword/src
In directory www:/tmp/cvs-serv10139/src/Dll1/winceSword/src
Modified Files:
swordce.cpp
Log Message:
Fixed stricmp and started adding support for GlobalOptions from sword lib
Index: swordce.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/Dll1/winceSword/src/swordce.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- swordce.cpp 21 Jan 2004 06:15:33 -0000 1.3
+++ swordce.cpp 24 Jan 2004 19:45:52 -0000 1.4
@@ -12,25 +12,23 @@
wchar_t *strtowstr(const char *str) {
- char * str2 = (char*)str;
static wchar_t *c, *buffer = 0;
if (buffer)
delete [] buffer;
- buffer = c = new wchar_t[ strlen(str2) + 1 ];
- while (*str2)
- *c++ = (wchar_t)*str2++;
+ buffer = c = new wchar_t[ strlen(str) + 1 ];
+ while (*str)
+ *c++ = (wchar_t)*str++;
*c = 0;
return buffer;
}
char *wstrtostr(const wchar_t *str) {
- wchar_t * str2 = (wchar_t*)str;
static char *c, *buffer = 0;
if (buffer)
delete [] buffer;
- buffer = c = new char[ wcslen(str2) + 1 ];
- while (*str2)
- *c++ = (char)*str2++;
+ buffer = c = new char[ wcslen(str) + 1 ];
+ while (*str)
+ *c++ = (char)*str++;
*c = 0;
return buffer;
}
@@ -60,20 +58,17 @@
int stricmp(const char *s1, const char *s2) {
- char * t1 = new char;
- char * t2 = new char;
-
- char * r1 = t1;
- char * r2 = t2;
-
- strcpy(t1, s1);
- strcpy(t2, s2);
-
- for (;*r1 != 0; r1++) *r1 = tolower(*r1);
- for (;*r2 != 0; r2++) *r2 = tolower(*r2);
-
- return strcmp(t1, t2);
+ char diff;
+ int i;
+ for (i = 0; ((*s2) && (*s1)); i++) {
+ if ((diff = toupper(*s1) - toupper(*s2)))
+ return diff;
+ s1++;
+ s2++;
+ }
+ return (!*s1)?((!*s2)?0:-1):1;
}
+
namespace sword {
int stricmp(const char *s1, const char *s2) { return ::stricmp(s1, s2); }
- Previous message: [sword-cvs] swordreader/src/Dll1 Dll1.vcl,1.8,1.9
- Next message: [sword-cvs] swordreader/src/gui Main.cpp,1.1.1.1,1.2 Main.h,1.1.1.1,1.2 Navigator.cpp,1.1.1.1,1.2 Navigator.h,1.1.1.1,1.2 SwordIndex.h,1.2,1.3 gui.vcl,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]