summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkElements.c
diff options
context:
space:
mode:
authorcsaba <csaba>2023-10-25 09:34:47 (GMT)
committercsaba <csaba>2023-10-25 09:34:47 (GMT)
commit7c6b2012e75a7c80f78d549fc54ba1613bcfa5cc (patch)
tree044ebd15aff8ea7bb27235e414b793bdc7bbdf13 /generic/ttk/ttkElements.c
parente5eab5da94b744a503e64bc892d93e0bcf50617e (diff)
downloadtk-7c6b2012e75a7c80f78d549fc54ba1613bcfa5cc.zip
tk-7c6b2012e75a7c80f78d549fc54ba1613bcfa5cc.tar.gz
tk-7c6b2012e75a7c80f78d549fc54ba1613bcfa5cc.tar.bz2
Made sure that a C++ compiler won't raise warnings related to the invocations of strstr(). Thanks Jan!
Diffstat (limited to 'generic/ttk/ttkElements.c')
-rw-r--r--generic/ttk/ttkElements.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index d798806..bc53bac 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -797,8 +797,8 @@ static void IndicatorElementDraw(
(selected ? spec->onDataPtr : spec->offDataPtr));
/*
- * Copy the string pointed to by svgDataPtr to a newly allocated memory
- * area svgDataCopy and assign the latter's address to svgDataPtr
+ * Copy the string pointed to by svgDataPtr to
+ * a newly allocated memory area svgDataCopy
*/
svgDataLen = strlen(svgDataPtr);
svgDataCopy = (char *)attemptckalloc(svgDataLen + 1);
@@ -807,14 +807,13 @@ static void IndicatorElementDraw(
}
memcpy(svgDataCopy, svgDataPtr, svgDataLen);
svgDataCopy[svgDataLen] = '\0';
- svgDataPtr = svgDataCopy;
/*
* Update the colors within svgDataCopy
*/
if (selected || tristate) {
- bgColorPtr = strstr(svgDataPtr, "4a6984");
- fgColorPtr = strstr(svgDataPtr, "ffffff");
+ bgColorPtr = strstr(svgDataCopy, "4a6984");
+ fgColorPtr = strstr(svgDataCopy, "ffffff");
assert(bgColorPtr);
assert(fgColorPtr);
@@ -822,8 +821,8 @@ static void IndicatorElementDraw(
memcpy(bgColorPtr, bgColorStr, 6);
memcpy(fgColorPtr, fgColorStr, 6);
} else {
- bgColorPtr = strstr(svgDataPtr, "ffffff");
- borderColorPtr = strstr(svgDataPtr, "888888");
+ bgColorPtr = strstr(svgDataCopy, "ffffff");
+ borderColorPtr = strstr(svgDataCopy, "888888");
assert(bgColorPtr);
assert(borderColorPtr);
@@ -1429,8 +1428,8 @@ static void SliderElementDraw(
img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL);
if (img == NULL) {
/*
- * Copy the string pointed to by svgDataPtr to a newly allocated memory
- * area svgDataCopy and assign the latter's address to svgDataPtr
+ * Copy the string pointed to by svgDataPtr to
+ * a newly allocated memory area svgDataCopy
*/
svgDataLen = strlen(svgDataPtr);
svgDataCopy = (char *)attemptckalloc(svgDataLen + 1);
@@ -1439,14 +1438,13 @@ static void SliderElementDraw(
}
memcpy(svgDataCopy, svgDataPtr, svgDataLen);
svgDataCopy[svgDataLen] = '\0';
- svgDataPtr = svgDataCopy;
/*
* Update the colors within svgDataCopy
*/
- innerColorPtr = strstr(svgDataPtr, "4a6984");
- outerColorPtr = strstr(svgDataPtr, "ffffff");
- borderColorPtr = strstr(svgDataPtr, "c3c3c3");
+ innerColorPtr = strstr(svgDataCopy, "4a6984");
+ outerColorPtr = strstr(svgDataCopy, "ffffff");
+ borderColorPtr = strstr(svgDataCopy, "c3c3c3");
assert(innerColorPtr);
assert(outerColorPtr);
assert(borderColorPtr);