From 5e0d51c77107931d3a86cd8d548643c65e5c7063 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sun, 15 Oct 2017 12:06:27 -0700 Subject: [PATCH] Sanitized some grid_dims assignments A number of assignments of grid_dims structs were of the form of (ignoring some carriage returns, which undoubtedly added to the confusion): gd_controls = (grid_dims) { 3, 2 }; which confused `indent`, causing it to think certain if/else blocks were being ended early. Turning these into assignments, like so, to avoid this: gd_controls.rows = 3; gd_controls.cols = 2; --- src/tuxpaint.c | 89 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 28 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 08ec082fd..d0bee404d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -3365,9 +3365,13 @@ static void mainloop(void) SDL_Rect r_items; /* = r_notcontrols; */ int toolopt_changed; int select_changed = 0; + grid_dims gd_controls; /* might become 2-by-2 */ + grid_dims gd_items; /* generally becoming 2-by-whatever */ - grid_dims gd_controls = { 0, 0 }; /* might become 2-by-2 */ - grid_dims gd_items = { 2, 2 }; /* generally becoming 2-by-whatever */ + gd_controls.rows = 0; + gd_controls.cols = 0; + gd_items.rows = 2; + gd_items.cols = 2; /* Note set of things we're dealing with */ /* (stamps, brushes, etc.) */ @@ -3375,35 +3379,47 @@ static void mainloop(void) if (cur_tool == TOOL_STAMP) { if (!disable_stamp_controls) - gd_controls = (grid_dims) - { - 3, 2}; /* was 2,2 before adding left/right stamp group buttons -bjk 2007.05.15 */ + { + /* was 2,2 before adding left/right stamp group buttons -bjk 2007.05.15 */ + gd_controls.rows = 3; + gd_controls.cols = 2; + } else - gd_controls = (grid_dims) - { - 1, 2}; /* was left 0,0 before adding left/right stamp group buttons -bjk 2007.05.03 */ + { + /* was left 0,0 before adding left/right stamp group buttons -bjk 2007.05.03 */ + gd_controls.rows = 1; + gd_controls.cols = 2; + } } else if (cur_tool == TOOL_TEXT) { if (!disable_stamp_controls) - gd_controls = (grid_dims) - { - 2, 2}; + { + gd_controls.rows = 2; + gd_controls.cols = 2; + } } else if (cur_tool == TOOL_LABEL) { if (!disable_stamp_controls) - gd_controls = (grid_dims) { 3 , 2 }; + { + gd_controls.rows = 3; + gd_controls.cols = 2; + } else - gd_controls = (grid_dims) { 1 , 2}; + { + gd_controls.rows = 1; + gd_controls.cols = 2; + } } else if (cur_tool == TOOL_MAGIC) { if (!disable_magic_controls) - gd_controls = (grid_dims) { - 1, 2}; + gd_controls.rows = 1; + gd_controls.cols = 2; + } } /* number of whole or partial rows that will be needed @@ -4556,8 +4572,13 @@ static void mainloop(void) /* Right tool options scroll */ else { - grid_dims gd_controls = { 0, 0 }; /* might become 2-by-2 */ - grid_dims gd_items = { 2, 2 }; /* generally becoming 2-by-whatever */ + grid_dims gd_controls; /* might become 2-by-2 */ + grid_dims gd_items; /* generally becoming 2-by-whatever */ + + gd_controls.rows = 0; + gd_controls.cols = 0; + gd_items.rows = 2; + gd_items.cols = 2; /* Note set of things we're dealing with */ /* (stamps, brushes, etc.) */ @@ -4565,34 +4586,46 @@ static void mainloop(void) if (cur_tool == TOOL_STAMP) { if (!disable_stamp_controls) - gd_controls = (grid_dims) { - 3, 2}; /* was 2,2 before adding left/right stamp group buttons -bjk 2007.05.15 */ + /* was 2,2 before adding left/right stamp group buttons -bjk 2007.05.15 */ + gd_controls.rows = 3; + gd_controls.cols = 2; + } else - gd_controls = (grid_dims) { - 1, 2}; /* was left 0,0 before adding left/right stamp group buttons -bjk 2007.05.03 */ + /* was left 0,0 before adding left/right stamp group buttons -bjk 2007.05.03 */ + gd_controls.rows = 1; + gd_controls.cols = 2; + } } else if (cur_tool == TOOL_TEXT) { if (!disable_stamp_controls) - gd_controls = (grid_dims) - { - 2, 2}; + { + gd_controls.rows = 2; + gd_controls.cols = 2; + } } else if(cur_tool == TOOL_LABEL) { if (!disable_stamp_controls) - gd_controls = (grid_dims){ 3 , 2 }; + { + gd_controls.rows = 3; + gd_controls.cols = 2; + } else - gd_controls = (grid_dims) { 1 , 2}; + { + gd_controls.rows = 1; + gd_controls.cols = 2; + } } else if (cur_tool == TOOL_MAGIC) { if (!disable_magic_controls) - gd_controls = (grid_dims) { - 1, 2}; + gd_controls.rows = 1; + gd_controls.cols = 2; + } } /* number of whole or partial rows that will be needed