diff options
author | csaba <csaba> | 2023-10-25 09:34:47 (GMT) |
---|---|---|
committer | csaba <csaba> | 2023-10-25 09:34:47 (GMT) |
commit | 7c6b2012e75a7c80f78d549fc54ba1613bcfa5cc (patch) | |
tree | 044ebd15aff8ea7bb27235e414b793bdc7bbdf13 | |
parent | e5eab5da94b744a503e64bc892d93e0bcf50617e (diff) | |
download | tk-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!
-rw-r--r-- | generic/ttk/ttkClamTheme.c | 13 | ||||
-rw-r--r-- | generic/ttk/ttkDefaultTheme.c | 17 | ||||
-rw-r--r-- | generic/ttk/ttkElements.c | 24 | ||||
-rw-r--r-- | unix/tkUnixButton.c | 4 | ||||
-rw-r--r-- | win/tkWinButton.c | 5 |
5 files changed, 29 insertions, 34 deletions
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 81c5641..f6cd38c 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -469,8 +469,8 @@ static void IndicatorElementDraw( svgDataPtr = (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); @@ -479,16 +479,15 @@ static void IndicatorElementDraw( } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; - svgDataPtr = svgDataCopy; /* * Update the colors within svgDataCopy */ - upperBdColorPtr = strstr(svgDataPtr, "9e9a91"); - lowerBdColorPtr = strstr(svgDataPtr, "cfcdc8"); - bgColorPtr = strstr(svgDataPtr, "ffffff"); - fgColorPtr = strstr(svgDataPtr, "000000"); + upperBdColorPtr = strstr(svgDataCopy, "9e9a91"); + lowerBdColorPtr = strstr(svgDataCopy, "cfcdc8"); + bgColorPtr = strstr(svgDataCopy, "ffffff"); + fgColorPtr = strstr(svgDataCopy, "000000"); assert(upperBdColorPtr); assert(lowerBdColorPtr); diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 2271592..531fe01 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -641,8 +641,8 @@ static void IndicatorElementDraw( svgDataPtr = (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); @@ -651,18 +651,17 @@ static void IndicatorElementDraw( } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; - svgDataPtr = svgDataCopy; /* * Update the colors within svgDataCopy */ - shadeColorPtr = strstr(svgDataPtr, "888888"); - highlightColorPtr = strstr(svgDataPtr, "eeeeee"); - borderColorPtr = strstr(svgDataPtr, "414141"); - bgColorPtr = strstr(svgDataPtr, "d9d9d9"); - indicatorColorPtr = strstr(svgDataPtr, "ffffff"); - fgColorPtr = strstr(svgDataPtr, "000000"); + shadeColorPtr = strstr(svgDataCopy, "888888"); + highlightColorPtr = strstr(svgDataCopy, "eeeeee"); + borderColorPtr = strstr(svgDataCopy, "414141"); + bgColorPtr = strstr(svgDataCopy, "d9d9d9"); + indicatorColorPtr = strstr(svgDataCopy, "ffffff"); + fgColorPtr = strstr(svgDataCopy, "000000"); assert(shadeColorPtr); assert(highlightColorPtr); 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); diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 8ed985e..3b58348 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -282,8 +282,8 @@ TkpDrawCheckIndicator( 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); diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 43d5368..6dfc2be 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -443,9 +443,8 @@ TkpDrawIndicator( } /* - * 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); |