Skip to content

Commit e1712ad

Browse files
Copilotprobonopd
andcommitted
Fix remaining compiler warnings: sign conversion and format string
- digest.c: Cast to ssize_t instead of size_t when assigning negative values to bytes_skip_following_chunks - appimagetool_sign.c: Use %lld format specifier with (long long) cast for off_t type These fixes address all remaining -Werror warnings on all architectures. Co-authored-by: probonopd <[email protected]>
1 parent 64c55cd commit e1712ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/appimagetool_sign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ bool embed_data_in_elf_section(const char* filename, const char* elf_section, gp
213213
}
214214

215215
if (verbose) {
216-
fprintf(stderr, "[sign] data size: %lu\n", data_size);
216+
fprintf(stderr, "[sign] data size: %lld\n", (long long)data_size);
217217
}
218218

219219
// rewind so we can later read the data

src/digest.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ bool appimage_type2_digest_md5(const char* path, char* digest) {
6868
// if bytes_left is now < 0, the section exceeds the current chunk
6969
// this amount of bytes needs to be skipped in the future sections
7070
if (bytes_left_this_chunk < 0) {
71-
bytes_skip_following_chunks = (size_t) (-1 * bytes_left_this_chunk);
71+
bytes_skip_following_chunks = (ssize_t) (-1 * bytes_left_this_chunk);
7272
bytes_left_this_chunk = 0;
7373
}
7474

@@ -88,7 +88,7 @@ bool appimage_type2_digest_md5(const char* path, char* digest) {
8888
// if bytes_left is now < 0, the section exceeds the current chunk
8989
// this amount of bytes needs to be skipped in the future sections
9090
if (bytes_left_this_chunk < 0) {
91-
bytes_skip_following_chunks = (size_t) (-1 * bytes_left_this_chunk);
91+
bytes_skip_following_chunks = (ssize_t) (-1 * bytes_left_this_chunk);
9292
bytes_left_this_chunk = 0;
9393
}
9494

@@ -108,7 +108,7 @@ bool appimage_type2_digest_md5(const char* path, char* digest) {
108108
// if bytes_left is now < 0, the section exceeds the current chunk
109109
// this amount of bytes needs to be skipped in the future sections
110110
if (bytes_left_this_chunk < 0) {
111-
bytes_skip_following_chunks = (size_t) (-1 * bytes_left_this_chunk);
111+
bytes_skip_following_chunks = (ssize_t) (-1 * bytes_left_this_chunk);
112112
bytes_left_this_chunk = 0;
113113
}
114114

0 commit comments

Comments
 (0)