From b66c9bc95e5704dd67868cdfee7900bd1d48ea9c Mon Sep 17 00:00:00 2001 From: John McNamara Date: Mon, 9 Aug 2021 19:04:50 +0100 Subject: [PATCH] Replace use of c++ reserved word operator. Issue #353 --- include/xlsxwriter/worksheet.h | 7 +++---- src/worksheet.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/xlsxwriter/worksheet.h b/include/xlsxwriter/worksheet.h index 3b034589..347857bb 100644 --- a/include/xlsxwriter/worksheet.h +++ b/include/xlsxwriter/worksheet.h @@ -3688,7 +3688,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col, * @param col The column in the autofilter that the rules applies to. * @param rule1 First lxw_filter_rule autofilter rule. * @param rule2 Second lxw_filter_rule autofilter rule. - * @param operator A #lxw_filter_operator and/or operator. + * @param and_or A #lxw_filter_operator and/or operator. * * @return A #lxw_error code. * @@ -3713,8 +3713,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col, * The `col` parameter is a zero indexed column number and must refer to a * column in an existing autofilter created with `worksheet_autofilter()`. * - * The `operator` parameter is either "and (LXW_FILTER_AND)" or "or - * (LXW_FILTER_OR)". + * The `and_or` parameter is either "and (LXW_FILTER_AND)" or "or (LXW_FILTER_OR)". * * It isn't sufficient to just specify the filter condition. You must also * hide any rows that don't match the filter condition. See @ref @@ -3722,7 +3721,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col, */ lxw_error worksheet_filter_column2(lxw_worksheet *worksheet, lxw_col_t col, lxw_filter_rule *rule1, - lxw_filter_rule *rule2, uint8_t operator); + lxw_filter_rule *rule2, uint8_t and_or); /** * @brief Write multiple string filters to an autofilter column. * diff --git a/src/worksheet.c b/src/worksheet.c index 3414c11e..8992f224 100644 --- a/src/worksheet.c +++ b/src/worksheet.c @@ -4538,12 +4538,12 @@ _worksheet_write_col_breaks(lxw_worksheet *self) */ STATIC void _worksheet_write_filter(lxw_worksheet *self, const char *str, double num, - uint8_t operator) + uint8_t criteria) { struct xml_attribute_list attributes; struct xml_attribute *attribute; - if (operator == LXW_FILTER_CRITERIA_BLANKS) + if (criteria == LXW_FILTER_CRITERIA_BLANKS) return; LXW_INIT_ATTRIBUTES(); @@ -4605,22 +4605,22 @@ _worksheet_write_filter_standard(lxw_worksheet *self, */ STATIC void _worksheet_write_custom_filter(lxw_worksheet *self, const char *str, double num, - uint8_t operator) + uint8_t criteria) { struct xml_attribute_list attributes; struct xml_attribute *attribute; LXW_INIT_ATTRIBUTES(); - if (operator == LXW_FILTER_CRITERIA_NOT_EQUAL_TO) + if (criteria == LXW_FILTER_CRITERIA_NOT_EQUAL_TO) LXW_PUSH_ATTRIBUTES_STR("operator", "notEqual"); - if (operator == LXW_FILTER_CRITERIA_GREATER_THAN) + if (criteria == LXW_FILTER_CRITERIA_GREATER_THAN) LXW_PUSH_ATTRIBUTES_STR("operator", "greaterThan"); - else if (operator == LXW_FILTER_CRITERIA_GREATER_THAN_OR_EQUAL_TO) + else if (criteria == LXW_FILTER_CRITERIA_GREATER_THAN_OR_EQUAL_TO) LXW_PUSH_ATTRIBUTES_STR("operator", "greaterThanOrEqual"); - else if (operator == LXW_FILTER_CRITERIA_LESS_THAN) + else if (criteria == LXW_FILTER_CRITERIA_LESS_THAN) LXW_PUSH_ATTRIBUTES_STR("operator", "lessThan"); - else if (operator == LXW_FILTER_CRITERIA_LESS_THAN_OR_EQUAL_TO) + else if (criteria == LXW_FILTER_CRITERIA_LESS_THAN_OR_EQUAL_TO) LXW_PUSH_ATTRIBUTES_STR("operator", "lessThanOrEqual"); if (str) @@ -8374,7 +8374,7 @@ worksheet_filter_column(lxw_worksheet *self, lxw_col_t col, lxw_error worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col, lxw_filter_rule *rule1, lxw_filter_rule *rule2, - uint8_t operator) + uint8_t and_or) { lxw_filter_rule_obj *rule_obj; uint16_t rule_index; @@ -8408,7 +8408,7 @@ worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col, rule_obj = calloc(1, sizeof(lxw_filter_rule_obj)); RETURN_ON_MEM_ERROR(rule_obj, LXW_ERROR_MEMORY_MALLOC_FAILED); - if (operator == LXW_FILTER_AND) + if (and_or == LXW_FILTER_AND) rule_obj->type = LXW_FILTER_TYPE_AND; else rule_obj->type = LXW_FILTER_TYPE_OR;