[1147] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r1096 - trunk/owl

daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:13:30 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Wed, 30 Jul 2008 18:35:09 -0400 (EDT)

Author: asedeno
Date: 2008-07-30 18:35:08 -0400 (Wed, 30 Jul 2008)
New Revision: 1096

Modified:
   trunk/owl/filter.c
   trunk/owl/functions.c
   trunk/owl/owl.h
   trunk/owl/util.c
Log:
The color default has been -1 for a while now, so we match what curses thinks.
We shouldn't also believe that -1 means invalid color.
Adding OWL_COLOR_INVALID (-2) and using that in place of -1 when checking for invalid colors.


Modified: trunk/owl/filter.c
===================================================================
--- trunk/owl/filter.c	2008-07-28 14:07:48 UTC (rev 1095)
+++ trunk/owl/filter.c	2008-07-30 22:35:08 UTC (rev 1096)
@@ -28,7 +28,7 @@
   /* set the color */
   while ( argc>=2 && ( !strcmp(argv[0], "-c") ||
 		       !strcmp(argv[0], "-b") ) ) {
-    if (owl_util_string_to_color(argv[1])==-1) {
+    if (owl_util_string_to_color(argv[1])==OWL_COLOR_INVALID) {
       owl_function_error("The color '%s' is not available, using default.", argv[1]);
     } else {
       switch (argv[0][1]) {

Modified: trunk/owl/functions.c
===================================================================
--- trunk/owl/functions.c	2008-07-28 14:07:48 UTC (rev 1095)
+++ trunk/owl/functions.c	2008-07-30 22:35:08 UTC (rev 1096)
@@ -2391,7 +2391,7 @@
       owl_function_error("The filter '%s' does not exist.", argv[1]);
       return;
     }
-    if (owl_util_string_to_color(argv[3])==-1) {
+    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
       owl_function_error("The color '%s' is not available.", argv[3]);
       return;
     }
@@ -2406,7 +2406,7 @@
       owl_function_error("The filter '%s' does not exist.", argv[1]);
       return;
     }
-    if (owl_util_string_to_color(argv[3])==-1) {
+    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
       owl_function_error("The color '%s' is not available.", argv[3]);
       return;
     }
@@ -2940,14 +2940,14 @@
     return(-2);
   }
 
-  if (owl_util_string_to_color(fgcolor)==-1) {
+  if (owl_util_string_to_color(fgcolor)==OWL_COLOR_INVALID) {
     owl_function_error("No color named '%s' avilable.", fgcolor);
     return(-1);
   }
 
 
   if (bgcolor != NULL) {
-    if (owl_util_string_to_color(bgcolor)==-1) {
+    if (owl_util_string_to_color(bgcolor)==OWL_COLOR_INVALID) {
       owl_function_error("No color named '%s' avilable.", bgcolor);
       return(-1);
     }

Modified: trunk/owl/owl.h
===================================================================
--- trunk/owl/owl.h	2008-07-28 14:07:48 UTC (rev 1095)
+++ trunk/owl/owl.h	2008-07-30 22:35:08 UTC (rev 1096)
@@ -99,6 +99,7 @@
 #define OWL_COLOR_CYAN      6
 #define OWL_COLOR_WHITE     7
 #define OWL_COLOR_DEFAULT   -1
+#define OWL_COLOR_INVALID   -2
 
 #define OWL_EDITWIN_STYLE_MULTILINE 0
 #define OWL_EDITWIN_STYLE_ONELINE   1

Modified: trunk/owl/util.c
===================================================================
--- trunk/owl/util.c	2008-07-28 14:07:48 UTC (rev 1095)
+++ trunk/owl/util.c	2008-07-30 22:35:08 UTC (rev 1096)
@@ -497,7 +497,7 @@
   if (c >= -1 && c < COLORS) {
     return(c);
   }
-  return(-1);
+  return(OWL_COLOR_INVALID);
 }
 
 /* Return a string name of the given owl color */


home help back first fref pref prev next nref lref last post