]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/color_name.h
ncurses 5.9 - patch 20150523
[ncurses.git] / test / color_name.h
index ff82d4647d2bc87e06e13128a8154c33e6e35c94..81a3b3125759bfd426c7e0396b1bfed3a272b3c1 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2011 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2011,2012 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.2 2011/04/23 17:15:01 tom Exp $
+ * $Id: color_name.h,v 1.4 2012/11/18 01:59:32 tom Exp $
  */
 
 #ifndef __COLORNAME_H
@@ -64,7 +64,7 @@ color_code(const char *color)
     char *endp = 0;
     size_t n;
 
-    if ((result = strtol(color, &endp, 0)) >= 0
+    if ((result = (int) strtol(color, &endp, 0)) >= 0
        && (endp == 0 || *endp == 0)) {
        ;
     } else if (!strcmp(color, "default")) {
@@ -88,7 +88,7 @@ color_name(int color)
     static char temp[20];
     const char *result = 0;
 
-    if (color > (int) SIZEOF(the_color_names)) {
+    if (color >= (int) SIZEOF(the_color_names)) {
        sprintf(temp, "%d", color);
        result = temp;
     } else if (color < 0) {