From bb3005f9b9fff1333900d8635ad9aeda1021eb94 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 18 Dec 2016 01:19:26 -0800 Subject: [PATCH] Constify some data --- programs/imagex.c | 8 ++++---- src/compress.c | 2 +- src/decompress.c | 2 +- src/mount_image.c | 2 +- src/resource.c | 4 ++-- src/win32_apply.c | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/programs/imagex.c b/programs/imagex.c index c1b064dc..d52b058d 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -490,7 +490,7 @@ verify_image_exists_and_is_single(int image, const tchar *image_name, static void print_available_compression_types(FILE *fp) { - static const tchar *s = + static const tchar * const s = T( "Available compression types:\n" "\n" @@ -4378,7 +4378,7 @@ static const struct imagex_command imagex_commands[] = { #endif -static const tchar *usage_strings[] = { +static const tchar * const usage_strings[] = { [CMD_APPEND] = T( " %"TS" " SOURCE_STR " WIMFILE [IMAGE_NAME [IMAGE_DESC]]\n" @@ -4511,7 +4511,7 @@ static const tchar *get_cmd_string(int cmd, bool nospace) static void version(void) { - static const tchar *s = + static const tchar * const s = T( "wimlib-imagex (distributed with " PACKAGE " " PACKAGE_VERSION ")\n" "Copyright (C) 2012-2016 Eric Biggers\n" @@ -4586,7 +4586,7 @@ usage_all(FILE *fp) print_usage_string(cmd, fp); tfprintf(fp, T("\n")); } - static const tchar *extra = + static const tchar * const extra = T( " %"TS" --help\n" " %"TS" --version\n" diff --git a/src/compress.c b/src/compress.c index 259e7a4c..1b0d2c9f 100644 --- a/src/compress.c +++ b/src/compress.c @@ -38,7 +38,7 @@ struct wimlib_compressor { size_t max_block_size; }; -static const struct compressor_ops *compressor_ops[] = { +static const struct compressor_ops * const compressor_ops[] = { [WIMLIB_COMPRESSION_TYPE_XPRESS] = &xpress_compressor_ops, [WIMLIB_COMPRESSION_TYPE_LZX] = &lzx_compressor_ops, [WIMLIB_COMPRESSION_TYPE_LZMS] = &lzms_compressor_ops, diff --git a/src/decompress.c b/src/decompress.c index d79865b8..f255ea92 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -36,7 +36,7 @@ struct wimlib_decompressor { void *private; }; -static const struct decompressor_ops *decompressor_ops[] = { +static const struct decompressor_ops * const decompressor_ops[] = { [WIMLIB_COMPRESSION_TYPE_XPRESS] = &xpress_decompressor_ops, [WIMLIB_COMPRESSION_TYPE_LZX] = &lzx_decompressor_ops, [WIMLIB_COMPRESSION_TYPE_LZMS] = &lzms_decompressor_ops, diff --git a/src/mount_image.c b/src/mount_image.c index 3641b204..ed9001c0 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -2036,7 +2036,7 @@ wimfs_write(const char *path, const char *buf, size_t size, return ret; } -static struct fuse_operations wimfs_operations = { +static const struct fuse_operations wimfs_operations = { .chmod = wimfs_chmod, .chown = wimfs_chown, .fgetattr = wimfs_fgetattr, diff --git a/src/resource.c b/src/resource.c index 9f119c47..9054b55e 100644 --- a/src/resource.c +++ b/src/resource.c @@ -639,7 +639,7 @@ noop_cb(const void *chunk, size_t size, void *_ctx) int skip_wim_resource(const struct wim_resource_descriptor *rdesc) { - struct consume_chunk_callback cb = { + static const struct consume_chunk_callback cb = { .func = noop_cb, }; return read_partial_wim_resource(rdesc, 0, @@ -1333,7 +1333,7 @@ extract_blob_to_fd(struct blob_descriptor *blob, struct filedes *fd) int sha1_blob(struct blob_descriptor *blob) { - struct read_blob_callbacks cbs = { + static const struct read_blob_callbacks cbs = { }; return read_blob_with_sha1(blob, &cbs); } diff --git a/src/win32_apply.c b/src/win32_apply.c index ada5b919..f971ca6f 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -2482,7 +2482,7 @@ set_system_compression(HANDLE h, int format) /* Hard-coded list of files which the Windows bootloader may need to access * before the WOF driver has been loaded. */ -static wchar_t *bootloader_pattern_strings[] = { +static const wchar_t * const bootloader_pattern_strings[] = { L"*winload.*", L"*winresume.*", L"\\Windows\\AppPatch\\drvmain.sdb", @@ -2514,7 +2514,7 @@ static wchar_t *bootloader_pattern_strings[] = { }; static const struct string_list bootloader_patterns = { - .strings = bootloader_pattern_strings, + .strings = (wchar_t **)bootloader_pattern_strings, .num_strings = ARRAY_LEN(bootloader_pattern_strings), }; -- 2.43.0