summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixButton.c
diff options
context:
space:
mode:
authorcsaba <csaba>2023-03-03 18:35:15 (GMT)
committercsaba <csaba>2023-03-03 18:35:15 (GMT)
commit9baa9e4e8d5bc0b13e50aee748da41fc8a0685d7 (patch)
tree6e6759ab5f6587e989a372c012f652f2862ba28a /unix/tkUnixButton.c
parentd6e7246b215b507e14e2653aaeaa12804a31166b (diff)
downloadtk-9baa9e4e8d5bc0b13e50aee748da41fc8a0685d7.zip
tk-9baa9e4e8d5bc0b13e50aee748da41fc8a0685d7.tar.gz
tk-9baa9e4e8d5bc0b13e50aee748da41fc8a0685d7.tar.bz2
Helper function ColorToStr() greatly simplified.
Diffstat (limited to 'unix/tkUnixButton.c')
-rw-r--r--unix/tkUnixButton.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 8222fca..e02e079 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -189,11 +189,8 @@ ColorToStr(
char *colorStr) /* memory area to which the color is to be
output 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