You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In having a look at issue #7601 a few minutes ago, I (once again) looked into how the LV_FS_WIN32_PATH macro is used, and I noticed an inconsistency in how it is used in lv_fs_win32.c. On line 363 in the fs_dir_open() function:
At first, I thought the fault was on line 226, and to prove it, I undefined LV_FS_WIN32_PATH in lv_conf.h and tried to compile lv_fs_win32.c. To my surprise, it compiled without errors. And then I realized: lv_conf_internal.h supplies it with a valid default value of an empty string "". That it is not possible for an end user (programmer) to accidentally not define LV_FS_WIN32_PATH.
So it now appears to me that the first use of it on line 363 is in fact "the inconsistency" -- that no alternate compilation directive should be used. Reason this is important: because it can mis-direct developers using LVGL to thinking that LV_FS_WIN32_PATH can somehow not be defined when that code is compiled. (Note that the entire file is protected with #if LV_USE_FS_WIN32 != '\0'.)
As a side note (different topic): #if LV_USE_FS_WIN32 != '\0' should probably be #if LV_USE_FS_WIN32 != 0. While I am aware that \0 also resolved to 0, there is no reason it should be represented as a char data type.
Introduce the problem
In having a look at issue #7601 a few minutes ago, I (once again) looked into how the
LV_FS_WIN32_PATH
macro is used, and I noticed an inconsistency in how it is used inlv_fs_win32.c
. On line 363 in thefs_dir_open()
function:but on line 226 in
fs_open()
:and there is no protective
#ifdef
.At first, I thought the fault was on line 226, and to prove it, I undefined
LV_FS_WIN32_PATH
inlv_conf.h
and tried to compilelv_fs_win32.c
. To my surprise, it compiled without errors. And then I realized:lv_conf_internal.h
supplies it with a valid default value of an empty string""
. That it is not possible for an end user (programmer) to accidentally not defineLV_FS_WIN32_PATH
.So it now appears to me that the first use of it on line 363 is in fact "the inconsistency" -- that no alternate compilation directive should be used. Reason this is important: because it can mis-direct developers using LVGL to thinking that
LV_FS_WIN32_PATH
can somehow not be defined when that code is compiled. (Note that the entire file is protected with#if LV_USE_FS_WIN32 != '\0'
.)As a side note (different topic):
#if LV_USE_FS_WIN32 != '\0'
should probably be#if LV_USE_FS_WIN32 != 0
. While I am aware that\0
also resolved to0
, there is no reason it should be represented as achar
data type.Proposal
Line 363 be changed to:
The text was updated successfully, but these errors were encountered: