Skip to content

Commit

Permalink
Replace use of c++ reserved word operator.
Browse files Browse the repository at this point in the history
Issue #353
  • Loading branch information
jmcnamara committed Aug 9, 2021
1 parent bfec97a commit b66c9bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions include/xlsxwriter/worksheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -3713,16 +3713,15 @@ 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
* ww_autofilters_data for more details.
*/
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.
*
Expand Down
20 changes: 10 additions & 10 deletions src/worksheet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b66c9bc

Please sign in to comment.