Fix DJGPP build (GCC 2.x). Bugreport from Max Vasilyev 2:5057/77

This commit is contained in:
Stas Degteff 2011-03-02 08:54:12 +00:00
parent 449a750688
commit 92626bd967
4 changed files with 14 additions and 8 deletions

View File

@ -160,7 +160,7 @@ endif
endif endif
endif endif
endif endif
CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H # -fomit-frame-pointer CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK # -fomit-frame-pointer
LNKFLAGS+=-g LNKFLAGS+=-g
CPPFLAGS+=$(CFLAGS) -fno-rtti # -fno-exceptions CPPFLAGS+=$(CFLAGS) -fno-rtti # -fno-exceptions

View File

@ -35,8 +35,12 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdlib.h> #include <stdlib.h>
#include <gctype.h>
#include <cstring> #include <cstring>
#if defined(HAVE_STDARG_H)
# include <stdarg.h>
#endif
#include <gctype.h>
#include <gdefs.h> #include <gdefs.h>
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -68,7 +68,7 @@ int vsnprintf( char *buffer, size_t sizeOfBuffer, const char *format, va_list ar
#endif #endif
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
# include snprintf.c # include "snprintf.c"
#endif #endif
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -726,8 +726,8 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
if (!buffer || !format) if (!buffer || !format)
{ {
LOG.errpointer(__file, __line); LOG.errpointer(__file, __line);
LOG.printf( "! Parameter is NULL pointer: gsprintf(%s,%i,%s,...).", LOG.printf( "! Parameter is NULL pointer: gsprintf(%s,%ul,%s,...).",
(buffer?"buffer":"NULL"), sizeOfBuffer, (format?"format":"NULL") ); (buffer?"buffer":"NULL"), (unsigned long)sizeOfBuffer, (format?"format":"NULL") );
PointerErrorExit(); PointerErrorExit();
return -1; return -1;
} }
@ -741,7 +741,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
if (!*format) if (!*format)
{ {
LOG.errtest(__file, __line); LOG.errtest(__file, __line);
LOG.printf("! Format is empty string: gsprintf(buffer,%i,"",...).", sizeOfBuffer); LOG.printf("! Format is empty string: gsprintf(buffer,%ul,"",...).", (unsigned long)sizeOfBuffer);
return 0; return 0;
} }

View File

@ -350,8 +350,10 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
break; break;
case 'p': case 'p':
strvalue = va_arg (args, void *); {
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); void * value = va_arg (args, void *);
fmtint (buffer, &currlen, maxlen, (long) value, 16, min, max, flags);
}
break; break;
case 'n': case 'n':
if (cflags == DP_C_SHORT) if (cflags == DP_C_SHORT)