From 2a413ffc17e9134c5a50887469f5ce9f92aecafb Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sun, 11 Mar 2018 15:03:12 -0700 Subject: [PATCH] update physfs ignorecase --- include/ignorecase.h | 14 +++++++++++++- misc/ignorecase.c | 7 ++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/ignorecase.h b/include/ignorecase.h index 873202e0..f1188636 100644 --- a/include/ignorecase.h +++ b/include/ignorecase.h @@ -1,3 +1,6 @@ +#ifndef INCL_PHYSFSEXT_IGNORECASE_H +#define INCL_PHYSFSEXT_IGNORECASE_H + /** \file ignorecase.h */ /** @@ -39,11 +42,14 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ +#ifdef __cplusplus +extern "C" { +#endif /** * \fn int PHYSFSEXT_locateCorrectCase(char *buf) @@ -71,5 +77,11 @@ */ int PHYSFSEXT_locateCorrectCase(char *buf); +#ifdef __cplusplus +} +#endif + +#endif /* include-once blocker. */ + /* end of ignorecase.h ... */ diff --git a/misc/ignorecase.c b/misc/ignorecase.c index 5260c30e..a6a83d96 100644 --- a/misc/ignorecase.c +++ b/misc/ignorecase.c @@ -22,12 +22,13 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ /* I'm not screwing around with stricmp vs. strcasecmp... */ +/* !!! FIXME: this will NOT work with UTF-8 strings in physfs2.0 */ static int caseInsensitiveStringCompare(const char *x, const char *y) { int ux, uy; @@ -97,7 +98,7 @@ int PHYSFSEXT_locateCorrectCase(char *buf) if (*ptr == '\0') return(0); /* Uh...I guess that's success. */ - while ((ptr = strchr(ptr + 1, '/'))) + while ( (ptr = strchr(ptr + 1, '/')) != NULL ) { *ptr = '\0'; /* block this path section off */ rc = locateOneElement(buf); @@ -116,7 +117,7 @@ int main(int argc, char **argv) { int rc; char buf[128]; - PHYSFS_file *f; + PHYSFS_File *f; if (!PHYSFS_init(argv[0])) { -- 2.39.2