-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: change position and size parameters to size_t to avoid 64-bit system compiler warnings #5873
Open
glueckm
wants to merge
15
commits into
lvgl:master
Choose a base branch
from
glueckm:filesystem_size_t
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e445d49
chore: Change the type of size and position parameters for the file s…
395a73a
chore: Fix compiler error on different platforms
glueckm d014eb1
chore: Fix compiler errors in lv_libpng
glueckm a03b5d5
chore: Fix compiler errors in lv_libjpeg_turbo
glueckm e912fac
chore: Use size_t in the file system tests as well
glueckm 814e536
Merge branch 'lvgl:master' into filesystem_size_t
glueckm 8869994
Merge branch 'master' into filesystem_size_t
glueckm 5bc9a89
Merge branch 'master' into filesystem_size_t
FASTSHIFT ddeb37c
Merge master
glueckm bec3f49
chore: type of some cache attributes changed from uint32_t to size_t
glueckm c4bb620
chore: Compiler error for LOG entry fixed
glueckm 54b0637
chore: Compiler error for LOG entry fixed, code formating fixed
glueckm f134b80
chore: Blanks at end of line remove
glueckm e28a810
chore: Change size struct field of lv_fs_path_ex_t to size_t
glueckm fd78474
chore: Remove unnecessary casts and use %zu as format string for size…
glueckm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,7 +274,7 @@ static lv_result_t decoder_open_file(lv_image_decoder_t * decoder, lv_image_deco | |
|
||
/* get real src header */ | ||
lv_image_header_t src_header; | ||
uint32_t header_br = 0; | ||
size_t header_br = 0; | ||
res = lv_fs_read(&file, &src_header, sizeof(src_header), &header_br); | ||
if(res != LV_FS_RES_OK || header_br != sizeof(src_header)) { | ||
LV_LOG_ERROR("read %s lv_image_header_t failed", path); | ||
|
@@ -305,11 +305,11 @@ static lv_result_t decoder_open_file(lv_image_decoder_t * decoder, lv_image_deco | |
uint32_t palette_size_bytes = palette_size * sizeof(lv_color32_t); | ||
|
||
/* read palette */ | ||
uint32_t palette_br = 0; | ||
size_t palette_br = 0; | ||
res = lv_fs_read(&file, dest, palette_size_bytes, &palette_br); | ||
if(res != LV_FS_RES_OK || palette_br != palette_size_bytes) { | ||
LV_LOG_ERROR("read %s (palette: %" LV_PRIu32 ", br: %" LV_PRIu32 ") failed", | ||
path, palette_size_bytes, palette_br); | ||
path, palette_size_bytes, (uint32_t)palette_br); | ||
goto failed; | ||
} | ||
|
||
|
@@ -329,11 +329,11 @@ static lv_result_t decoder_open_file(lv_image_decoder_t * decoder, lv_image_deco | |
dest += DEST_IMG_OFFSET; | ||
|
||
for(uint32_t y = 0; y < height; y++) { | ||
uint32_t br = 0; | ||
size_t br = 0; | ||
res = lv_fs_read(&file, src_temp, src_stride, &br); | ||
if(res != LV_FS_RES_OK || br != src_stride) { | ||
LV_LOG_ERROR("read %s (y: %" LV_PRIu32 ", src_stride: %" LV_PRIu32 ", br: %" LV_PRIu32 ") failed", | ||
path, y, src_stride, br); | ||
path, y, src_stride, (uint32_t)br); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use %zu |
||
goto failed; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_ | |
int32_t w_px, const uint8_t * in, lv_color32_t * out); | ||
static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); | ||
|
||
static lv_fs_res_t fs_read_file_at(lv_fs_file_t * f, uint32_t pos, void * buff, uint32_t btr, uint32_t * br); | ||
static lv_fs_res_t fs_read_file_at(lv_fs_file_t * f, size_t pos, void * buff, size_t btr, size_t * br); | ||
|
||
static lv_result_t decompress_image(lv_image_decoder_dsc_t * dsc, const lv_image_compressed_t * compressed); | ||
|
||
|
@@ -123,7 +123,7 @@ lv_result_t lv_bin_decoder_info(lv_image_decoder_t * decoder, const void * src, | |
lv_fs_file_t f; | ||
lv_fs_res_t res = lv_fs_open(&f, src, LV_FS_MODE_RD); | ||
if(res == LV_FS_RES_OK) { | ||
uint32_t rn; | ||
size_t rn; | ||
res = lv_fs_read(&f, header, sizeof(lv_image_header_t), &rn); | ||
lv_fs_close(&f); | ||
if(res != LV_FS_RES_OK || rn != sizeof(lv_image_header_t)) { | ||
|
@@ -550,11 +550,11 @@ static lv_result_t decode_indexed(lv_image_decoder_t * decoder, lv_image_decoder | |
{ | ||
LV_UNUSED(decoder); /*Unused*/ | ||
lv_result_t res; | ||
uint32_t rn; | ||
size_t rn; | ||
decoder_data_t * decoder_data = dsc->user_data; | ||
lv_fs_file_t * f = decoder_data->f; | ||
lv_color_format_t cf = dsc->header.cf; | ||
uint32_t palette_len = sizeof(lv_color32_t) * LV_COLOR_INDEXED_PALETTE_SIZE(cf); | ||
size_t palette_len = sizeof(lv_color32_t) * LV_COLOR_INDEXED_PALETTE_SIZE(cf); | ||
const lv_color32_t * palette; | ||
const uint8_t * indexed_data = NULL; | ||
lv_draw_buf_t * draw_buf_indexed = NULL; | ||
|
@@ -593,14 +593,14 @@ static lv_result_t decode_indexed(lv_image_decoder_t * decoder, lv_image_decoder | |
|
||
indexed_data = draw_buf_indexed->data; | ||
|
||
uint32_t data_len = 0; | ||
size_t data_len = 0; | ||
if(lv_fs_seek(f, 0, LV_FS_SEEK_END) != LV_FS_RES_OK || | ||
lv_fs_tell(f, &data_len) != LV_FS_RES_OK) { | ||
LV_LOG_WARN("Failed to get file to size"); | ||
goto exit_with_buf; | ||
} | ||
|
||
uint32_t data_offset = sizeof(lv_image_header_t) + palette_len; | ||
size_t data_offset = sizeof(lv_image_header_t) + palette_len; | ||
data_len -= data_offset; | ||
res = fs_read_file_at(f, data_offset, (uint8_t *)indexed_data, data_len, &rn); | ||
if(res != LV_FS_RES_OK || rn != data_len) { | ||
|
@@ -678,7 +678,7 @@ static lv_result_t load_indexed(lv_image_decoder_t * decoder, lv_image_decoder_d | |
LV_UNUSED(decoder); /*Unused*/ | ||
|
||
lv_result_t res; | ||
uint32_t rn; | ||
size_t rn; | ||
decoder_data_t * decoder_data = dsc->user_data; | ||
|
||
if(dsc->header.flags & LV_IMAGE_FLAGS_COMPRESSED) { | ||
|
@@ -722,23 +722,23 @@ static lv_result_t load_indexed(lv_image_decoder_t * decoder, lv_image_decoder_d | |
} | ||
|
||
uint8_t * data = decoded->data; | ||
uint32_t palette_len = sizeof(lv_color32_t) * LV_COLOR_INDEXED_PALETTE_SIZE(cf); | ||
size_t palette_len = sizeof(lv_color32_t) * LV_COLOR_INDEXED_PALETTE_SIZE(cf); | ||
res = fs_read_file_at(f, sizeof(lv_image_header_t), data, palette_len, &rn); | ||
if(res != LV_FS_RES_OK || rn != palette_len) { | ||
LV_LOG_WARN("Read palette failed: %d", res); | ||
lv_draw_buf_destroy(decoded); | ||
return LV_RESULT_INVALID; | ||
} | ||
|
||
uint32_t data_len = 0; | ||
size_t data_len = 0; | ||
if(lv_fs_seek(f, 0, LV_FS_SEEK_END) != LV_FS_RES_OK || | ||
lv_fs_tell(f, &data_len) != LV_FS_RES_OK) { | ||
LV_LOG_WARN("Failed to get file to size"); | ||
lv_draw_buf_destroy(decoded); | ||
return LV_RESULT_INVALID; | ||
} | ||
|
||
uint32_t data_offset = sizeof(lv_image_header_t) + palette_len; | ||
size_t data_offset = sizeof(lv_image_header_t) + palette_len; | ||
data_len -= data_offset; | ||
data += palette_len; | ||
res = fs_read_file_at(f, data_offset, data, data_len, &rn); | ||
|
@@ -780,7 +780,7 @@ static lv_result_t decode_rgb(lv_image_decoder_t * decoder, lv_image_decoder_dsc | |
|
||
uint8_t * img_data = decoded->data; | ||
|
||
uint32_t rn; | ||
size_t rn; | ||
res = fs_read_file_at(f, sizeof(lv_image_header_t), img_data, len, &rn); | ||
if(res != LV_FS_RES_OK || rn != len) { | ||
LV_LOG_WARN("Read rgb file failed: %d", res); | ||
|
@@ -815,7 +815,7 @@ static lv_result_t decode_alpha_only(lv_image_decoder_t * decoder, lv_image_deco | |
{ | ||
LV_UNUSED(decoder); | ||
lv_result_t res; | ||
uint32_t rn; | ||
size_t rn; | ||
decoder_data_t * decoder_data = dsc->user_data; | ||
uint8_t bpp = lv_color_format_get_bpp(dsc->header.cf); | ||
uint32_t w = (dsc->header.stride * 8) / bpp; | ||
|
@@ -884,9 +884,9 @@ static lv_result_t decode_alpha_only(lv_image_decoder_t * decoder, lv_image_deco | |
static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) | ||
{ | ||
#if LV_BIN_DECODER_RAM_LOAD | ||
uint32_t rn; | ||
uint32_t len; | ||
uint32_t compressed_len; | ||
size_t rn; | ||
size_t len; | ||
size_t compressed_len; | ||
decoder_data_t * decoder_data = get_decoder_data(dsc); | ||
lv_result_t res; | ||
uint8_t * file_buf = NULL; | ||
|
@@ -915,7 +915,8 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco | |
} | ||
|
||
if(compressed->compressed_size != compressed_len) { | ||
LV_LOG_WARN("Compressed size mismatch: %" LV_PRIu32" != %" LV_PRIu32, compressed->compressed_size, compressed_len); | ||
LV_LOG_WARN("Compressed size mismatch: %" LV_PRIu32" != %" LV_PRIu32, compressed->compressed_size, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. %zu |
||
(uint32_t)compressed_len); | ||
return LV_RESULT_INVALID; | ||
} | ||
|
||
|
@@ -947,7 +948,8 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco | |
lv_memcpy(compressed, image->data, len); | ||
compressed->data = image->data + len; | ||
if(compressed->compressed_size != compressed_len) { | ||
LV_LOG_WARN("Compressed size mismatch: %" LV_PRIu32" != %" LV_PRIu32, compressed->compressed_size, compressed_len); | ||
LV_LOG_WARN("Compressed size mismatch: %" LV_PRIu32" != %" LV_PRIu32, compressed->compressed_size, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. %zu |
||
(uint32_t)compressed_len); | ||
return LV_RESULT_INVALID; | ||
} | ||
} | ||
|
@@ -1046,7 +1048,7 @@ static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_ | |
return LV_RESULT_OK; | ||
} | ||
|
||
static lv_fs_res_t fs_read_file_at(lv_fs_file_t * f, uint32_t pos, void * buff, uint32_t btr, uint32_t * br) | ||
static lv_fs_res_t fs_read_file_at(lv_fs_file_t * f, size_t pos, void * buff, size_t btr, size_t * br) | ||
{ | ||
lv_fs_res_t res; | ||
if(br) *br = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%zu