From 7bc9c0bb134bff125ff389d487241e505bd50ce3 Mon Sep 17 00:00:00 2001 From: John McNamara Date: Sun, 24 Sep 2023 20:40:07 +0100 Subject: [PATCH] Convert public char* to const char* for C++ compatibility. --- .github/workflows/cmake_actions.yml | 3 +- .github/workflows/make_actions.yml | 3 +- .github/workflows/make_cpp.yml | 32 ++++++++ .github/workflows/windows_build.yml | 2 +- .github/workflows/zig_build.yml | 2 +- Makefile | 4 + examples/autofilter.c | 2 +- examples/chart_data_labels.c | 2 +- examples/chart_styles.c | 2 +- examples/conditional_format1.c | 3 +- examples/conditional_format2.c | 3 +- examples/data_validate.c | 5 +- examples/dates_and_times04.c | 2 +- examples/format_num_format.c | 2 +- examples/output_buffer.c | 4 +- include/xlsxwriter/chart.h | 4 +- include/xlsxwriter/chartsheet.h | 6 +- include/xlsxwriter/packager.h | 8 +- include/xlsxwriter/styles.h | 2 +- include/xlsxwriter/utility.h | 4 +- include/xlsxwriter/workbook.h | 24 +++--- include/xlsxwriter/worksheet.h | 78 +++++++++---------- src/chart.c | 4 +- src/chartsheet.c | 4 +- src/packager.c | 19 ++--- src/styles.c | 2 +- src/utility.c | 4 +- src/workbook.c | 30 +++---- src/worksheet.c | 42 +++++----- test/functional/src/test_autofilter09.c | 2 +- test/functional/src/test_autofilter10.c | 2 +- test/functional/src/test_autofilter11.c | 2 +- test/functional/src/test_data_validation01.c | 2 +- test/functional/src/test_data_validation02.c | 2 +- test/functional/src/test_data_validation03.c | 4 +- test/functional/src/test_data_validation04.c | 4 +- test/functional/src/test_data_validation05.c | 4 +- test/functional/src/test_data_validation06.c | 4 +- test/functional/src/test_data_validation07.c | 2 +- test/functional/src/test_output_buffer01.c | 4 +- test/functional/src/test_properties01.c | 18 ++--- test/functional/src/test_properties02.c | 2 +- .../test_worksheet_write_auto_filter.c | 6 +- .../test_worksheet_write_data_validation1.c | 2 +- .../test_worksheet_write_data_validation2.c | 4 +- 45 files changed, 204 insertions(+), 162 deletions(-) create mode 100644 .github/workflows/make_cpp.yml diff --git a/.github/workflows/cmake_actions.yml b/.github/workflows/cmake_actions.yml index b5f5223d..6f4eea9e 100644 --- a/.github/workflows/cmake_actions.yml +++ b/.github/workflows/cmake_actions.yml @@ -1,4 +1,4 @@ -name: Build with CMake +name: Test CMake build on: [push, pull_request] @@ -7,6 +7,7 @@ jobs: name: Cmake strategy: + fail-fast: false matrix: cc: [gcc, clang] cmake_flags: ["", diff --git a/.github/workflows/make_actions.yml b/.github/workflows/make_actions.yml index 4348a23b..b40d7f29 100644 --- a/.github/workflows/make_actions.yml +++ b/.github/workflows/make_actions.yml @@ -1,4 +1,4 @@ -name: Build with Make +name: Test Make build on: [push, pull_request] @@ -7,6 +7,7 @@ jobs: name: Make strategy: + fail-fast: false matrix: cc: [gcc, clang] make_flags: ["", diff --git a/.github/workflows/make_cpp.yml b/.github/workflows/make_cpp.yml new file mode 100644 index 00000000..9344a8cf --- /dev/null +++ b/.github/workflows/make_cpp.yml @@ -0,0 +1,32 @@ +name: Test CPP build + +on: [push, pull_request] + +jobs: + build: + name: + Make + strategy: + fail-fast: false + matrix: + cc: [gcc, clang] + + runs-on: ubuntu-latest + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + CFLAGS: '-Werror -Wno-deprecated' + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt update + sudo apt-get -y install zlib1g-dev + + - name: make + run: | + make V=1 + make examples_cpp V=1 CC=${{ matrix.cxx }} + diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 271e23a7..98fe07f6 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -1,4 +1,4 @@ -name: Cmake on Windows +name: Test Cmake build on Windows on: [push, pull_request] diff --git a/.github/workflows/zig_build.yml b/.github/workflows/zig_build.yml index 32c908f2..c1bf4eb6 100644 --- a/.github/workflows/zig_build.yml +++ b/.github/workflows/zig_build.yml @@ -17,6 +17,6 @@ jobs: - uses: goto-bus-stop/setup-zig@v2 with: version: master - + - name: Build Summary run: zig build -DBUILD_TESTS -DBUILD_EXAMPLES -DUSE_SYSTEM_MINIZIP --summary all -freference-trace \ No newline at end of file diff --git a/Makefile b/Makefile index 0dacd568..c2d6b5e3 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,10 @@ universal_binary : examples : all $(Q)$(MAKE) -C examples +# Build the example programs with CPP for compatibility checking. +examples_cpp : all + $(Q)$(MAKE) -C examples CC=$(CXX) + # Clean src and test directories. clean : $(Q)$(MAKE) clean -C src diff --git a/examples/autofilter.c b/examples/autofilter.c index c507a744..98e65687 100644 --- a/examples/autofilter.c +++ b/examples/autofilter.c @@ -268,7 +268,7 @@ int main() { worksheet_autofilter(worksheet5, 0, 0, 50, 3); /* Add the filter criteria. */ - char* list[] = {"East", "North", "South", NULL}; + const char* list[] = {"East", "North", "South", NULL}; worksheet_filter_list(worksheet5, 0, list); diff --git a/examples/chart_data_labels.c b/examples/chart_data_labels.c index 1a9a563e..2095485f 100644 --- a/examples/chart_data_labels.c +++ b/examples/chart_data_labels.c @@ -263,7 +263,7 @@ int main() { * font for the custom items as an extra example. */ lxw_chart_data_label data_label7_1 = {.value = "=Sheet1!$C$2", .font = &font2}; - lxw_chart_data_label data_label7_2 = {0}; + lxw_chart_data_label data_label7_2 = {}; lxw_chart_data_label data_label7_3 = {.value = "=Sheet1!$C$4", .font = &font2}; lxw_chart_data_label data_label7_4 = {.value = "=Sheet1!$C$5", .font = &font2}; diff --git a/examples/chart_styles.c b/examples/chart_styles.c index 6b6c721d..98a77412 100644 --- a/examples/chart_styles.c +++ b/examples/chart_styles.c @@ -13,7 +13,7 @@ int main() { int chart_types[] = {LXW_CHART_COLUMN, LXW_CHART_AREA, LXW_CHART_LINE, LXW_CHART_PIE}; - char *chart_names[] = {"Column", "Area", "Line", "Pie"}; + const char *chart_names[] = {"Column", "Area", "Line", "Pie"}; char chart_title[32] = {0}; int row_num, col_num, chart_num, style_num; lxw_worksheet *worksheet; diff --git a/examples/conditional_format1.c b/examples/conditional_format1.c index 02447a97..5b9c5029 100644 --- a/examples/conditional_format1.c +++ b/examples/conditional_format1.c @@ -32,7 +32,8 @@ int main() { format_set_font_color(custom_format, LXW_COLOR_RED); /* Create a conditional format object. A static object would also work. */ - lxw_conditional_format *conditional_format = calloc(1, sizeof(lxw_conditional_format)); + lxw_conditional_format *conditional_format = + (lxw_conditional_format *)calloc(1, sizeof(lxw_conditional_format)); /* Set the format type: a cell conditional: */ conditional_format->type = LXW_CONDITIONAL_TYPE_CELL; diff --git a/examples/conditional_format2.c b/examples/conditional_format2.c index 71ca8fa7..d3c47f18 100644 --- a/examples/conditional_format2.c +++ b/examples/conditional_format2.c @@ -61,7 +61,8 @@ int main() { format_set_font_color(format2, 0x006100); /* Create a single conditional format object to reuse in the examples. */ - lxw_conditional_format *conditional_format = calloc(1, sizeof(lxw_conditional_format)); + lxw_conditional_format *conditional_format = + (lxw_conditional_format *)calloc(1, sizeof(lxw_conditional_format)); /* * Example 1. Conditional formatting based on simple cell based criteria. diff --git a/examples/data_validate.c b/examples/data_validate.c index 1b89fa48..6a269dab 100644 --- a/examples/data_validate.c +++ b/examples/data_validate.c @@ -47,7 +47,8 @@ int main() { lxw_workbook *workbook = workbook_new("data_validate1.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); + lxw_data_validation *data_validation = + (lxw_data_validation *)calloc(1, sizeof(lxw_data_validation)); /* Add a format to use to highlight the header cells. */ lxw_format *format = workbook_add_format(workbook); @@ -154,7 +155,7 @@ int main() { "Select a value from a drop down list", NULL); - char *list[] = {"open", "high", "close", NULL}; + const char *list[] = {"open", "high", "close", NULL}; data_validation->validate = LXW_VALIDATION_TYPE_LIST; data_validation->value_list = list; diff --git a/examples/dates_and_times04.c b/examples/dates_and_times04.c index b75a89dc..5a2a3f6d 100644 --- a/examples/dates_and_times04.c +++ b/examples/dates_and_times04.c @@ -18,7 +18,7 @@ int main() { /* Examples date and time formats. In the output file compare how changing * the format strings changes the appearance of the date. */ - char *date_formats[] = { + const char *date_formats[] = { "dd/mm/yy", "mm/dd/yy", "dd m yy", diff --git a/examples/format_num_format.c b/examples/format_num_format.c index b8fe135f..fa57eb82 100644 --- a/examples/format_num_format.c +++ b/examples/format_num_format.c @@ -62,7 +62,7 @@ int main() { /* Format a Zip code. */ format_set_num_format(format11, "00000"); worksheet_write_number(worksheet, 13, 0, 1209, format11); - + /* Close the workbook, save the file and free any memory. */ return workbook_close(workbook); } diff --git a/examples/output_buffer.c b/examples/output_buffer.c index 20850e8a..142196cc 100644 --- a/examples/output_buffer.c +++ b/examples/output_buffer.c @@ -10,7 +10,7 @@ #include "xlsxwriter.h" int main() { - char *output_buffer; + const char *output_buffer; size_t output_buffer_size; /* Set the worksheet options. */ @@ -36,7 +36,7 @@ int main() { FILE *file = fopen("output_buffer.xlsx", "wb"); fwrite(output_buffer, output_buffer_size, 1, file); fclose(file); - free(output_buffer); + free((void *)output_buffer); return ferror(stdout); } diff --git a/include/xlsxwriter/chart.h b/include/xlsxwriter/chart.h index 604014ec..3a900563 100644 --- a/include/xlsxwriter/chart.h +++ b/include/xlsxwriter/chart.h @@ -699,7 +699,7 @@ typedef struct lxw_chart_pattern { typedef struct lxw_chart_font { /** The chart font name, such as "Arial" or "Calibri". */ - char *name; + const char *name; /** The chart font size. The default is 11. */ double size; @@ -800,7 +800,7 @@ typedef struct lxw_chart_data_label { /** The string or formula value for the data label. See * @ref chart_custom_labels. */ - char *value; + const char *value; /** Option to hide/delete the data label from the chart series. * See @ref chart_custom_labels. */ diff --git a/include/xlsxwriter/chartsheet.h b/include/xlsxwriter/chartsheet.h index 2742235b..54062496 100644 --- a/include/xlsxwriter/chartsheet.h +++ b/include/xlsxwriter/chartsheet.h @@ -80,9 +80,9 @@ typedef struct lxw_chartsheet { struct lxw_protection_obj protection; uint8_t is_protected; - char *name; - char *quoted_name; - char *tmpdir; + const char *name; + const char *quoted_name; + const char *tmpdir; uint16_t index; uint8_t active; uint8_t selected; diff --git a/include/xlsxwriter/packager.h b/include/xlsxwriter/packager.h index 5990dbac..e5ba7939 100644 --- a/include/xlsxwriter/packager.h +++ b/include/xlsxwriter/packager.h @@ -67,10 +67,10 @@ typedef struct lxw_packager { size_t output_buffer_size; zipFile zipfile; zip_fileinfo zipfile_info; - char *filename; - char *buffer; + const char *filename; + const char *buffer; char *output_buffer; - char *tmpdir; + const char *tmpdir; uint8_t use_zip64; } lxw_packager; @@ -82,7 +82,7 @@ extern "C" { #endif /* *INDENT-ON* */ -lxw_packager *lxw_packager_new(const char *filename, char *tmpdir, +lxw_packager *lxw_packager_new(const char *filename, const char *tmpdir, uint8_t use_zip64); void lxw_packager_free(lxw_packager *packager); lxw_error lxw_create_package(lxw_packager *self); diff --git a/include/xlsxwriter/styles.h b/include/xlsxwriter/styles.h index a11d99db..780fdb64 100644 --- a/include/xlsxwriter/styles.h +++ b/include/xlsxwriter/styles.h @@ -44,7 +44,7 @@ extern "C" { lxw_styles *lxw_styles_new(void); void lxw_styles_free(lxw_styles *styles); void lxw_styles_assemble_xml_file(lxw_styles *self); -void lxw_styles_write_string_fragment(lxw_styles *self, char *string); +void lxw_styles_write_string_fragment(lxw_styles *self, const char *string); void lxw_styles_write_rich_font(lxw_styles *styles, lxw_format *format); /* Declarations required for unit testing. */ diff --git a/include/xlsxwriter/utility.h b/include/xlsxwriter/utility.h index 18c22318..3c770f50 100644 --- a/include/xlsxwriter/utility.h +++ b/include/xlsxwriter/utility.h @@ -232,8 +232,8 @@ void lxw_str_tolower(char *str); #define lxw_strcasecmp strcasecmp #endif -FILE *lxw_tmpfile(char *tmpdir); -FILE *lxw_get_filehandle(char **buf, size_t *size, char *tmpdir); +FILE *lxw_tmpfile(const char *tmpdir); +FILE *lxw_get_filehandle(char **buf, size_t *size, const char *tmpdir); FILE *lxw_fopen(const char *filename, const char *mode); /* Use the third party dtoa function to avoid locale issues with sprintf diff --git a/include/xlsxwriter/workbook.h b/include/xlsxwriter/workbook.h index f7840948..8988461e 100644 --- a/include/xlsxwriter/workbook.h +++ b/include/xlsxwriter/workbook.h @@ -182,34 +182,34 @@ typedef struct lxw_defined_name { */ typedef struct lxw_doc_properties { /** The title of the Excel Document. */ - char *title; + const char *title; /** The subject of the Excel Document. */ - char *subject; + const char *subject; /** The author of the Excel Document. */ - char *author; + const char *author; /** The manager field of the Excel Document. */ - char *manager; + const char *manager; /** The company field of the Excel Document. */ - char *company; + const char *company; /** The category of the Excel Document. */ - char *category; + const char *category; /** The keywords of the Excel Document. */ - char *keywords; + const char *keywords; /** The comment field of the Excel Document. */ - char *comments; + const char *comments; /** The status of the Excel Document. */ - char *status; + const char *status; /** The hyperlink base URL of the Excel Document. */ - char *hyperlink_base; + const char *hyperlink_base; /** The file creation date/time shown in Excel. This defaults to the * current time and date if set to 0. If you wish to create files that are @@ -270,13 +270,13 @@ typedef struct lxw_workbook_options { uint8_t constant_memory; /** Directory to use for the temporary files created by libxlsxwriter. */ - char *tmpdir; + const char *tmpdir; /** Allow ZIP64 extensions when creating the xlsx file zip container. */ uint8_t use_zip64; /** Output buffer to use instead of writing to a file */ - char **output_buffer; + const char **output_buffer; /** Used with output_buffer to get the size of the created buffer */ size_t *output_buffer_size; diff --git a/include/xlsxwriter/worksheet.h b/include/xlsxwriter/worksheet.h index 85d17f07..82acb470 100644 --- a/include/xlsxwriter/worksheet.h +++ b/include/xlsxwriter/worksheet.h @@ -979,7 +979,7 @@ typedef struct lxw_data_validation { * is applied using a cell reference. It is valid for any of the * `_FORMULA` validation types. */ - char *value_formula; + const char *value_formula; /** * This parameter is used to set a list of strings for a drop down list. @@ -998,7 +998,7 @@ typedef struct lxw_data_validation { * Note, the string list is restricted by Excel to 255 characters, * including comma separators. */ - char **value_list; + const char **value_list; /** * This parameter is used to set the limiting value to which the date or @@ -1016,7 +1016,7 @@ typedef struct lxw_data_validation { * This parameter is the same as `value_formula` but for the minimum value * when a `BETWEEN` criteria is used. */ - char *minimum_formula; + const char *minimum_formula; /** * This parameter is the same as `value_datetime` but for the minimum value @@ -1034,7 +1034,7 @@ typedef struct lxw_data_validation { * This parameter is the same as `value_formula` but for the maximum value * when a `BETWEEN` criteria is used. */ - char *maximum_formula; + const char *maximum_formula; /** * This parameter is the same as `value_datetime` but for the maximum value @@ -1050,7 +1050,7 @@ typedef struct lxw_data_validation { * * The maximum title length is 32 characters. */ - char *input_title; + const char *input_title; /** * The input_message parameter is used to set the input message that is @@ -1059,7 +1059,7 @@ typedef struct lxw_data_validation { * The message can be split over several lines using newlines. The maximum * message length is 255 characters. */ - char *input_message; + const char *input_message; /** * The error_title parameter is used to set the title of the error message @@ -1067,7 +1067,7 @@ typedef struct lxw_data_validation { * default error title is 'Microsoft Excel'. The maximum title length is * 32 characters. */ - char *error_title; + const char *error_title; /** * The error_message parameter is used to set the error message that is @@ -1078,7 +1078,7 @@ typedef struct lxw_data_validation { * The message can be split over several lines using newlines. The maximum * message length is 255 characters. */ - char *error_message; + const char *error_message; } lxw_data_validation; @@ -1142,7 +1142,7 @@ typedef struct lxw_conditional_format { * value_string exists in the struct then the number value is * ignored. Note, if the condition refers to a text string then it must * be double quoted like this `"foo"`. */ - char *value_string; + const char *value_string; /** The format field is used to specify the #lxw_format format that will * be applied to the cell when the conditional formatting criterion is @@ -1163,7 +1163,7 @@ typedef struct lxw_conditional_format { /** The minimum string value used for Cell, Color Scale and Data Bar conditional * formats. Usually used to set ranges like `=A1`. */ - char *min_value_string; + const char *min_value_string; /** The rule used for the minimum condition in Color Scale and Data Bar * conditional formats. The rule types are defined in @@ -1180,7 +1180,7 @@ typedef struct lxw_conditional_format { /** The middle string value used for Color Scale and Data Bar conditional * formats. Usually used to set ranges like `=A1`. */ - char *mid_value_string; + const char *mid_value_string; /** The rule used for the middle condition in Color Scale and Data Bar * conditional formats. The rule types are defined in @@ -1198,7 +1198,7 @@ typedef struct lxw_conditional_format { /** The maximum string value used for Cell, Color Scale and Data Bar conditional * formats. Usually used to set ranges like `=A1`. */ - char *max_value_string; + const char *max_value_string; /** The rule used for the maximum condition in Color Scale and Data Bar * conditional formats. The rule types are defined in @@ -1304,7 +1304,7 @@ typedef struct lxw_conditional_format { * conditional format and any others separated by spaces. For example * `"A1 C1:C5 E2 G1:G100"`. */ - char *multi_range; + const char *multi_range; /** The stop_if_true parameter can be used to set the "stop if true" * feature of a conditional formatting rule when more than one rule is @@ -1389,13 +1389,13 @@ typedef struct lxw_table_column { /** Set the header name/caption for the column. If NULL the header defaults * to Column 1, Column 2, etc. */ - char *header; + const char *header; /** Set the formula for the column. */ - char *formula; + const char *formula; /** Set the string description for the column total. */ - char *total_string; + const char *total_string; /** Set the function for the column total. */ uint8_t total_function; @@ -1437,7 +1437,7 @@ typedef struct lxw_table_options { * [Naming an Excel Table] * (https://support.microsoft.com/en-us/office/rename-an-excel-table-fbf49a4f-82a3-43eb-8ba2-44d21233b114). */ - char *name; + const char *name; /** * The `no_header_row` parameter can be used to turn off the header row in @@ -1666,7 +1666,7 @@ typedef struct lxw_filter_rule { uint8_t criteria; /** String value to which the criteria applies. */ - char *value_string; + const char *value_string; /** Numeric value to which the criteria applies (if value_string isn't used). */ double value; @@ -1720,7 +1720,7 @@ typedef struct lxw_image_options { * used to provide a text description of the image to help * accessibility. Defaults to the image filename as in Excel. Set to "" * to ignore the description field. */ - char *description; + const char *description; /** Optional parameter to help accessibility. It is used to mark the image * as decorative, and thus uninformative, for automated screen @@ -1730,10 +1730,10 @@ typedef struct lxw_image_options { /** Add an optional hyperlink to the image. Follows the same URL rules * and types as `worksheet_write_url()`. */ - char *url; + const char *url; /** Add an optional mouseover tip for a hyperlink to the image. */ - char *tip; + const char *tip; } lxw_image_options; @@ -1765,7 +1765,7 @@ typedef struct lxw_chart_options { * used to provide a text description of the chart to help * accessibility. Defaults to the image filename as in Excel. Set to NULL * to ignore the description field. */ - char *description; + const char *description; /** Optional parameter to help accessibility. It is used to mark the chart * as decorative, and thus uninformative, for automated screen @@ -1832,7 +1832,7 @@ typedef struct lxw_comment_options { * worksheet. The default author for all cell comments in a worksheet can * be set using the `worksheet_set_comments_author()` function. Set to * NULL if not required. See also @ref ww_comments_author. */ - char *author; + const char *author; /** This option is used to set the width of the cell comment box * explicitly in pixels. The default width is 128 pixels. See also @ref @@ -1859,7 +1859,7 @@ typedef struct lxw_comment_options { /** This option is used to set the font for the comment. The default font * is 'Tahoma'. See also @ref ww_comments_font_name. */ - char *font_name; + const char *font_name; /** This option is used to set the font size for the comment. The default * is 8. See also @ref ww_comments_font_size. */ @@ -1902,16 +1902,16 @@ typedef struct lxw_button_options { /** Sets the caption on the button. The default is "Button n" where n is * the current number of buttons in the worksheet, including this * button. */ - char *caption; + const char *caption; /** Name of the macro to run when the button is pressed. The macro must be * included with workbook_add_vba_project(). */ - char *macro; + const char *macro; /** Optional description or "Alt text" for the button. This field can be * used to provide a text description of the button to help * accessibility. Set to NULL to ignore the description field. */ - char *description; + const char *description; /** This option is used to set the width of the cell button box * explicitly in pixels. The default width is 64 pixels. */ @@ -1983,17 +1983,17 @@ typedef struct lxw_header_footer_options { /** The left header image filename, with path if required. This should * have a corresponding `&G/&[Picture]` placeholder in the `&L` section of * the header/footer string. See `worksheet_set_header_opt()`. */ - char *image_left; + const char *image_left; /** The center header image filename, with path if required. This should * have a corresponding `&G/&[Picture]` placeholder in the `&C` section of * the header/footer string. See `worksheet_set_header_opt()`. */ - char *image_center; + const char *image_center; /** The right header image filename, with path if required. This should * have a corresponding `&G/&[Picture]` placeholder in the `&R` section of * the header/footer string. See `worksheet_set_header_opt()`. */ - char *image_right; + const char *image_right; } lxw_header_footer_options; @@ -2094,7 +2094,7 @@ typedef struct lxw_rich_string_tuple { lxw_format *format; /** The string fragment. */ - char *string; + const char *string; } lxw_rich_string_tuple; /** @@ -2134,9 +2134,9 @@ typedef struct lxw_worksheet { lxw_col_t dim_colmax; lxw_sst *sst; - char *name; - char *quoted_name; - char *tmpdir; + const char *name; + const char *quoted_name; + const char *tmpdir; uint16_t index; uint8_t active; @@ -2303,9 +2303,9 @@ typedef struct lxw_worksheet_init_data { uint16_t *active_sheet; uint16_t *first_sheet; lxw_sst *sst; - char *name; - char *quoted_name; - char *tmpdir; + const char *name; + const char *quoted_name; + const char *tmpdir; lxw_format *default_url_format; uint16_t max_url_length; @@ -2340,7 +2340,7 @@ typedef struct lxw_cell { union { double number; int32_t string_id; - char *string; + const char *string; } u; double formula_result; @@ -4149,7 +4149,7 @@ lxw_error worksheet_filter_column2(lxw_worksheet *worksheet, lxw_col_t col, * ww_autofilters_data for more details. */ lxw_error worksheet_filter_list(lxw_worksheet *worksheet, lxw_col_t col, - char **list); + const char **list); /** * @brief Add a data validation to a cell. diff --git a/src/chart.c b/src/chart.c index 4dec6f8f..a199dae5 100644 --- a/src/chart.c +++ b/src/chart.c @@ -78,7 +78,7 @@ _chart_free_font(lxw_chart_font *font) if (!font) return; - free(font->name); + free((void *) font->name); free(font); } @@ -5596,7 +5596,7 @@ chart_series_set_labels_custom(lxw_chart_series *series, for (i = 0; i < data_label_count; i++) { lxw_chart_data_label *user_label = data_labels[i]; lxw_chart_custom_label *data_label = &series->data_labels[i]; - char *src_value = user_label->value; + const char *src_value = user_label->value; data_label->hide = user_label->hide; data_label->font = _chart_convert_font_args(user_label->font); diff --git a/src/chartsheet.c b/src/chartsheet.c index 8bfcf3eb..b6c67259 100644 --- a/src/chartsheet.c +++ b/src/chartsheet.c @@ -66,8 +66,8 @@ lxw_chartsheet_free(lxw_chartsheet *chartsheet) return; lxw_worksheet_free(chartsheet->worksheet); - free(chartsheet->name); - free(chartsheet->quoted_name); + free((void *) chartsheet->name); + free((void *) chartsheet->quoted_name); free(chartsheet); } diff --git a/src/packager.c b/src/packager.c index 51f37c83..d5d2a1ba 100644 --- a/src/packager.c +++ b/src/packager.c @@ -52,7 +52,7 @@ STATIC lxw_error _add_file_to_zip(lxw_packager *self, FILE * file, const char *filename); -STATIC lxw_error _add_buffer_to_zip(lxw_packager *self, char *buffer, +STATIC lxw_error _add_buffer_to_zip(lxw_packager *self, const char *buffer, size_t buffer_size, const char *filename); STATIC lxw_error _add_to_zip(lxw_packager *self, FILE * file, @@ -153,7 +153,7 @@ _fclose_memstream(voidpf opaque, voidpf stream) GOTO_LABEL_ON_MEM_ERROR(packager->output_buffer, mem_error); rewind(file); - if (fread(packager->output_buffer, size, 1, file) < 1) + if (fread((void *) packager->output_buffer, size, 1, file) < 1) goto mem_error; packager->output_buffer_size = size; @@ -170,7 +170,7 @@ _fclose_memstream(voidpf opaque, voidpf stream) * Create a new packager object. */ lxw_packager * -lxw_packager_new(const char *filename, char *tmpdir, uint8_t use_zip64) +lxw_packager_new(const char *filename, const char *tmpdir, uint8_t use_zip64) { zlib_filefunc_def filefunc; lxw_packager *packager = calloc(1, sizeof(lxw_packager)); @@ -239,8 +239,8 @@ lxw_packager_free(lxw_packager *packager) if (!packager) return; - free(packager->buffer); - free(packager->filename); + free((void *) packager->buffer); + free((void *) packager->filename); free(packager); } @@ -1792,7 +1792,7 @@ _add_file_to_zip(lxw_packager *self, FILE * file, const char *filename) fflush(file); rewind(file); - size_read = fread(self->buffer, 1, self->buffer_size, file); + size_read = fread((void *) self->buffer, 1, self->buffer_size, file); while (size_read) { @@ -1811,7 +1811,8 @@ _add_file_to_zip(lxw_packager *self, FILE * file, const char *filename) RETURN_ON_ZIP_ERROR(error, LXW_ERROR_ZIP_FILE_ADD); } - size_read = fread(self->buffer, 1, self->buffer_size, file); + size_read = + fread((void *) (void *) self->buffer, 1, self->buffer_size, file); } error = zipCloseFileInZip(self->zipfile); @@ -1824,7 +1825,7 @@ _add_file_to_zip(lxw_packager *self, FILE * file, const char *filename) } STATIC lxw_error -_add_buffer_to_zip(lxw_packager *self, char *buffer, size_t buffer_size, +_add_buffer_to_zip(lxw_packager *self, const char *buffer, size_t buffer_size, const char *filename) { int16_t error = ZIP_OK; @@ -1872,7 +1873,7 @@ _add_to_zip(lxw_packager *self, FILE * file, char **buffer, } /* - * Write the xml files that make up the XLXS OPC package. + * Write the xml files that make up the XLSX OPC package. */ lxw_error lxw_create_package(lxw_packager *self) diff --git a/src/styles.c b/src/styles.c index 7f76b34a..d2cb71e5 100644 --- a/src/styles.c +++ b/src/styles.c @@ -85,7 +85,7 @@ lxw_styles_free(lxw_styles *styles) * Write the element for rich strings. */ void -lxw_styles_write_string_fragment(lxw_styles *self, char *string) +lxw_styles_write_string_fragment(lxw_styles *self, const char *string) { struct xml_attribute_list attributes; struct xml_attribute *attribute; diff --git a/src/utility.c b/src/utility.c index d59157f2..a16f2aa2 100644 --- a/src/utility.c +++ b/src/utility.c @@ -572,7 +572,7 @@ lxw_quote_sheetname(const char *str) * version if required for safety or portability. */ FILE * -lxw_tmpfile(char *tmpdir) +lxw_tmpfile(const char *tmpdir) { #ifndef USE_STANDARD_TMPFILE return tmpfileplus(tmpdir, NULL, NULL, 0); @@ -586,7 +586,7 @@ lxw_tmpfile(char *tmpdir) * Return a memory-backed file if supported, otherwise a temporary one */ FILE * -lxw_get_filehandle(char **buf, size_t *size, char *tmpdir) +lxw_get_filehandle(char **buf, size_t *size, const char *tmpdir) { static size_t s; if (!size) diff --git a/src/workbook.c b/src/workbook.c index a2d6cdbd..ddc7f700 100644 --- a/src/workbook.c +++ b/src/workbook.c @@ -66,16 +66,16 @@ STATIC void _free_doc_properties(lxw_doc_properties *properties) { if (properties) { - free(properties->title); - free(properties->subject); - free(properties->author); - free(properties->manager); - free(properties->company); - free(properties->category); - free(properties->keywords); - free(properties->comments); - free(properties->status); - free(properties->hyperlink_base); + free((void *) properties->title); + free((void *) properties->subject); + free((void *) properties->author); + free((void *) properties->manager); + free((void *) properties->company); + free((void *) properties->category); + free((void *) properties->keywords); + free((void *) properties->comments); + free((void *) properties->status); + free((void *) properties->hyperlink_base); } free(properties); @@ -261,7 +261,7 @@ lxw_workbook_free(lxw_workbook *workbook) lxw_hash_free(workbook->used_xf_formats); lxw_hash_free(workbook->used_dxf_formats); lxw_sst_free(workbook->sst); - free(workbook->options.tmpdir); + free((void *) workbook->options.tmpdir); free(workbook->ordered_charts); free(workbook->vba_project); free(workbook->vba_project_signature); @@ -1972,8 +1972,8 @@ workbook_add_worksheet(lxw_workbook *self, const char *sheetname) return worksheet; mem_error: - free(init_data.name); - free(init_data.quoted_name); + free((void *) init_data.name); + free((void *) init_data.quoted_name); free(worksheet_name); free(worksheet); return NULL; @@ -2056,8 +2056,8 @@ workbook_add_chartsheet(lxw_workbook *self, const char *sheetname) return chartsheet; mem_error: - free(init_data.name); - free(init_data.quoted_name); + free((void *) init_data.name); + free((void *) init_data.quoted_name); free(chartsheet_name); free(chartsheet); return NULL; diff --git a/src/worksheet.c b/src/worksheet.c index f6e63e46..a38cd79d 100644 --- a/src/worksheet.c +++ b/src/worksheet.c @@ -369,7 +369,7 @@ _free_cell(lxw_cell *cell) if (cell->type != NUMBER_CELL && cell->type != STRING_CELL && cell->type != BLANK_CELL && cell->type != BOOLEAN_CELL) { - free(cell->u.string); + free((void *) cell->u.string); } free(cell->user_data1); @@ -486,9 +486,9 @@ _free_worksheet_table_column(lxw_table_column *column) if (!column) return; - free(column->header); - free(column->formula); - free(column->total_string); + free((void *) column->header); + free((void *) column->formula); + free((void *) column->total_string); free(column); } @@ -785,8 +785,8 @@ lxw_worksheet_free(lxw_worksheet *worksheet) free(worksheet->hbreaks); free(worksheet->vbreaks); - free(worksheet->name); - free(worksheet->quoted_name); + free((void *) worksheet->name); + free((void *) worksheet->quoted_name); free(worksheet->vba_codename); free(worksheet->vml_data_id_str); free(worksheet->vml_header_id_str); @@ -896,7 +896,7 @@ _new_inline_string_cell(lxw_row_t row_num, */ STATIC lxw_cell * _new_inline_rich_string_cell(lxw_row_t row_num, - lxw_col_t col_num, char *string, + lxw_col_t col_num, const char *string, lxw_format *format) { lxw_cell *cell = calloc(1, sizeof(lxw_cell)); @@ -1452,7 +1452,7 @@ lxw_basename(const char *path) /* Function to count the total concatenated length of the strings in a * validation list array, including commas. */ size_t -_validation_list_length(char **list) +_validation_list_length(const char **list) { uint8_t i = 0; size_t length = 0; @@ -1475,7 +1475,7 @@ _validation_list_length(char **list) /* Function to convert an array of strings into a CSV string for data * validation lists. */ char * -_validation_list_to_csv(char **list) +_validation_list_to_csv(const char **list) { uint8_t i = 0; char *str; @@ -1670,10 +1670,10 @@ _set_default_table_columns(lxw_table_obj *table_obj) * "[#This Row]" in table formulas. This is the format that Excel uses to * store the references. */ char * -_expand_table_formula(char *formula) +_expand_table_formula(const char *formula) { char *expanded; - char *ptr; + const char *ptr; size_t i; size_t ref_count = 0; size_t expanded_len; @@ -1753,7 +1753,7 @@ _set_custom_table_columns(lxw_table_obj *table_obj, RETURN_ON_MEM_ERROR(str, LXW_ERROR_MEMORY_MALLOC_FAILED); /* Free the default column header. */ - free(table_column->header); + free((void *) table_column->header); table_column->header = str; } @@ -4446,7 +4446,7 @@ STATIC void _write_inline_rich_string_cell(lxw_worksheet *self, char *range, int32_t style_index, lxw_cell *cell) { - char *string = cell->u.string; + const char *string = cell->u.string; if (style_index) fprintf(self->file, @@ -4743,7 +4743,7 @@ lxw_worksheet_write_single_row(lxw_worksheet *self) /* Process a header/footer image and store it in the correct slot. */ lxw_error -_worksheet_set_header_footer_image(lxw_worksheet *self, char *filename, +_worksheet_set_header_footer_image(lxw_worksheet *self, const char *filename, uint8_t image_position) { FILE *image_stream; @@ -8422,7 +8422,7 @@ worksheet_write_rich_string(lxw_worksheet *self, uint8_t i; long file_size; char *rich_string = NULL; - char *string_copy = NULL; + const char *string_copy = NULL; lxw_styles *styles = NULL; lxw_format *default_format = NULL; lxw_rich_string_tuple *rich_string_tuple = NULL; @@ -8499,9 +8499,9 @@ worksheet_write_rich_string(lxw_worksheet *self, /* Rewind the file and read the data into the memory buffer. */ rewind(tmpfile); - if (fread(rich_string, file_size, 1, tmpfile) < 1) { + if (fread((void *) rich_string, file_size, 1, tmpfile) < 1) { fclose(tmpfile); - free(rich_string); + free((void *) rich_string); return LXW_ERROR_READING_TMPFILE; } } @@ -8510,14 +8510,14 @@ worksheet_write_rich_string(lxw_worksheet *self, fclose(tmpfile); if (lxw_utf8_strlen(rich_string) > LXW_STR_MAX) { - free(rich_string); + free((void *) rich_string); return LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED; } if (!self->optimize) { /* Get the SST element and string id. */ sst_element = lxw_get_sst_index(self->sst, rich_string, LXW_TRUE); - free(rich_string); + free((void *) rich_string); if (!sst_element) return LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND; @@ -8530,7 +8530,7 @@ worksheet_write_rich_string(lxw_worksheet *self, /* Look for and escape control chars in the string. */ if (lxw_has_control_characters(rich_string)) { string_copy = lxw_escape_control_characters(rich_string); - free(rich_string); + free((void *) rich_string); } else { string_copy = rich_string; @@ -9152,7 +9152,7 @@ worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col, * Set two autofilter rules for a filter column. */ lxw_error -worksheet_filter_list(lxw_worksheet *self, lxw_col_t col, char **list) +worksheet_filter_list(lxw_worksheet *self, lxw_col_t col, const char **list) { lxw_filter_rule_obj *rule_obj; uint16_t rule_index; diff --git a/test/functional/src/test_autofilter09.c b/test/functional/src/test_autofilter09.c index a10fcb39..a225dae0 100644 --- a/test/functional/src/test_autofilter09.c +++ b/test/functional/src/test_autofilter09.c @@ -106,7 +106,7 @@ int main() { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"East", "North", "South", NULL}; + const char* list[] = {"East", "North", "South", NULL}; worksheet_filter_list(worksheet, 0, list); diff --git a/test/functional/src/test_autofilter10.c b/test/functional/src/test_autofilter10.c index a5aa4644..6811747d 100644 --- a/test/functional/src/test_autofilter10.c +++ b/test/functional/src/test_autofilter10.c @@ -107,7 +107,7 @@ int main() { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"East", "North", "South", "Blanks", NULL}; + const char* list[] = {"East", "North", "South", "Blanks", NULL}; worksheet_filter_list(worksheet, 0, list); diff --git a/test/functional/src/test_autofilter11.c b/test/functional/src/test_autofilter11.c index cc3fa956..82b023ed 100644 --- a/test/functional/src/test_autofilter11.c +++ b/test/functional/src/test_autofilter11.c @@ -108,7 +108,7 @@ int main() { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"3000", "5000", "8000", NULL}; + const char* list[] = {"3000", "5000", "8000", NULL}; worksheet_filter_list(worksheet, 2, list); diff --git a/test/functional/src/test_data_validation01.c b/test/functional/src/test_data_validation01.c index 1d288c03..274050a2 100644 --- a/test/functional/src/test_data_validation01.c +++ b/test/functional/src/test_data_validation01.c @@ -13,7 +13,7 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation01.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list[] = {"Foo", "Bar", "Baz", NULL}; + const char* list[] = {"Foo", "Bar", "Baz", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST; diff --git a/test/functional/src/test_data_validation02.c b/test/functional/src/test_data_validation02.c index 9b576395..19a9e57d 100644 --- a/test/functional/src/test_data_validation02.c +++ b/test/functional/src/test_data_validation02.c @@ -13,7 +13,7 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation02.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list[] = {"Foo", "Bar", "Baz", NULL}; + const char* list[] = {"Foo", "Bar", "Baz", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST; diff --git a/test/functional/src/test_data_validation03.c b/test/functional/src/test_data_validation03.c index 28f2fbfa..ef75a2ca 100644 --- a/test/functional/src/test_data_validation03.c +++ b/test/functional/src/test_data_validation03.c @@ -13,8 +13,8 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation03.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list1[] = {"Foo", "Bar", "Baz", NULL}; - char *list2[] = { + const char *list1[] = {"Foo", "Bar", "Baz", NULL}; + const char *list2[] = { "Foobar", "Foobas", "Foobat", "Foobau", "Foobav", "Foobaw", "Foobax", "Foobay", "Foobaz", "Foobba", "Foobbb", "Foobbc", "Foobbd", "Foobbe", "Foobbf", "Foobbg", "Foobbh", "Foobbi", "Foobbj", "Foobbk", "Foobbl", diff --git a/test/functional/src/test_data_validation04.c b/test/functional/src/test_data_validation04.c index aeffa4b4..794fecc1 100644 --- a/test/functional/src/test_data_validation04.c +++ b/test/functional/src/test_data_validation04.c @@ -13,8 +13,8 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation04.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list1[] = {"Foo", "Bar", "Baz", NULL}; - char *list2[] = { + const char *list1[] = {"Foo", "Bar", "Baz", NULL}; + const char *list2[] = { "Foobar", "Foobas", "Foobat", "Foobau", "Foobav", "Foobaw", "Foobax", "Foobay", "Foobaz", "Foobba", "Foobbb", "Foobbc", "Foobbd", "Foobbe", "Foobbf", "Foobbg", "Foobbh", "Foobbi", "Foobbj", "Foobbk", "Foobbl", diff --git a/test/functional/src/test_data_validation05.c b/test/functional/src/test_data_validation05.c index 622f6717..92a3d93f 100644 --- a/test/functional/src/test_data_validation05.c +++ b/test/functional/src/test_data_validation05.c @@ -13,8 +13,8 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation05.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list1[] = {"Foo", "Bar", "Baz", NULL}; - char *list2[] = { + const char *list1[] = {"Foo", "Bar", "Baz", NULL}; + const char *list2[] = { "Foobar", "Foobas", "Foobat", "Foobau", "Foobav", "Foobaw", "Foobax", "Foobay", "Foobaz", "Foobba", "Foobbb", "Foobbc", "Foobbd", "Foobbe", "Foobbf", "Foobbg", "Foobbh", "Foobbi", "Foobbj", "Foobbk", "Foobbl", diff --git a/test/functional/src/test_data_validation06.c b/test/functional/src/test_data_validation06.c index 3a07fd07..8be4c7f6 100644 --- a/test/functional/src/test_data_validation06.c +++ b/test/functional/src/test_data_validation06.c @@ -13,8 +13,8 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation06.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list1[] = {"Foo", "Bar", "Baz", NULL}; - char *list2[] = { + const char *list1[] = {"Foo", "Bar", "Baz", NULL}; + const char *list2[] = { "Foobar", "Foobas", "Foobat", "Foobau", "Foobav", "Foobaw", "Foobax", "Foobay", "Foobaz", "Foobba", "Foobbb", "Foobbc", "Foobbd", "Foobbe", "Foobbf", "Foobbg", "Foobbh", "Foobbi", "Foobbj", "Foobbk", "Foobbl", diff --git a/test/functional/src/test_data_validation07.c b/test/functional/src/test_data_validation07.c index 0f9a36c3..24db9103 100644 --- a/test/functional/src/test_data_validation07.c +++ b/test/functional/src/test_data_validation07.c @@ -13,7 +13,7 @@ int main() { lxw_workbook *workbook = workbook_new("test_data_validation07.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); - char *list[] = {"coffee", "café", NULL}; + const char* list[] = {"coffee", "café", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST; diff --git a/test/functional/src/test_output_buffer01.c b/test/functional/src/test_output_buffer01.c index 08e226f2..ddd62357 100644 --- a/test/functional/src/test_output_buffer01.c +++ b/test/functional/src/test_output_buffer01.c @@ -10,7 +10,7 @@ #include "xlsxwriter.h" int main() { - char *output_buffer; + const char *output_buffer; size_t output_buffer_size; lxw_workbook_options options = {LXW_FALSE, ".", @@ -31,7 +31,7 @@ int main() { FILE *file = fopen("test_output_buffer01.xlsx", "wb"); fwrite(output_buffer, output_buffer_size, 1, file); fclose(file); - free(output_buffer); + free((void *)output_buffer); return 0; } diff --git a/test/functional/src/test_properties01.c b/test/functional/src/test_properties01.c index ddd94bff..07c47f4f 100644 --- a/test/functional/src/test_properties01.c +++ b/test/functional/src/test_properties01.c @@ -33,15 +33,15 @@ int main() { worksheet_set_column(worksheet, 0, 0, 70, NULL); worksheet_write_string(worksheet, CELL("A1"), "Select 'Office Button -> Prepare -> Properties' to see the file properties." , NULL); - free(properties->title); - free(properties->subject); - free(properties->author); - free(properties->manager); - free(properties->company); - free(properties->category); - free(properties->keywords); - free(properties->comments); - free(properties->status); + free((void *)properties->title); + free((void *)properties->subject); + free((void *)properties->author); + free((void *)properties->manager); + free((void *)properties->company); + free((void *)properties->category); + free((void *)properties->keywords); + free((void *)properties->comments); + free((void *)properties->status); free(properties); return workbook_close(workbook); diff --git a/test/functional/src/test_properties02.c b/test/functional/src/test_properties02.c index 34622e7e..f83aff15 100644 --- a/test/functional/src/test_properties02.c +++ b/test/functional/src/test_properties02.c @@ -21,7 +21,7 @@ int main() { (void)worksheet; - free(properties->hyperlink_base); + free((void *)properties->hyperlink_base); free(properties); return workbook_close(workbook); diff --git a/test/unit/worksheet/test_worksheet_write_auto_filter.c b/test/unit/worksheet/test_worksheet_write_auto_filter.c index 91da5000..95f557c1 100644 --- a/test/unit/worksheet/test_worksheet_write_auto_filter.c +++ b/test/unit/worksheet/test_worksheet_write_auto_filter.c @@ -458,7 +458,7 @@ CTEST(worksheet, write_write_auto_filter19) { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"East", NULL}; + const char* list[] = {"East", NULL}; worksheet_filter_list(worksheet, 0, list); @@ -481,7 +481,7 @@ CTEST(worksheet, write_write_auto_filter20) { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"East", "North", NULL}; + const char* list[] = {"East", "North", NULL}; worksheet_filter_list(worksheet, 0, list); @@ -504,7 +504,7 @@ CTEST(worksheet, write_write_auto_filter21) { worksheet_autofilter(worksheet, 0, 0, 50, 3); - char* list[] = {"February", "January", "July", "June", NULL}; + const char* list[] = {"February", "January", "July", "June", NULL}; worksheet_filter_list(worksheet, 3, list); diff --git a/test/unit/worksheet/test_worksheet_write_data_validation1.c b/test/unit/worksheet/test_worksheet_write_data_validation1.c index f5efb118..b07ba2ca 100644 --- a/test/unit/worksheet/test_worksheet_write_data_validation1.c +++ b/test/unit/worksheet/test_worksheet_write_data_validation1.c @@ -128,7 +128,7 @@ CTEST(worksheet, write_data_validations04) { char* got; char exp[] = "\"open,high,close\""; FILE* testfile = lxw_tmpfile(NULL); - char *list[] = {"open", "high", "close", NULL}; + const char* list[] = {"open", "high", "close", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST; diff --git a/test/unit/worksheet/test_worksheet_write_data_validation2.c b/test/unit/worksheet/test_worksheet_write_data_validation2.c index 0b63f72f..f16448f7 100644 --- a/test/unit/worksheet/test_worksheet_write_data_validation2.c +++ b/test/unit/worksheet/test_worksheet_write_data_validation2.c @@ -486,7 +486,7 @@ CTEST(worksheet, test_write_data_validations_220) { char* got; char exp[] = "\"a,bb,ccc\""; FILE* testfile = lxw_tmpfile(NULL); - char *list[] = {"a", "bb", "ccc", NULL}; + const char* list[] = {"a", "bb", "ccc", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST; @@ -509,7 +509,7 @@ CTEST(worksheet, test_write_data_validations_221) { char* got; char exp[] = "\"a,bb,ccc\""; FILE* testfile = lxw_tmpfile(NULL); - char *list[] = {"a", "bb", "ccc", NULL}; + const char* list[] = {"a", "bb", "ccc", NULL}; lxw_data_validation *data_validation = calloc(1, sizeof(lxw_data_validation)); data_validation->validate = LXW_VALIDATION_TYPE_LIST;