Skip to content

Commit

Permalink
Eliminate some clumsy type-casts
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Oct 24, 2023
1 parent d22fdc9 commit 448956a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions unix/tkUnixButton.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,15 @@ TkpDrawCheckIndicator(
}
memcpy(svgDataCopy, svgDataPtr, svgDataLen);
svgDataCopy[svgDataLen] = '\0';
svgDataPtr = svgDataCopy;

/*
* Update the colors within svgDataCopy
*/

darkColorPtr = strstr(svgDataPtr, "DARKKK");
lightColorPtr = strstr(svgDataPtr, "LIGHTT");
interiorColorPtr = strstr(svgDataPtr, "INTROR");
indicatorColorPtr = strstr(svgDataPtr, "INDCTR");
darkColorPtr = strstr(svgDataCopy, "DARKKK");
lightColorPtr = strstr(svgDataCopy, "LIGHTT");
interiorColorPtr = strstr(svgDataCopy, "INTROR");
indicatorColorPtr = strstr(svgDataCopy, "INDCTR");

if (darkColorPtr != NULL) {
memcpy(darkColorPtr, darkColorStr, 6);
Expand Down
13 changes: 6 additions & 7 deletions win/tkWinButton.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,18 +455,17 @@ TkpDrawIndicator(
}
memcpy(svgDataCopy, svgDataPtr, svgDataLen);
svgDataCopy[svgDataLen] = '\0';
svgDataPtr = svgDataCopy;

/*
* Update the colors within svgDataCopy
*/

topOuterColorPtr = strstr(svgDataPtr, "a0a0a0");
btmOuterColorPtr = strstr(svgDataPtr, "eeeeee");
topInnerColorPtr = strstr(svgDataPtr, "696969");
btmInnerColorPtr = strstr(svgDataPtr, "e3e3e3");
interiorColorPtr = strstr(svgDataPtr, "ffffff");
checkColorPtr = strstr(svgDataPtr, "000000");
topOuterColorPtr = strstr(svgDataCopy, "a0a0a0");
btmOuterColorPtr = strstr(svgDataCopy, "eeeeee");
topInnerColorPtr = strstr(svgDataCopy, "696969");
btmInnerColorPtr = strstr(svgDataCopy, "e3e3e3");
interiorColorPtr = strstr(svgDataCopy, "ffffff");
checkColorPtr = strstr(svgDataCopy, "000000");

assert(topOuterColorPtr);
assert(btmOuterColorPtr);
Expand Down

0 comments on commit 448956a

Please sign in to comment.