Minor code cleanups: whitespace fixes, 80-column overflows, wrong comments.

This commit is contained in:
Ryan C. Gordon 2017-07-22 12:47:32 -04:00
parent c1defd3ec4
commit ace324cdc8
14 changed files with 30 additions and 32 deletions

View File

@ -31,7 +31,7 @@
static int grpLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
{
PHYSFS_uint32 location = 16 + (16 * count); /* past sig+metadata. */
PHYSFS_uint32 pos = 16 + (16 * count); /* past sig+metadata. */
PHYSFS_uint32 i;
for (i = 0; i < count; i++)
@ -47,9 +47,9 @@ static int grpLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
*ptr = '\0'; /* trim extra spaces. */
size = PHYSFS_swapULE32(size);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, location, size), 0);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
location += size;
pos += size;
} /* for */
return 1;

View File

@ -34,7 +34,7 @@
#if PHYSFS_SUPPORTS_HOG
static int hogLoadEntries(PHYSFS_Io *io, void *unpkarc)
static int hogLoadEntries(PHYSFS_Io *io, void *arc)
{
const PHYSFS_uint64 iolen = io->length(io);
PHYSFS_uint32 pos = 3;
@ -50,7 +50,7 @@ static int hogLoadEntries(PHYSFS_Io *io, void *unpkarc)
pos += 13 + 4;
size = PHYSFS_swapULE32(size);
BAIL_IF_ERRPASS(!UNPK_addEntry(unpkarc, name, 0, -1, -1, pos, size), 0);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
pos += size;
/* skip over entry */

View File

@ -45,7 +45,7 @@ static int iso9660LoadEntries(PHYSFS_Io *io, const int joliet,
static int iso9660AddEntry(PHYSFS_Io *io, const int joliet, const int isdir,
const char *base, PHYSFS_uint8 *fname,
const int fnamelen, const PHYSFS_sint64 timestamp,
const int fnamelen, const PHYSFS_sint64 ts,
const PHYSFS_uint64 pos, const PHYSFS_uint64 len,
void *unpkarc)
{
@ -107,9 +107,7 @@ static int iso9660AddEntry(PHYSFS_Io *io, const int joliet, const int isdir,
} /* if */
} /* else */
entry = UNPK_addEntry(unpkarc, fullpath, isdir,
timestamp, timestamp, pos, len);
entry = UNPK_addEntry(unpkarc, fullpath, isdir, ts, ts, pos, len);
if ((entry) && (isdir))
{
if (!iso9660LoadEntries(io, joliet, fullpath, pos, pos + len, unpkarc))

View File

@ -34,7 +34,7 @@
static int mvlLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
{
PHYSFS_uint32 location = 8 + (17 * count); /* past sig+metadata. */
PHYSFS_uint32 pos = 8 + (17 * count); /* past sig+metadata. */
PHYSFS_uint32 i;
for (i = 0; i < count; i++)
@ -45,8 +45,8 @@ static int mvlLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0);
name[12] = '\0'; /* just in case. */
size = PHYSFS_swapULE32(size);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, location, size), 0);
location += size;
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
pos += size;
} /* for */
return 1;

View File

@ -42,14 +42,14 @@ static int qpakLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
for (i = 0; i < count; i++)
{
PHYSFS_uint32 size;
PHYSFS_uint32 location;
PHYSFS_uint32 pos;
char name[56];
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 56), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &location, 4), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0);
size = PHYSFS_swapULE32(size);
location = PHYSFS_swapULE32(location);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, location, size), 0);
pos = PHYSFS_swapULE32(pos);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
} /* for */
return 1;

View File

@ -25,7 +25,7 @@ static int slbLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
PHYSFS_uint32 i;
for (i = 0; i < count; i++)
{
PHYSFS_uint32 location;
PHYSFS_uint32 pos;
PHYSFS_uint32 size;
char name[64];
char backslash;
@ -46,13 +46,13 @@ static int slbLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
*ptr = '/';
} /* for */
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &location, 4), 0);
location = PHYSFS_swapULE32(location);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0);
pos = PHYSFS_swapULE32(pos);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0);
size = PHYSFS_swapULE32(size);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, location, size), 0);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
} /* for */
return 1;

View File

@ -50,7 +50,7 @@ static PHYSFS_sint64 vdfDosTimeToEpoch(const PHYSFS_uint32 dostime)
static int vdfLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count,
const PHYSFS_sint64 t, void *arc)
const PHYSFS_sint64 ts, void *arc)
{
PHYSFS_uint32 i;
@ -81,7 +81,7 @@ static int vdfLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count,
/* !!! FIXME: we assume the filenames are low-ASCII; if they use
any high-ASCII chars, they will be invalid UTF-8. */
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, t, t, jump, size), 0);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, ts, ts, jump, size), 0);
} /* for */
return 1;

View File

@ -52,18 +52,18 @@ static int wadLoadEntries(PHYSFS_Io *io, const PHYSFS_uint32 count, void *arc)
PHYSFS_uint32 i;
for (i = 0; i < count; i++)
{
PHYSFS_uint32 location;
PHYSFS_uint32 pos;
PHYSFS_uint32 size;
char name[9];
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &location, 4), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &pos, 4), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, &size, 4), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, name, 8), 0);
name[8] = '\0'; /* name might not be null-terminated in file. */
size = PHYSFS_swapULE32(size);
location = PHYSFS_swapULE32(location);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, location, size), 0);
pos = PHYSFS_swapULE32(pos);
BAIL_IF_ERRPASS(!UNPK_addEntry(arc, name, 0, -1, -1, pos, size), 0);
} /* for */
return 1;

View File

@ -185,5 +185,5 @@ char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
#endif /* PHYSFS_PLATFORM_HAIKU */
/* end of beos.cpp ... */
/* end of platform_beos.cpp ... */

View File

@ -214,5 +214,5 @@ char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
#endif /* PHYSFS_PLATFORM_MACOSX */
/* end of macosx.c ... */
/* end of platform_macosx.c ... */

View File

@ -775,4 +775,4 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
#endif /* PHYSFS_PLATFORM_OS2 */
/* end of os2.c ... */
/* end of platform_os2.c ... */

View File

@ -415,5 +415,5 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
#endif /* PHYSFS_PLATFORM_POSIX */
/* end of posix.c ... */
/* end of platform_posix.c ... */

View File

@ -365,5 +365,5 @@ char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
#endif /* PHYSFS_PLATFORM_UNIX */
/* end of unix.c ... */
/* end of platform_unix.c ... */

View File

@ -954,6 +954,6 @@ int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st)
#endif /* PHYSFS_PLATFORM_WINDOWS */
#endif /* PHYSFS_PLATFORM_WINRT */
/* end of windows.c ... */
/* end of platform_windows.c ... */