equal
deleted
inserted
replaced
25 * Please see LICENSE.txt in the root of the source tree. |
25 * Please see LICENSE.txt in the root of the source tree. |
26 * |
26 * |
27 * \author Ryan C. Gordon. |
27 * \author Ryan C. Gordon. |
28 */ |
28 */ |
29 |
29 |
30 /* I'm not screwing around with stricmp vs. strcasecmp... */ |
|
31 /* !!! FIXME-3.0: this will NOT work with UTF-8 strings in physfs2.0 */ |
|
32 static int caseInsensitiveStringCompare(const char *x, const char *y) |
|
33 { |
|
34 int ux, uy; |
|
35 do |
|
36 { |
|
37 ux = toupper((int) *x); |
|
38 uy = toupper((int) *y); |
|
39 if (ux != uy) |
|
40 return ((ux > uy) ? 1 : -1); |
|
41 x++; |
|
42 y++; |
|
43 } while ((ux) && (uy)); |
|
44 |
|
45 return 0; |
|
46 } /* caseInsensitiveStringCompare */ |
|
47 |
|
48 |
|
49 static int locateOneElement(char *buf) |
30 static int locateOneElement(char *buf) |
50 { |
31 { |
51 char *ptr; |
32 char *ptr; |
52 char **rc; |
33 char **rc; |
53 char **i; |
34 char **i; |
69 ptr++; /* point past dirsep to entry itself. */ |
50 ptr++; /* point past dirsep to entry itself. */ |
70 } /* else */ |
51 } /* else */ |
71 |
52 |
72 for (i = rc; *i != NULL; i++) |
53 for (i = rc; *i != NULL; i++) |
73 { |
54 { |
74 if (caseInsensitiveStringCompare(*i, ptr) == 0) |
55 if (PHYSFS_utf8stricmp(*i, ptr) == 0) |
75 { |
56 { |
76 strcpy(ptr, *i); /* found a match. Overwrite with this case. */ |
57 strcpy(ptr, *i); /* found a match. Overwrite with this case. */ |
77 PHYSFS_freeList(rc); |
58 PHYSFS_freeList(rc); |
78 return 1; |
59 return 1; |
79 } /* if */ |
60 } /* if */ |