Patches to build on gcc 4.3.3 on OS/2.

This is with the build environment and latest GCC builds available from...

  http://www.smedley.info/os2ports/

...this is apparently what Mozilla uses for Firefox builds on OS/2.
This commit is contained in:
Ryan C. Gordon 2009-03-29 04:11:38 -04:00
parent 7eff1f1977
commit 544f0f6185
2 changed files with 25 additions and 16 deletions

View File

@ -219,7 +219,7 @@ extern "C" {
#ifndef DOXYGEN_SHOULD_IGNORE_THIS #ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if (defined _MSC_VER) #if (defined _MSC_VER)
#define __EXPORT__ __declspec(dllexport) #define __EXPORT__ __declspec(dllexport)
#elif (__GNUC__ >= 3) #elif ((__GNUC__ >= 3) && (!__EMX__))
#define __EXPORT__ __attribute__((visibility("default"))) #define __EXPORT__ __attribute__((visibility("default")))
#else #else
#define __EXPORT__ #define __EXPORT__

View File

@ -95,7 +95,7 @@ static APIRET os2err(APIRET retval)
{ {
char buf[128]; char buf[128];
const char *err = get_os2_error_string(retval); const char *err = get_os2_error_string(retval);
if (err == ERR_OS2_GENERIC) if (strcmp(err, ERR_OS2_GENERIC) == 0)
{ {
snprintf(buf, sizeof (buf), ERR_OS2_GENERIC, (int) retval); snprintf(buf, sizeof (buf), ERR_OS2_GENERIC, (int) retval);
err = buf; err = buf;
@ -139,7 +139,7 @@ static void cvt_path_to_correct_case(char *buf)
if (ptr != NULL) /* isolate element to find (fname is the start). */ if (ptr != NULL) /* isolate element to find (fname is the start). */
*ptr = '\0'; *ptr = '\0';
rc = DosFindFirst(spec, &hdir, FILE_DIRECTORY, rc = DosFindFirst((unsigned char *) spec, &hdir, FILE_DIRECTORY,
&fb, sizeof (fb), &count, FIL_STANDARD); &fb, sizeof (fb), &count, FIL_STANDARD);
if (rc == NO_ERROR) if (rc == NO_ERROR)
{ {
@ -233,7 +233,7 @@ static int is_cdrom_drive(ULONG drive)
ULONG ul1, ul2; ULONG ul1, ul2;
APIRET rc; APIRET rc;
HFILE hfile = NULLHANDLE; HFILE hfile = NULLHANDLE;
char drivename[3] = { 'A' + drive, ':', '\0' }; unsigned char drivename[3] = { 'A' + drive, ':', '\0' };
rc = DosOpen(drivename, &hfile, &ul1, 0, 0, rc = DosOpen(drivename, &hfile, &ul1, 0, 0,
OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
@ -297,8 +297,9 @@ char *__PHYSFS_platformGetUserDir(void)
} /* __PHYSFS_platformGetUserDir */ } /* __PHYSFS_platformGetUserDir */
int __PHYSFS_platformExists(const char *fname) int __PHYSFS_platformExists(const char *_fname)
{ {
const unsigned char *fname = (const unsigned char *) _fname;
FILESTATUS3 fs; FILESTATUS3 fs;
APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs)); APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs));
return(os2err(rc) == NO_ERROR); return(os2err(rc) == NO_ERROR);
@ -311,8 +312,9 @@ int __PHYSFS_platformIsSymLink(const char *fname)
} /* __PHYSFS_platformIsSymlink */ } /* __PHYSFS_platformIsSymlink */
int __PHYSFS_platformIsDirectory(const char *fname) int __PHYSFS_platformIsDirectory(const char *_fname)
{ {
const unsigned char *fname = (const unsigned char *) _fname;
FILESTATUS3 fs; FILESTATUS3 fs;
APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs)); APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs));
BAIL_IF_MACRO(os2err(rc) != NO_ERROR, NULL, 0) BAIL_IF_MACRO(os2err(rc) != NO_ERROR, NULL, 0)
@ -371,7 +373,7 @@ void __PHYSFS_platformEnumerateFiles(const char *dirname,
strcpy(spec, dirname); strcpy(spec, dirname);
strcat(spec, (spec[strlen(spec) - 1] != '\\') ? "\\*.*" : "*.*"); strcat(spec, (spec[strlen(spec) - 1] != '\\') ? "\\*.*" : "*.*");
rc = DosFindFirst(spec, &hdir, rc = DosFindFirst((unsigned char *) spec, &hdir,
FILE_DIRECTORY | FILE_ARCHIVED | FILE_DIRECTORY | FILE_ARCHIVED |
FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM,
&fb, sizeof (fb), &count, FIL_STANDARD); &fb, sizeof (fb), &count, FIL_STANDARD);
@ -424,8 +426,9 @@ char *__PHYSFS_platformCurrentDir(void)
} /* __PHYSFS_platformCurrentDir */ } /* __PHYSFS_platformCurrentDir */
char *__PHYSFS_platformRealPath(const char *path) char *__PHYSFS_platformRealPath(const char *_path)
{ {
const unsigned char *path = (const unsigned char *) _path;
char buf[CCHMAXPATH]; char buf[CCHMAXPATH];
char *retval; char *retval;
APIRET rc = DosQueryPathInfo(path, FIL_QUERYFULLNAME, buf, sizeof (buf)); APIRET rc = DosQueryPathInfo(path, FIL_QUERYFULLNAME, buf, sizeof (buf));
@ -437,14 +440,16 @@ char *__PHYSFS_platformRealPath(const char *path)
} /* __PHYSFS_platformRealPath */ } /* __PHYSFS_platformRealPath */
int __PHYSFS_platformMkDir(const char *path) int __PHYSFS_platformMkDir(const char *_filename)
{ {
return(os2err(DosCreateDir(path, NULL)) == NO_ERROR); const unsigned char *filename = (const unsigned char *) _filename;
return(os2err(DosCreateDir(filename, NULL)) == NO_ERROR);
} /* __PHYSFS_platformMkDir */ } /* __PHYSFS_platformMkDir */
void *__PHYSFS_platformOpenRead(const char *filename) void *__PHYSFS_platformOpenRead(const char *_filename)
{ {
const unsigned char *filename = (const unsigned char *) _filename;
ULONG actionTaken = 0; ULONG actionTaken = 0;
HFILE hfile = NULLHANDLE; HFILE hfile = NULLHANDLE;
@ -462,8 +467,9 @@ void *__PHYSFS_platformOpenRead(const char *filename)
} /* __PHYSFS_platformOpenRead */ } /* __PHYSFS_platformOpenRead */
void *__PHYSFS_platformOpenWrite(const char *filename) void *__PHYSFS_platformOpenWrite(const char *_filename)
{ {
const unsigned char *filename = (const unsigned char *) _filename;
ULONG actionTaken = 0; ULONG actionTaken = 0;
HFILE hfile = NULLHANDLE; HFILE hfile = NULLHANDLE;
@ -481,8 +487,9 @@ void *__PHYSFS_platformOpenWrite(const char *filename)
} /* __PHYSFS_platformOpenWrite */ } /* __PHYSFS_platformOpenWrite */
void *__PHYSFS_platformOpenAppend(const char *filename) void *__PHYSFS_platformOpenAppend(const char *_filename)
{ {
const unsigned char *filename = (const unsigned char *) _filename;
ULONG dummy = 0; ULONG dummy = 0;
HFILE hfile = NULLHANDLE; HFILE hfile = NULLHANDLE;
APIRET rc; APIRET rc;
@ -614,17 +621,19 @@ int __PHYSFS_platformClose(void *opaque)
} /* __PHYSFS_platformClose */ } /* __PHYSFS_platformClose */
int __PHYSFS_platformDelete(const char *path) int __PHYSFS_platformDelete(const char *_path)
{ {
if (__PHYSFS_platformIsDirectory(path)) const unsigned char *path = (const unsigned char *) _path;
if (__PHYSFS_platformIsDirectory(_path))
return(os2err(DosDeleteDir(path)) == NO_ERROR); return(os2err(DosDeleteDir(path)) == NO_ERROR);
return(os2err(DosDelete(path) == NO_ERROR)); return(os2err(DosDelete(path) == NO_ERROR));
} /* __PHYSFS_platformDelete */ } /* __PHYSFS_platformDelete */
PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *_fname)
{ {
const unsigned char *fname = (const unsigned char *) _fname;
PHYSFS_sint64 retval; PHYSFS_sint64 retval;
struct tm tm; struct tm tm;
FILESTATUS3 fs; FILESTATUS3 fs;