[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-13-g1cb0094)



The branch, master has been updated
       via  1cb0094c404926fa28cdc1968041f14b4c1e4779 (commit)
      from  4d935762b66030c5b5c3c9ba791eedf90d92b5a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/src/x_color.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


=================
 Commit Messages
=================

commit 1cb0094c404926fa28cdc1968041f14b4c1e4779
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 17:59:03 2008 +0000

    gschem: Extra sanity checking for color indices.

:100644 100644 82a8c3f... bb83ec4... M	gschem/src/x_color.c

=========
 Changes
=========

commit 1cb0094c404926fa28cdc1968041f14b4c1e4779
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 17:59:03 2008 +0000

    gschem: Extra sanity checking for color indices.

diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index 82a8c3f..bb83ec4 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -160,11 +160,12 @@ void x_color_allocate (void)
  */
 GdkColor *x_get_color(int color)
 {
-  if (gdk_colors[color]) {
-    return(gdk_colors[color]);
-  } else {
-    fprintf(stderr, _("Tried to get an invalid color: %d\n"), color);
+  if ((color < 0) || (color >= MAX_COLORS)
+      || (gdk_colors[color] == NULL)) {
+    g_warning (_("Tried to get an invalid color: %d\n"), color);
     return(&white);
+  } else {
+    return(gdk_colors[color]);
   }
 }
 
@@ -176,13 +177,13 @@ GdkColor *x_get_color(int color)
  */
 GdkColor *x_get_darkcolor(int color)
 {
-  if (gdk_outline_colors[color] != NULL) {
-    return(gdk_outline_colors[color]);
-  } else {
-    g_warning (_("Tried to get an invalid outline color: %d\n"), color);
+  if ((color < 0) || (color >= MAX_COLORS)
+      || (gdk_outline_colors[color] == NULL)) {
+    g_warning (_("Tried to get an invalid color: %d\n"), color);
     return(&white);
+  } else {
+    return(gdk_outline_colors[color]);
   }
-
 }
 
 /*! \todo Finish function documentation!!!




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs