mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 09:36:41 -04:00
105 lines
3 KiB
Text
105 lines
3 KiB
Text
--- platform.cpp.orig 2004-08-20 18:26:58 UTC
|
|
+++ platform.cpp
|
|
@@ -434,55 +434,4 @@ bool atob(const char *str)
|
|
return !stricmp(str, "true") || atof(str);
|
|
}
|
|
|
|
-S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
|
|
-{
|
|
- va_list args;
|
|
- va_start(args, format);
|
|
-#ifdef TNL_COMPILER_VISUALC
|
|
- S32 len = _vsnprintf(buffer, bufferSize, format, args);
|
|
-#else
|
|
- S32 len = vsnprintf(buffer, bufferSize, format, args);
|
|
-#endif
|
|
- return (len);
|
|
-}
|
|
-
|
|
-
|
|
-S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist)
|
|
-{
|
|
-#ifdef TNL_COMPILER_VISUALC
|
|
- S32 len = _vsnprintf(buffer, bufferSize, format, (va_list) arglist);
|
|
-#else
|
|
- S32 len = vsnprintf(buffer, bufferSize, format, (char *) arglist);
|
|
-#endif
|
|
- return len;
|
|
-}
|
|
-
|
|
};
|
|
-
|
|
-
|
|
-#if defined (__GNUC__)
|
|
-
|
|
-int stricmp(const char *str1, const char *str2)
|
|
-{
|
|
- while(toupper(*str1) == toupper(*str2) && *str1)
|
|
- {
|
|
- str1++;
|
|
- str2++;
|
|
- }
|
|
- return (toupper(*str1) > toupper(*str2)) ? 1 : ((toupper(*str1) < toupper(*str2)) ? -1 : 0);
|
|
-}
|
|
-
|
|
-int strnicmp(const char *str1, const char *str2, unsigned int len)
|
|
-{
|
|
- for(unsigned int i = 0; i < len; i++)
|
|
- {
|
|
- if(toupper(str1[i]) == toupper(str2[i]))
|
|
- continue;
|
|
- return (toupper(str1[i]) > toupper(str2[i])) ? 1 : ((toupper(str1[i]) < toupper(str2[i])) ? -1 : 0);
|
|
- }
|
|
- return 0;
|
|
-}
|
|
-
|
|
-#endif
|
|
-
|
|
-
|
|
Use defines instead of (partially incorrect) function-wrappers for
|
|
standard functions.
|
|
|
|
-mi
|
|
|
|
--- tnlPlatform.h.orig 2004-09-28 18:45:25 UTC
|
|
+++ tnlPlatform.h
|
|
@@ -30,6 +30,7 @@
|
|
#ifndef _TNL_TYPES_H_
|
|
#include "tnlTypes.h"
|
|
#endif
|
|
+#include <stdio.h>
|
|
|
|
namespace TNL {
|
|
|
|
@@ -100,13 +101,14 @@ extern bool atob(const char *str); ///< String
|
|
/// Printf into string with a buffer size.
|
|
///
|
|
/// This will print into the specified string until the buffer size is reached.
|
|
-extern int dSprintf(char *buffer, U32 bufferSize, const char *format, ...);
|
|
+#ifdef TNL_COMPILER_VISUALC
|
|
+# define dSprintf _snprintf
|
|
+# define dVsprintf _vsnprintf
|
|
+#else
|
|
+# define dSprintf snprintf
|
|
+# define dVsprintf vsnprintf
|
|
+#endif
|
|
|
|
-/// Vsprintf with buffer size argument.
|
|
-///
|
|
-/// This will print into the specified string until the buffer size is reached.
|
|
-extern int dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist); ///< compiler independent
|
|
-
|
|
inline char dToupper(const char c) { if (c >= char('a') && c <= char('z')) return char(c + 'A' - 'a'); else return c; } ///< Converts an ASCII character to upper case.
|
|
inline char dTolower(const char c) { if (c >= char('A') && c <= char('Z')) return char(c - 'A' + 'a'); else return c; } ///< Converts an ASCII character to lower case.
|
|
|
|
@@ -119,8 +121,8 @@ inline char dTolower(const char c) { if (c >= char('A'
|
|
|
|
#if defined (__GNUC__)
|
|
|
|
-int stricmp(const char *str1, const char *str2);
|
|
-int strnicmp(const char *str1, const char *str2, unsigned int len);
|
|
+#define stricmp(str1, str2) strcasecmp(str1, str2)
|
|
+#define strnicmp(str1, str2, size) strncasecmp(str1, str2, size)
|
|
|
|
#endif
|
|
|