diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-09 15:41:43 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-09 15:41:43 +0100 |
| commit | 703c9ff2ea607d457b1d8c6ff4022b6869d40bf7 (patch) | |
| tree | a847fa3a0ea023eb97ac46131fd6ba4c1a291c13 /src/linux/main_linux.cpp | |
| parent | 331882200dbad630d7722b4f05e23d69edbc6a6a (diff) | |
fix warnings
Diffstat (limited to 'src/linux/main_linux.cpp')
| -rw-r--r-- | src/linux/main_linux.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/linux/main_linux.cpp b/src/linux/main_linux.cpp index fda8d64..2041c09 100644 --- a/src/linux/main_linux.cpp +++ b/src/linux/main_linux.cpp @@ -32,7 +32,7 @@ static const char* _ts_platform_get_config_file_path(char* buffer) { char* env = getenv("HOME"); char path_buf[MAX_INPUT_LENGTH]; snprintf(path_buf, MAX_INPUT_LENGTH, "%s%s", env, "/text-search/"); - snprintf(buffer, MAX_INPUT_LENGTH, "%s%s", path_buf, "imgui.ini"); + snprintf(buffer, MAX_INPUT_LENGTH, "%.*s%s", MAX_INPUT_LENGTH-10, path_buf, "imgui.ini"); if (!ts_platform_dir_exists(path_buf)) { mkdir(path_buf, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); } @@ -232,10 +232,10 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) struct dirent *dir; d = opendir(search_dir); if (d) { - chdir(search_dir); + if (chdir(search_dir) != 0) return; while ((dir = readdir(d)) != NULL) { if (result->cancel_search) return; - chdir(search_dir); + if (chdir(search_dir) != 0) continue; if (dir->d_type == DT_DIR) { @@ -254,7 +254,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) else if (dir->d_type == DT_REG || dir->d_type == DT_UNKNOWN) { char *matched_filter = 0; - if (ts_filter_matches(&result->filters, dir->d_name, &matched_filter) == -1) { + if (ts_filter_matches(&result->filters, dir->d_name, &matched_filter) == (size_t)-1) { continue; } (void)matched_filter; |
