Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-09-29 20:29:54 +0300
committerGitHub <noreply@github.com>2018-09-29 20:29:54 +0300
commit447d89cbd8ed836cc5550ae012e5a34f910886c5 (patch)
treedca18d0d537a400a242b747bf83b5d9479f0a26d
parentcb62bf2188854c5b7c44383571ebb19a414e6137 (diff)
parent28d2d96a83dd238acc43523d2fba1223ad0c5ac2 (diff)
Merge pull request #109 from OTAkeys/pr/fix-sign-compare
Fix -Wsign-compare error
-rw-r--r--Makefile2
-rw-r--r--lfs.c2
-rwxr-xr-xtests/test_alloc.sh6
-rwxr-xr-xtests/test_seek.sh2
-rwxr-xr-xtests/test_truncate.sh12
5 files changed, 12 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 020942f..17d3616 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ override CFLAGS += -m$(WORD)
endif
override CFLAGS += -I.
override CFLAGS += -std=c99 -Wall -pedantic
-override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init
+override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init -Wsign-compare
all: $(TARGET)
diff --git a/lfs.c b/lfs.c
index 852250f..d6b45f1 100644
--- a/lfs.c
+++ b/lfs.c
@@ -2481,7 +2481,7 @@ int lfs_deorphan(lfs_t *lfs) {
lfs_dir_t cwd = {.d.tail[0] = 0, .d.tail[1] = 1};
// iterate over all directory directory entries
- for (int i = 0; i < lfs->cfg->block_count; i++) {
+ for (lfs_size_t i = 0; i < lfs->cfg->block_count; i++) {
if (lfs_pairisnull(cwd.d.tail)) {
return 0;
}
diff --git a/tests/test_alloc.sh b/tests/test_alloc.sh
index 8c81490..6b3b181 100755
--- a/tests/test_alloc.sh
+++ b/tests/test_alloc.sh
@@ -32,18 +32,18 @@ lfs_alloc_singleproc() {
tests/test.py << TEST
const char *names[] = {"bacon", "eggs", "pancakes"};
lfs_mount(&lfs, &cfg) => 0;
- for (int n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
+ for (unsigned n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
sprintf((char*)buffer, "$1/%s", names[n]);
lfs_file_open(&lfs, &file[n], (char*)buffer,
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_APPEND) => 0;
}
- for (int n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
+ for (unsigned n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
size = strlen(names[n]);
for (int i = 0; i < $SIZE; i++) {
lfs_file_write(&lfs, &file[n], names[n], size) => size;
}
}
- for (int n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
+ for (unsigned n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
lfs_file_close(&lfs, &file[n]) => 0;
}
lfs_unmount(&lfs) => 0;
diff --git a/tests/test_seek.sh b/tests/test_seek.sh
index 0084d42..aa8e643 100755
--- a/tests/test_seek.sh
+++ b/tests/test_seek.sh
@@ -301,7 +301,7 @@ tests/test.py << TEST
size = strlen("hedgehoghog");
const lfs_soff_t offsets[] = {512, 1020, 513, 1021, 511, 1019};
- for (int i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++) {
+ for (unsigned i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++) {
lfs_soff_t off = offsets[i];
memcpy(buffer, "hedgehoghog", size);
lfs_file_seek(&lfs, &file[0], off, LFS_SEEK_SET) => off;
diff --git a/tests/test_truncate.sh b/tests/test_truncate.sh
index da5ccaf..053b2e0 100755
--- a/tests/test_truncate.sh
+++ b/tests/test_truncate.sh
@@ -23,14 +23,14 @@ tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;
- for (int i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
+ for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
sprintf((char*)buffer, "hairyhead%d", i);
lfs_file_open(&lfs, &file[0], (const char*)buffer,
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
strcpy((char*)buffer, "hair");
size = strlen((char*)buffer);
- for (int j = 0; j < startsizes[i]; j += size) {
+ for (lfs_off_t j = 0; j < startsizes[i]; j += size) {
lfs_file_write(&lfs, &file[0], buffer, size) => size;
}
lfs_file_size(&lfs, &file[0]) => startsizes[i];
@@ -55,13 +55,13 @@ tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;
- for (int i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
+ for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
sprintf((char*)buffer, "hairyhead%d", i);
lfs_file_open(&lfs, &file[0], (const char*)buffer, LFS_O_RDWR) => 0;
lfs_file_size(&lfs, &file[0]) => hotsizes[i];
size = strlen("hair");
- int j = 0;
+ lfs_off_t j = 0;
for (; j < startsizes[i] && j < hotsizes[i]; j += size) {
lfs_file_read(&lfs, &file[0], buffer, size) => size;
memcmp(buffer, "hair", size) => 0;
@@ -87,13 +87,13 @@ tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;
- for (int i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
+ for (unsigned i = 0; i < sizeof(startsizes)/sizeof(startsizes[0]); i++) {
sprintf((char*)buffer, "hairyhead%d", i);
lfs_file_open(&lfs, &file[0], (const char*)buffer, LFS_O_RDONLY) => 0;
lfs_file_size(&lfs, &file[0]) => coldsizes[i];
size = strlen("hair");
- int j = 0;
+ lfs_off_t j = 0;
for (; j < startsizes[i] && j < hotsizes[i] && j < coldsizes[i];
j += size) {
lfs_file_read(&lfs, &file[0], buffer, size) => size;