Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor code cleanups: whitespace fixes, 80-column overflows, wrong com…
…ments.
  • Loading branch information
icculus committed Jul 22, 2017
1 parent c1defd3 commit ace324c
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 32 deletions.
6 changes: 3 additions & 3 deletions src/archiver_grp.c
Expand Up @@ -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++)
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/archiver_hog.c
Expand Up @@ -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;
Expand All @@ -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 */
Expand Down
6 changes: 2 additions & 4 deletions src/archiver_iso9660.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions src/archiver_mvl.c
Expand Up @@ -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++)
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/archiver_qpak.c
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/archiver_slb.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/archiver_vdf.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/archiver_wad.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/platform_beos.cpp
Expand Up @@ -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 ... */

2 changes: 1 addition & 1 deletion src/platform_macosx.c
Expand Up @@ -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 ... */

2 changes: 1 addition & 1 deletion src/platform_os2.c
Expand Up @@ -775,4 +775,4 @@ void __PHYSFS_platformReleaseMutex(void *mutex)

#endif /* PHYSFS_PLATFORM_OS2 */

/* end of os2.c ... */
/* end of platform_os2.c ... */
2 changes: 1 addition & 1 deletion src/platform_posix.c
Expand Up @@ -415,5 +415,5 @@ void __PHYSFS_platformReleaseMutex(void *mutex)

#endif /* PHYSFS_PLATFORM_POSIX */

/* end of posix.c ... */
/* end of platform_posix.c ... */

2 changes: 1 addition & 1 deletion src/platform_unix.c
Expand Up @@ -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 ... */

2 changes: 1 addition & 1 deletion src/platform_windows.c
Expand Up @@ -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 ... */


0 comments on commit ace324c

Please sign in to comment.