mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Fix -Wsign-compare error
This commit is contained in:
		
				
					committed by
					
						 Christopher Haster
						Christopher Haster
					
				
			
			
				
	
			
			
			
						parent
						
							cb62bf2188
						
					
				
				
					commit
					28d2d96a83
				
			
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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) | ||||
|   | ||||
							
								
								
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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; | ||||
|         } | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user