X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fcolor_name.h;h=5ec4dcbf990e032a1c894a9de70360d707aa33fe;hp=0964dce15990d7beeb093f1ea4ceea4679b5b989;hb=b025434573f466efe27862656a6a9d41dd2bd609;hpb=3f20704179ae1f625bd7bc75829929ccf46b25c3 diff --git a/test/color_name.h b/test/color_name.h index 0964dce1..5ec4dcbf 100644 --- a/test/color_name.h +++ b/test/color_name.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2011 Free Software Foundation, Inc. * + * Copyright (c) 2011-2016,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: color_name.h,v 1.3 2011/05/14 17:41:17 tom Exp $ + * $Id: color_name.h,v 1.6 2018/12/29 15:19:30 tom Exp $ */ #ifndef __COLORNAME_H @@ -79,7 +79,7 @@ color_code(const char *color) } return result; } -#endif /* NEED_COLOR_NAME */ +#endif /* NEED_COLOR_CODE */ #ifdef NEED_COLOR_NAME static const char * @@ -88,8 +88,8 @@ color_name(int color) static char temp[20]; const char *result = 0; - if (color > (int) SIZEOF(the_color_names)) { - sprintf(temp, "%d", color); + if (color >= (int) SIZEOF(the_color_names)) { + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(result)) "%d", color); result = temp; } else if (color < 0) { result = "default";