Skip to content

Commit

Permalink
Fix the types used in a few places to placate GCC's -Wsign-compare
Browse files Browse the repository at this point in the history
on 32-bit platforms.  Bump version to 1.0.1.
  • Loading branch information
thorpej committed Apr 22, 2024
1 parent 0d5abac commit 89dce8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# CC=/usr/pkg/cross/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc

VERSION=1.0
VERSION=1.0.1

CPPFLAGS= -DCOCOFS_VERSION=$(VERSION)

Expand Down
13 changes: 7 additions & 6 deletions cocofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -536,7 +537,7 @@ cocofs_parse_fname(char *fname, char name[8], char ext[3],
return true;
}

static unsigned int
static uint16_t
cocofs_dir_lastbytes(const uint8_t *lastbytes)
{
return (lastbytes[0] << 8) | lastbytes[1];
Expand Down Expand Up @@ -770,7 +771,7 @@ cocofs_stat(const struct cocofs *fs, const struct cocofs_dirent *dir,
}

if (last_nsec) {
unsigned int lastsec_bytes;
uint16_t lastsec_bytes;

size += last_nsec * COCOFS_BYTES_PER_SEC;

Expand Down Expand Up @@ -819,7 +820,7 @@ cocofs_enumerate_directory(struct cocofs *fs, bool do_dump)
unsigned int di;
unsigned int free_granules = COCOFS_NGRANULES;
unsigned int loopcnt;
unsigned int lastbytes;
uint16_t lastbytes;
uint8_t g, gn;

uint8_t gmap_shadow[COCOFS_NGRANULES];
Expand Down Expand Up @@ -945,7 +946,7 @@ cocofs_copyout(const struct cocofs *fs, const struct cocofs_dirent *dir,
{
unsigned int loopcnt;
unsigned int last_nsec = 0;
unsigned int last_nbytes;
uint16_t last_nbytes;
unsigned int offset;
unsigned int gi;
ssize_t rv;
Expand Down Expand Up @@ -1135,10 +1136,10 @@ cocofs_copyin(struct cocofs *fs, const char *infile, const char name[8],
* each granule has been marked as allocated in the Granule
* Map.
*/
unsigned int resid, cursz;
ssize_t resid, cursz;
ssize_t rv;
uint8_t *buf;
for (gi = 0, resid = (unsigned int)sb.st_size;
for (gi = 0, resid = (ssize_t)sb.st_size;
resid != 0; gi++, resid -= cursz) {
cursz = resid;
if (cursz > COCOFS_BYTES_PER_GRANULE) {
Expand Down

0 comments on commit 89dce8b

Please sign in to comment.