shithub: choc

Download patch

ref: 9f9fa99eb12d7a7df97b20b13d2200a4946e6ba3
parent: 9438107b427c1bdc6b7c5b6431aa01c8e8cbde01
author: Fabian Greffrath <fabian@greffrath.com>
date: Wed Oct 19 16:38:03 EDT 2022

fix a cppcheck warning for M_DirName() and M_BaseName() (#1524)

* fix a cppcheck warning for M_DirName() and M_BaseName()

* fix pb and pf pointer checking order

* simplify matters

--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -505,7 +505,7 @@
     }
     else
     {
-        const char *p = (pf > pb) ? pf : pb;
+        const char *p = (pb > pf) ? pb : pf;
         result = M_StringDuplicate(path);
         result[p - path] = '\0';
         return result;
@@ -531,7 +531,7 @@
     }
     else
     {
-        const char *p = (pf > pb) ? pf : pb;
+        const char *p = (pb > pf) ? pb : pf;
         return p + 1;
     }
 }
@@ -916,4 +916,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}