]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Use grub_xasprintf to format translated error messages containing
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 15:41:09 +0000 (16:41 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 15:41:09 +0000 (16:41 +0100)
64-bit quantity.

ChangeLog
util/grub-fstest.c
util/grub-mkimagexx.c

index 9895a2fb3cd7afad6d055a6f4a5731469eca6bfc..745664b6709058bdcd0975d174f66e090becf691 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Use grub_xasprintf to format translated error messages containing
+       64-bit quantity.
+
 2013-12-17  Jon McCune  <jonmccune@google.com>
 
        Fix double-free introduced by commit 33d02a42d64cf06cada1c389
index 23dd558e4122cd0d88e180849a1e0b0079e2cc65..4ff723c5119cee7763cc401112736f9d012602bd 100644 (file)
@@ -99,8 +99,11 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
           len = (leng > BUF_SIZE) ? BUF_SIZE : leng;
 
           if (grub_disk_read (dev->disk, 0, skip, len, buf))
-            grub_util_error (_("disk read fails at offset %lld, length %lld"),
-                             (long long) skip, (long long) len);
+           {
+             char *msg = grub_xasprintf (_("disk read fails at offset %lld, length %lld"),
+                                         (long long) skip, (long long) len);
+             grub_util_error ("%s", msg);
+           }
 
           if (hook (skip, buf, len, hook_arg))
             break;
@@ -128,7 +131,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
 
   if (skip > file->size)
     {
-      grub_util_error (_("invalid skip value %lld"), (unsigned long long) skip);
+      char *msg = grub_xasprintf (_("invalid skip value %lld"),
+                                 (unsigned long long) skip);
+      grub_util_error ("%s", msg);
       return;
     }
 
@@ -148,8 +153,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
        sz = grub_file_read (file, buf, (len > BUF_SIZE) ? BUF_SIZE : len);
        if (sz < 0)
          {
-           grub_util_error (_("read error at offset %llu: %s"),
-                            (unsigned long long) ofs, grub_errmsg);
+           char *msg = grub_xasprintf (_("read error at offset %llu: %s"),
+                                       (unsigned long long) ofs, grub_errmsg);
+           grub_util_error ("%s", msg);
            break;
          }
 
@@ -233,8 +239,9 @@ cmp_hook (grub_off_t ofs, char *buf, int len, void *ff_in)
   static char buf_1[BUF_SIZE];
   if ((int) fread (buf_1, 1, len, ff) != len)
     {
-      grub_util_error (_("read error at offset %llu: %s"),
-                      (unsigned long long) ofs, grub_errmsg);
+      char *msg = grub_xasprintf (_("read error at offset %llu: %s"),
+                                 (unsigned long long) ofs, grub_errmsg);
+      grub_util_error ("%s", msg);
       return 1;
     }
 
@@ -245,8 +252,9 @@ cmp_hook (grub_off_t ofs, char *buf, int len, void *ff_in)
       for (i = 0; i < len; i++, ofs++)
        if (buf_1[i] != buf[i])
          {
-           grub_util_error (_("compare fail at offset %llu"),
-                            (unsigned long long) ofs);
+           char *msg = grub_xasprintf (_("compare fail at offset %llu"),
+                                       (unsigned long long) ofs);
+           grub_util_error ("%s", msg);
            return 1;
          }
     }
index a5ef0bfd282c58ac94ae00a65d0b9e958d81c396..19d94e7f2dba3918f51d5d870efb1dcab1246a00 100644 (file)
@@ -1376,11 +1376,15 @@ SUFFIX (locate_sections) (const char *kernel_path,
              - image_target->link_addr;
            if (grub_host_to_target_addr (s->sh_addr)
                != image_target->link_addr)
-             grub_util_error (_("`%s' is miscompiled: it's start address is 0x%llx"
-                                " instead of 0x%llx: ld.gold bug?"),
-                              kernel_path,
-                              (unsigned long long) grub_host_to_target_addr (s->sh_addr),
-                              (unsigned long long) image_target->link_addr);
+             {
+               char *msg
+                 = grub_xasprintf (_("`%s' is miscompiled: it's start address is 0x%llx"
+                                     " instead of 0x%llx: ld.gold bug?"),
+                                   kernel_path,
+                                   (unsigned long long) grub_host_to_target_addr (s->sh_addr),
+                                   (unsigned long long) image_target->link_addr);
+               grub_util_error ("%s", msg);
+             }
          }
        section_addresses[i] = current_address;
        current_address += grub_host_to_target_addr (s->sh_size);