Skip to content

Commit 24e6717

Browse files
gnoliyilcharles-lunarg
authored andcommitted
loader: Use "const char*" for string literals
Previously in the loader code, there were some function arguments and variables of `char *` type that stores string literals. This triggers compiler warnings when `-Wwrite-strings` is enabled (which is enabled by default if compiling C++). This change replaces `char*` with `const char*` for such variables and arguments. Bug: https://fxbug.dev/378964821 Change-Id: I14b2156294c329c78e51c7c8a33d3db7690fb851
1 parent c2326cc commit 24e6717

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

loader/loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,8 +3126,8 @@ VkResult read_data_files_in_search_paths(const struct loader_instance *inst, enu
31263126
char *cur_path_ptr = NULL;
31273127
bool use_first_found_manifest = false;
31283128
#if COMMON_UNIX_PLATFORMS
3129-
char *relative_location = NULL; // Only used on unix platforms
3130-
size_t rel_size = 0; // unused in windows, dont declare so no compiler warnings are generated
3129+
const char *relative_location = NULL; // Only used on unix platforms
3130+
size_t rel_size = 0; // unused in windows, dont declare so no compiler warnings are generated
31313131
#endif
31323132

31333133
#if defined(_WIN32)

loader/settings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ VkResult parse_layer_configurations(const struct loader_instance* inst, cJSON* s
207207
return res;
208208
}
209209

210-
VkResult check_if_settings_path_exists(const struct loader_instance* inst, char* base, char* suffix, char** settings_file_path) {
210+
VkResult check_if_settings_path_exists(const struct loader_instance* inst, const char* base, const char* suffix,
211+
char** settings_file_path) {
211212
if (NULL == base || NULL == suffix) {
212213
return VK_ERROR_INITIALIZATION_FAILED;
213214
}

0 commit comments

Comments
 (0)