]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
quake2,heretic2: attempt to fix undeclared strupr, <3 Kai
authorThomas Debesse <dev@illwieckz.net>
Sat, 20 Feb 2021 20:09:08 +0000 (21:09 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 20 Feb 2021 20:39:49 +0000 (21:39 +0100)
Attempt to fix this:

netradiant/tools/heretic2/h2data/tmix.c:292:5: error: implicit declaration of function 'strupr' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                                strupr( buffer );
                                ^

tools/heretic2/common/cmdlib.c
tools/heretic2/common/cmdlib.h
tools/heretic2/h2data/fmodels.c
tools/quake2/common/cmdlib.c
tools/quake2/common/cmdlib.h
tools/quake2/extra/common/cmdlib.c
tools/quake2/extra/common/cmdlib.h

index 0f9ce0d5ae20ef17ad97f11d033e2e3821311b30..244452272c09a2e81c2ab024db56e89ef327db4a 100644 (file)
@@ -496,22 +496,20 @@ int Q_strcasecmp( const char *s1, const char *s2 ){
        return Q_strncasecmp( s1, s2, 99999 );
 }
 
-// NOTE TTimo when switching to Multithread DLL (Release/Debug) in the config
-//   started getting warnings about that function, prolly a duplicate with the runtime function
-//   maybe we still need to have it in linux builds
-/*
-   char *strupr (char *start)
-   {
-    char       *in;
-    in = start;
-    while (*in)
-    {
-   *in = toupper(*in);
-        in++;
-    }
-    return start;
-   }
- */
+// May be already defined with some compilers on Windows
+#ifndef strupr
+char *strupr (char *start)
+{
+       char    *in;
+       in = start;
+       while (*in)
+       {
+               *in = toupper(*in);
+               in++;
+       }
+       return start;
+}
+#endif
 
 char *strlower( char *start ){
        char    *in;
index f3624d6b5152df9ddfa3fd70cfe73b1dcf9a791c..b9c7de939517a39debc1053bf7ccfb9e122a2a58 100644 (file)
@@ -80,7 +80,12 @@ void *safe_malloc_info( size_t size, char* info );
 extern int myargc;
 extern char **myargv;
 
-char *strlower( char *in );
+// May be already defined with some compilers on Windows
+#ifndef strupr
+char *strupr (char *start);
+#endif
+
+char *strlower( char *start );
 int Q_strncasecmp( const char *s1, const char *s2, int n );
 int Q_stricmp( const char *s1, const char *s2 );
 int Q_strcasecmp( const char *s1, const char *s2 );
index ac04d38b506a5f13d80458c16579079f24286879..6e8a263f008ef32f542594f7fcd0bdd532c9bc5b 100644 (file)
@@ -148,20 +148,6 @@ void GetOneGroup( trigroup_t *tris, int grp, triangle_t* triangles );
 void ScaleTris( vec3_t min, vec3_t max, int Width, int Height, float* u, float* v, int verts );
 void NewDrawLine( int x1, int y1, int x2, int y2, unsigned char* picture, int width, int height );
 
-#if !GDEF_OS_WINDOWS
-char *strupr (char *start)
-{
-       char *in;
-       in = start;
-       while (*in)
-       {
-               *in = toupper(*in);
-               in++;
-       }
-       return start;
-}
-#endif
-
 //==============================================================
 
 /*
index 0b65ddaaeff9c6eb1db84dded47725ac49c09c74..fd025691a30f7742773c9834f6bc7b635c5da14c 100644 (file)
@@ -490,7 +490,8 @@ int Q_strcasecmp( const char *s1, const char *s2 ){
        return Q_strncasecmp( s1, s2, 99999 );
 }
 
-#if !GDEF_OS_WINDOWS
+// May be already defined with some compilers on Windows
+#ifndef strupr
 char *strupr (char *start)
 {
        char *in;
index 49f1aeb109037b84a3585bb4559788939ede5db4..3dbf9682f51aedf55271b2a15b927974469b564c 100644 (file)
@@ -77,6 +77,11 @@ void *safe_malloc_info( size_t size, char* info );
 extern int myargc;
 extern char **myargv;
 
+// May be already defined with some compilers on Windows
+#ifndef strupr
+char *strupr (char *start);
+#endif
+
 char *strlower( char *in );
 int Q_strncasecmp( const char *s1, const char *s2, int n );
 int Q_strcasecmp( const char *s1, const char *s2 );
index 792690790530546297e0254c17cc776dd40c8505..ab900c9033d03bce773e3c9396c560f64bea96bd 100644 (file)
@@ -461,7 +461,8 @@ int Q_strcasecmp (char *s1, char *s2)
        return Q_strncasecmp (s1, s2, 99999);
 }
 
-
+// May be already defined with some compilers on Windows
+#ifndef strupr
 char *strupr (char *start)
 {
        char    *in;
@@ -473,6 +474,7 @@ char *strupr (char *start)
        }
        return start;
 }
+#endif
 
 char *strlower (char *start)
 {
index 0821ce512f517de8b02ef2d56584fa7679a5e20b..afbeb348e72345f5e7734fd983099fe15c41516c 100644 (file)
@@ -56,8 +56,12 @@ typedef unsigned char byte;
 extern int myargc;
 extern char **myargv;
 
-char *strupr (char *in);
-char *strlower (char *in);
+// May be already defined with some compilers on Windows
+#ifndef strupr
+char *strupr (char *start);
+#endif
+
+char *strlower (char *start);
 int Q_strncasecmp (char *s1, char *s2, int n);
 int Q_strcasecmp (char *s1, char *s2);
 void Q_getwd (char *out);