Modified: trunk/reactos/lib/string/bsearch.c
Modified: trunk/reactos/lib/string/lfind.c
Modified: trunk/reactos/lib/string/mbstowcs.c
Modified: trunk/reactos/lib/string/splitp.c
Modified: trunk/reactos/lib/string/strpbrk.c
Modified: trunk/reactos/lib/string/strstr.c
Modified: trunk/reactos/lib/string/strtol.c
Modified: trunk/reactos/lib/string/strtoul.c
Modified: trunk/reactos/lib/string/strxspn.h
Modified: trunk/reactos/lib/string/wcstol.c
Modified: trunk/reactos/lib/string/wcstombs.c
Modified: trunk/reactos/lib/string/wcstoul.c
Modified: trunk/reactos/lib/string/wstring.c
--- trunk/reactos/lib/string/bsearch.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/bsearch.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -7,19 +7,19 @@
bsearch(const void *key, const void *base0, size_t nelem,
size_t size, int (*cmp)(const void *ck, const void *ce))
{
- char *base = (char *)base0;
+ const char *base = base0;
int lim, cmpval;
- void *p;
+ const void *p;
for (lim = nelem; lim != 0; lim >>= 1)
{
p = base + (lim >> 1) * size;
cmpval = (*cmp)(key, p);
if (cmpval == 0)
- return p;
+ return (void*)((size_t)p);
if (cmpval > 0)
{ /* key > p: move right */
- base = (char *)p + size;
+ base = (const char *)p + size;
lim--;
} /* else move left */
}
--- trunk/reactos/lib/string/lfind.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/lfind.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -5,13 +5,13 @@
void *_lfind(const void *key, const void *base, size_t *nelp,
size_t width, int (*compar)(const void *, const void *))
{
- char* char_base = (char*)base;
+ const char* char_base = (const char *)base;
size_t i;
for (i = 0; i < *nelp; i++)
{
if (compar(key, char_base) == 0)
- return char_base;
+ return (void *)((size_t)char_base);
char_base += width;
}
--- trunk/reactos/lib/string/mbstowcs.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/mbstowcs.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -20,7 +20,7 @@
Status = RtlMultiByteToUnicodeN (wchar,
sizeof(WCHAR),
&Size,
- (char *)mbchar,
+ mbchar,
count);
if (!NT_SUCCESS(Status))
return -1;
@@ -42,7 +42,7 @@
if (wcstr == NULL)
{
RtlMultiByteToUnicodeSize (&Size,
- (char *)mbstr,
+ mbstr,
Length);
return (size_t)Size;
@@ -51,7 +51,7 @@
Status = RtlMultiByteToUnicodeN (wcstr,
count,
&Size,
- (char *)mbstr,
+ mbstr,
Length);
if (!NT_SUCCESS(Status))
return -1;
--- trunk/reactos/lib/string/splitp.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/splitp.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -4,11 +4,11 @@
*/
void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext)
{
- char* tmp_drive;
- char* tmp_dir;
- char* tmp_ext;
+ const char* tmp_drive;
+ const char* tmp_dir;
+ const char* tmp_ext;
- tmp_drive = (char*)strchr(path,':');
+ tmp_drive = strchr(path,':');
if (drive) {
if (tmp_drive) {
strncpy(drive,tmp_drive-1,2);
@@ -18,7 +18,7 @@
}
}
if (!tmp_drive) {
- tmp_drive = (char*)path - 1;
+ tmp_drive = path - 1;
}
tmp_dir = (char*)strrchr(path,'\\');
@@ -31,9 +31,9 @@
}
}
- tmp_ext = (char*)strrchr(path,'.');
+ tmp_ext = strrchr(path,'.');
if (!tmp_ext) {
- tmp_ext = (char*)path+strlen(path);
+ tmp_ext = path+strlen(path);
}
if (ext) {
strcpy(ext,tmp_ext);
--- trunk/reactos/lib/string/strpbrk.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/strpbrk.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -34,17 +34,17 @@
else
{
unsigned long char_map[(1 << CHAR_BIT) / BIT_SIZE] = {0, };
- register unsigned char* str = (unsigned char*)s1;
+ const unsigned char* str = (const unsigned char*)s1;
while (*s2)
{
- char_map[*(unsigned char*)s2 / BIT_SIZE] |= (1 << (*(unsigned char*)s2 % BIT_SIZE));
+ char_map[*(const unsigned char*)s2 / BIT_SIZE] |= (1 << (*(const unsigned char*)s2 % BIT_SIZE));
s2++;
}
while (*str)
{
if (char_map[*str / BIT_SIZE] & (1 << (*str % BIT_SIZE)))
{
- return (char*)str;
+ return (char*)((size_t)str);
}
str++;
}
--- trunk/reactos/lib/string/strstr.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/strstr.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -20,5 +20,5 @@
} while (strncmp(s, find, len) != 0);
s--;
}
- return (char *)s;
+ return (char *)((size_t)s);
}
--- trunk/reactos/lib/string/strtol.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/strtol.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -85,6 +85,6 @@
else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = any ? (char *)s - 1 : (char *)nptr;
+ *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr);
return acc;
}
--- trunk/reactos/lib/string/strtoul.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/strtoul.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -68,6 +68,6 @@
else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = any ? (char *)s - 1 : (char *)nptr;
+ *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr);
return acc;
}
--- trunk/reactos/lib/string/strxspn.h 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/strxspn.h 2005-11-28 01:22:52 UTC (rev 19716)
@@ -7,8 +7,8 @@
size_t _strxspn(const char *s1, const char *s2)
{
unsigned char char_map[1 << CHAR_BIT * sizeof(char)];
- register unsigned char * us2 = (unsigned char *)s2;
- register unsigned char * str = (unsigned char *)s1;
+ const unsigned char * us2 = (const unsigned char *)s2;
+ const unsigned char * str = (const unsigned char *)s1;
memset(char_map, 0, sizeof(char_map));
@@ -18,7 +18,7 @@
for(; *str; ++ str)
if(_x(char_map[*str / CHAR_BIT] & (1 << (*str % CHAR_BIT)))) break;
- return str - (unsigned char*)s1;
+ return (size_t)str - (size_t)s1;
}
/* EOF */
--- trunk/reactos/lib/string/wcstol.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/wcstol.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -85,6 +85,6 @@
else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = any ? (wchar_t *)s - 1 : (wchar_t *)nptr;
+ *endptr = any ? (wchar_t *)((size_t)(s - 1)) : (wchar_t *)((size_t)nptr);
return acc;
}
--- trunk/reactos/lib/string/wcstombs.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/wcstombs.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -41,7 +41,7 @@
if (mbstr == NULL)
{
RtlUnicodeToMultiByteSize (&Size,
- (wchar_t *)wcstr,
+ (wchar_t*)((size_t)wcstr),
Length * sizeof(WCHAR));
return (size_t)Size;
@@ -50,7 +50,7 @@
Status = RtlUnicodeToMultiByteN (mbstr,
count,
&Size,
- (wchar_t *)wcstr,
+ (wchar_t*)((size_t)wcstr),
Length * sizeof(WCHAR));
if (!NT_SUCCESS(Status))
return -1;
--- trunk/reactos/lib/string/wcstoul.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/wcstoul.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -69,6 +69,6 @@
else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = any ? (wchar_t *)s - 1 : (wchar_t *)nptr;
+ *endptr = any ? (wchar_t *)((size_t)s - 1) : (wchar_t *)((size_t)nptr);
return acc;
}
--- trunk/reactos/lib/string/wstring.c 2005-11-28 01:10:49 UTC (rev 19715)
+++ trunk/reactos/lib/string/wstring.c 2005-11-28 01:22:52 UTC (rev 19716)
@@ -67,11 +67,10 @@
*/
size_t wcscspn(const wchar_t *str,const wchar_t *reject)
{
- wchar_t *s;
- wchar_t *t;
- s=(wchar_t *)str;
+ const wchar_t *t;
+ const wchar_t *s = str;
do {
- t=(wchar_t *)reject;
+ t=reject;
while (*t) {
if (*t==*s)
break;
@@ -97,7 +96,7 @@
for (scanp = s2; (sc = *scanp++) != 0;)
if (sc == c)
{
- return (wchar_t *)(--s1);
+ return (wchar_t *)((size_t)(--s1));
}
}
return 0;
@@ -108,11 +107,10 @@
*/
size_t wcsspn(const wchar_t *str,const wchar_t *accept)
{
- wchar_t *s;
- wchar_t *t;
- s=(wchar_t *)str;
+ const wchar_t *t;
+ const wchar_t *s = str;
do {
- t=(wchar_t *)accept;
+ t=accept;
while (*t) {
if (*t==*s)
break;
@@ -131,20 +129,19 @@
*/
wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
{
- wchar_t *x;
- wchar_t *y;
- wchar_t *c;
- x=(wchar_t *)s;
+ const wchar_t *y;
+ const wchar_t *c;
+ const wchar_t *x = s;
while (*x) {
if (*x==*b) {
y=x;
- c=(wchar_t *)b;
+ c=b;
while (*y && *c && *y==*c) {
c++;
y++;
}
if (!*c)
- return x;
+ return (wchar_t *)((size_t)x);
}
x++;
}