Skip to content

Commit 89dce8b

Browse files
committed
Fix the types used in a few places to placate GCC's -Wsign-compare
on 32-bit platforms. Bump version to 1.0.1.
1 parent 0d5abac commit 89dce8b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# CC=/usr/pkg/cross/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc
77

8-
VERSION=1.0
8+
VERSION=1.0.1
99

1010
CPPFLAGS= -DCOCOFS_VERSION=$(VERSION)
1111

cocofs.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#include <fcntl.h>
8181
#include <inttypes.h>
8282
#include <stdbool.h>
83+
#include <stdint.h>
8384
#include <stdio.h>
8485
#include <stdlib.h>
8586
#include <string.h>
@@ -536,7 +537,7 @@ cocofs_parse_fname(char *fname, char name[8], char ext[3],
536537
return true;
537538
}
538539

539-
static unsigned int
540+
static uint16_t
540541
cocofs_dir_lastbytes(const uint8_t *lastbytes)
541542
{
542543
return (lastbytes[0] << 8) | lastbytes[1];
@@ -770,7 +771,7 @@ cocofs_stat(const struct cocofs *fs, const struct cocofs_dirent *dir,
770771
}
771772

772773
if (last_nsec) {
773-
unsigned int lastsec_bytes;
774+
uint16_t lastsec_bytes;
774775

775776
size += last_nsec * COCOFS_BYTES_PER_SEC;
776777

@@ -819,7 +820,7 @@ cocofs_enumerate_directory(struct cocofs *fs, bool do_dump)
819820
unsigned int di;
820821
unsigned int free_granules = COCOFS_NGRANULES;
821822
unsigned int loopcnt;
822-
unsigned int lastbytes;
823+
uint16_t lastbytes;
823824
uint8_t g, gn;
824825

825826
uint8_t gmap_shadow[COCOFS_NGRANULES];
@@ -945,7 +946,7 @@ cocofs_copyout(const struct cocofs *fs, const struct cocofs_dirent *dir,
945946
{
946947
unsigned int loopcnt;
947948
unsigned int last_nsec = 0;
948-
unsigned int last_nbytes;
949+
uint16_t last_nbytes;
949950
unsigned int offset;
950951
unsigned int gi;
951952
ssize_t rv;
@@ -1135,10 +1136,10 @@ cocofs_copyin(struct cocofs *fs, const char *infile, const char name[8],
11351136
* each granule has been marked as allocated in the Granule
11361137
* Map.
11371138
*/
1138-
unsigned int resid, cursz;
1139+
ssize_t resid, cursz;
11391140
ssize_t rv;
11401141
uint8_t *buf;
1141-
for (gi = 0, resid = (unsigned int)sb.st_size;
1142+
for (gi = 0, resid = (ssize_t)sb.st_size;
11421143
resid != 0; gi++, resid -= cursz) {
11431144
cursz = resid;
11441145
if (cursz > COCOFS_BYTES_PER_GRANULE) {

0 commit comments

Comments
 (0)