summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/ttk/ttkClamTheme.c7
-rw-r--r--generic/ttk/ttkDefaultTheme.c7
2 files changed, 4 insertions, 10 deletions
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index dccefc2..de24d8c 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -397,11 +397,8 @@ static void IndicatorElementSize(
static void ColorToStr(
const XColor *colorPtr, char *colorStr) /* in the format "RRGGBB" */
{
- char str[13];
-
- snprintf(str, sizeof(str), "%04x%04x%04x",
- colorPtr->red, colorPtr->green, colorPtr->blue);
- snprintf(colorStr, 7, "%.2s%.2s%.2s", str, str + 4, str + 8);
+ snprintf(colorStr, 7, "%02x%02x%02x",
+ colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8);
}
static void ImageChanged( /* to be passed to Tk_GetImage() */
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c
index aad519e..0a1afa5 100644
--- a/generic/ttk/ttkDefaultTheme.c
+++ b/generic/ttk/ttkDefaultTheme.c
@@ -507,11 +507,8 @@ static void IndicatorElementSize(
static void ColorToStr(
const XColor *colorPtr, char *colorStr) /* in the format "RRGGBB" */
{
- char str[13];
-
- snprintf(str, sizeof(str), "%04x%04x%04x",
- colorPtr->red, colorPtr->green, colorPtr->blue);
- snprintf(colorStr, 7, "%.2s%.2s%.2s", str, str + 4, str + 8);
+ snprintf(colorStr, 7, "%02x%02x%02x",
+ colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8);
}
static void ImageChanged( /* to be passed to Tk_GetImage() */