From 544438b01e0827bb223f22276edc9fe1344735a7 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sat, 25 Feb 2006 20:28:25 +0000 Subject: Prepare those files to be renamed as *.c svn-id: r20886 --- backends/PalmOS/Src/missing/_stdio.cpp | 12 ++++++------ backends/PalmOS/Src/missing/_stdlib.cpp | 9 ++++++--- backends/PalmOS/Src/missing/stdio.h | 8 ++++++++ backends/PalmOS/Src/missing/string.h | 8 ++++++++ backends/PalmOS/Src/missing/time.h | 9 ++++++++- backends/PalmOS/Src/missing/unistd.h | 8 ++++++++ 6 files changed, 44 insertions(+), 10 deletions(-) (limited to 'backends') diff --git a/backends/PalmOS/Src/missing/_stdio.cpp b/backends/PalmOS/Src/missing/_stdio.cpp index 127689524d..c973e64552 100644 --- a/backends/PalmOS/Src/missing/_stdio.cpp +++ b/backends/PalmOS/Src/missing/_stdio.cpp @@ -350,13 +350,13 @@ Int32 ftell(FILE *stream) { // DONE } Int32 fprintf(FILE *stream, const Char *formatStr, ...) { // DONE - if (!stream->fileRef) - return 0; - UInt32 numBytesWritten; Char buf[256]; va_list va; + if (!stream->fileRef) + return 0; + va_start(va, formatStr); vsprintf(buf, formatStr, va); va_end(va); @@ -366,13 +366,13 @@ Int32 fprintf(FILE *stream, const Char *formatStr, ...) { // DONE } Int32 printf(const Char *format, ...) { // DONE - if (!stdout->fileRef) - return 0; - UInt32 numBytesWritten; Char buf[256]; va_list va; + if (!stdout->fileRef) + return 0; + va_start(va, format); vsprintf(buf, format, va); va_end(va); diff --git a/backends/PalmOS/Src/missing/_stdlib.cpp b/backends/PalmOS/Src/missing/_stdlib.cpp index f9e65a38d1..11a242145a 100644 --- a/backends/PalmOS/Src/missing/_stdlib.cpp +++ b/backends/PalmOS/Src/missing/_stdlib.cpp @@ -25,7 +25,7 @@ #include #define memNewChunkFlagAllowLarge 0x1000 -extern "C" SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP) SYS_TRAP(sysTrapSysGetAppInfo); +SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP) SYS_TRAP(sysTrapSysGetAppInfo); void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int (*compar)(const void *, const void *)) { #ifdef PALMOS_68K @@ -33,7 +33,8 @@ void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int if (SysBinarySearch(base, nmemb, size, (SearchFuncPtr)compar, key, 0, &position, true)) return (void *)((UInt32)base + size * position); #else - for (int i = 0; i < nmemb; i++) + int i; + for (i = 0; i < nmemb; i++) if (compar(key, (void*)((UInt32)base + size * i)) == 0) return (void*)((UInt32)base + size * i); #endif @@ -94,11 +95,13 @@ Err free(MemPtr memP) { } MemPtr realloc(MemPtr oldP, UInt32 size) { + MemPtr newP; + if (oldP != NULL) if (MemPtrResize(oldP, size) == 0) return oldP; - MemPtr newP = malloc(size); // was MemPtrNew + newP = malloc(size); // was MemPtrNew if (oldP!=NULL) { MemMove(newP,oldP,MemPtrSize(oldP)); diff --git a/backends/PalmOS/Src/missing/stdio.h b/backends/PalmOS/Src/missing/stdio.h index ca77f1d022..558231e250 100644 --- a/backends/PalmOS/Src/missing/stdio.h +++ b/backends/PalmOS/Src/missing/stdio.h @@ -28,6 +28,10 @@ #include "palmversion.h" #include +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*LedProc)(Boolean show); typedef struct { @@ -88,4 +92,8 @@ void StdioSetLedProc (LedProc ledProc); void StdioSetCacheSize (UInt32 s); void StdioRelease (); +#ifdef __cplusplus +} +#endif + #endif diff --git a/backends/PalmOS/Src/missing/string.h b/backends/PalmOS/Src/missing/string.h index 589f0369a1..dff87ff99d 100644 --- a/backends/PalmOS/Src/missing/string.h +++ b/backends/PalmOS/Src/missing/string.h @@ -27,6 +27,10 @@ #include "palmversion.h" +#ifdef __cplusplus +extern "C" { +#endif + #define memcmp MemCmp #define memcpy MemMove #define memmove MemMove @@ -53,4 +57,8 @@ UInt32 strspn (const char *s1, const char *s2); #define StrTok strtok +#ifdef __cplusplus +} +#endif + #endif diff --git a/backends/PalmOS/Src/missing/time.h b/backends/PalmOS/Src/missing/time.h index 706f6684bc..3de16f4517 100644 --- a/backends/PalmOS/Src/missing/time.h +++ b/backends/PalmOS/Src/missing/time.h @@ -25,9 +25,12 @@ #ifndef __TIME_H__ #define __TIME_H__ - #include "palmversion.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef UInt32 time_t; struct tm { @@ -45,4 +48,8 @@ struct tm { time_t time(time_t *tloc); struct tm *localtime(const time_t *timer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/backends/PalmOS/Src/missing/unistd.h b/backends/PalmOS/Src/missing/unistd.h index 40eead34cf..400b0e2c39 100644 --- a/backends/PalmOS/Src/missing/unistd.h +++ b/backends/PalmOS/Src/missing/unistd.h @@ -27,8 +27,16 @@ #include "palmversion.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const Char *gUnistdCWD; Char *getcwd(Char *buf, UInt32 size); +#ifdef __cplusplus +} +#endif + #endif -- cgit v1.2.3