]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/video/colors.c (grub_video_parse_color): Fix error message.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 9 Feb 2012 13:48:35 +0000 (14:48 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 9 Feb 2012 13:48:35 +0000 (14:48 +0100)
Remove assignment in if while on it.

ChangeLog
grub-core/video/colors.c

index 1a64aa80c9b8c6d24f70261b532406c3e9b75d89..c9c54a1e0f6d011cc2590996e500441d36329630 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-09  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/video/colors.c (grub_video_parse_color): Fix error message.
+       Remove assignment in if while on it.
+
 2012-02-09  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub-mkstandalone.in: Fix modules directory.
index ca1d3332bfdec5671b6088e10f1c4c9ac74328d7..76359eaf0f01f9bd9b9a01e1bc46b5aee87b9e22 100644 (file)
@@ -245,11 +245,14 @@ grub_err_t
 grub_video_parse_color (const char *s, grub_video_rgba_color_t *color)
 {
   grub_video_rgba_color_t c;
+  const char *s0;
 
   /* Skip whitespace.  */
   while (*s && grub_isspace (*s))
     s++;
 
+  s0 = s;
+
   if (*s == '#')
     {
       /* HTML-style.  Number if hex digits:
@@ -289,23 +292,26 @@ grub_video_parse_color (const char *s, grub_video_rgba_color_t *color)
         }
       else
         return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                           "invalid HTML-type color string `%s'", s);
+                           N_("invalid color specification `%s'"), s0);
     }
   else if (grub_isdigit (*s))
     {
       /* Comma separated decimal values.  */
       c.red = grub_strtoul (s, 0, 0);
-      if ((s = grub_strchr (s, ',')) == 0)
+      s = grub_strchr (s, ',');
+      if (!s)
         return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                           "missing 1st comma separator in color `%s'", s);
+                           N_("invalid color specification `%s'"), s0);
       s++;
       c.green = grub_strtoul (s, 0, 0);
-      if ((s = grub_strchr (s, ',')) == 0)
+      s = grub_strchr (s, ',');
+      if (!s)
         return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                           "missing 2nd comma separator in color `%s'", s);
+                           N_("invalid color specification `%s'"), s0);
       s++;
       c.blue = grub_strtoul (s, 0, 0);
-      if ((s = grub_strchr (s, ',')) == 0)
+      s = grub_strchr (s, ',');
+      if (!s)
         c.alpha = 255;
       else
         {
@@ -317,7 +323,7 @@ grub_video_parse_color (const char *s, grub_video_rgba_color_t *color)
     {
       if (! grub_video_get_named_color (s, &c))
         return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                           "invalid named color `%s'", s);
+                           N_("invalid color specification `%s'"), s0);
     }
 
   if (grub_errno == GRUB_ERR_NONE)