unigbrk: Avoid gcc warnings.
authorBruno Haible <bruno@clisp.org>
Sun, 2 Jan 2011 18:34:18 +0000 (19:34 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 2 Jan 2011 18:34:18 +0000 (19:34 +0100)
* lib/unigbrk/u16-grapheme-breaks.c (u16_grapheme_breaks): Remove
unused variable.
* lib/unigbrk/u16-grapheme-prev.c (u16_grapheme_prev): Likewise.
* lib/unigbrk/u8-grapheme-prev.c (u8_grapheme_prev): Likewise.
* tests/unigbrk/test-u16-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u32-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
Change type of first argument to 'const char *'.
(main): Remove unused variable.
* tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next): Change
type of first argument to 'const char *'.
* tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
Likewise.
(main): Change type of variable 's'.
* tests/unigbrk/test-uc-is-grapheme-break.c (main): Cast column number
to 'int'.

ChangeLog
lib/unigbrk/u16-grapheme-breaks.c
lib/unigbrk/u16-grapheme-prev.c
lib/unigbrk/u8-grapheme-prev.c
tests/unigbrk/test-u16-grapheme-breaks.c
tests/unigbrk/test-u32-grapheme-breaks.c
tests/unigbrk/test-u8-grapheme-breaks.c
tests/unigbrk/test-u8-grapheme-next.c
tests/unigbrk/test-u8-grapheme-prev.c
tests/unigbrk/test-uc-is-grapheme-break.c

index 744340b..9169a74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2011-01-02  Bruno Haible  <bruno@clisp.org>
 
+       unigbrk: Avoid gcc warnings.
+       * lib/unigbrk/u16-grapheme-breaks.c (u16_grapheme_breaks): Remove
+       unused variable.
+       * lib/unigbrk/u16-grapheme-prev.c (u16_grapheme_prev): Likewise.
+       * lib/unigbrk/u8-grapheme-prev.c (u8_grapheme_prev): Likewise.
+       * tests/unigbrk/test-u16-grapheme-breaks.c (main): Likewise.
+       * tests/unigbrk/test-u32-grapheme-breaks.c (main): Likewise.
+       * tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
+       Change type of first argument to 'const char *'.
+       (main): Remove unused variable.
+       * tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next): Change
+       type of first argument to 'const char *'.
+       * tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
+       Likewise.
+       (main): Change type of variable 's'.
+       * tests/unigbrk/test-uc-is-grapheme-break.c (main): Cast column number
+       to 'int'.
+
+2011-01-02  Bruno Haible  <bruno@clisp.org>
+
        pwrite: Fix test whether it works and make it work on HP-UX 11.11.
        * m4/pwrite.m4 (gl_FUNC_PWRITE): Use AC_LANG_PROGRAM, not
        AC_LANG_SOURCE. Extend the test program to catch another HP-UX 11.11
index b79a8a8..b922434 100644 (file)
@@ -32,7 +32,6 @@ u16_grapheme_breaks (const uint16_t *s, size_t n, char *p)
   for (; n > 0; s += mblen, p += mblen, n -= mblen)
     {
       ucs4_t next;
-      int i;
 
       mblen = u16_mbtouc (&next, s, n);
 
index 437f3db..ff7a065 100644 (file)
@@ -26,7 +26,6 @@ const uint16_t *
 u16_grapheme_prev (const uint16_t *s, const uint16_t *start)
 {
   ucs4_t next;
-  int mblen;
 
   if (s == start)
     return NULL;
index ac866b0..d89e181 100644 (file)
@@ -26,7 +26,6 @@ const uint8_t *
 u8_grapheme_prev (const uint8_t *s, const uint8_t *start)
 {
   ucs4_t next;
-  int mblen;
 
   if (s == start)
     return NULL;
index 165ea4e..988f2ed 100644 (file)
@@ -81,8 +81,6 @@ test_u16_grapheme_breaks (const char *expected, ...)
 int
 main (void)
 {
-  static const char s[] = "abc";
-
   /* Standalone 1-unit graphemes.  */
   test_u16_grapheme_breaks ("#", 'a', -1);
   test_u16_grapheme_breaks ("##", 'a', 'b', -1);
index 1d16604..dec7204 100644 (file)
@@ -81,8 +81,6 @@ test_u32_grapheme_breaks (const char *expected, ...)
 int
 main (void)
 {
-  static const char s[] = "abc";
-
   /* Standalone 1-unit graphemes.  */
   test_u32_grapheme_breaks ("#", 'a', -1);
   test_u32_grapheme_breaks ("##", 'a', 'b', -1);
index 3bbebb2..5b64d2d 100644 (file)
@@ -28,8 +28,9 @@
 #include "macros.h"
 
 static void
-test_u8_grapheme_breaks (const uint8_t *s, const char *expected)
+test_u8_grapheme_breaks (const char *input, const char *expected)
 {
+  const uint8_t *s = (const uint8_t *) input;
   size_t n = strlen (expected);
   char *breaks;
   size_t i;
@@ -71,8 +72,6 @@ test_u8_grapheme_breaks (const uint8_t *s, const char *expected)
 int
 main (void)
 {
-  static const char s[] = "abc";
-
   /* Standalone 1-unit graphemes.  */
   test_u8_grapheme_breaks ("a", "#");
   test_u8_grapheme_breaks ("ab", "##");
index e67178e..e4731f8 100644 (file)
@@ -27,8 +27,9 @@
 #include "macros.h"
 
 static void
-test_u8_grapheme_next (const uint8_t *s, size_t n, size_t len)
+test_u8_grapheme_next (const char *input, size_t n, size_t len)
 {
+  const uint8_t *s = (const uint8_t *) input;
   const uint8_t *next = u8_grapheme_next (s, s + n);
   if (next != s + len)
     {
index 2f10901..c90d7c4 100644 (file)
@@ -27,8 +27,9 @@
 #include "macros.h"
 
 static void
-test_u8_grapheme_prev (const uint8_t *s, size_t n, size_t len)
+test_u8_grapheme_prev (const char *input, size_t n, size_t len)
 {
+  const uint8_t *s = (const uint8_t *) input;
   const uint8_t *end = s + n;
   const uint8_t *prev = u8_grapheme_prev (end, s);
   if (prev != end - len)
@@ -50,7 +51,7 @@ test_u8_grapheme_prev (const uint8_t *s, size_t n, size_t len)
 int
 main (void)
 {
-  static const char s[] = "abc";
+  static const uint8_t s[] = "abc";
 
   /* Empty string. */
   ASSERT (u8_grapheme_prev (NULL, NULL) == NULL);
index 47304f0..4df5c3e 100644 (file)
@@ -110,7 +110,7 @@ main (int argc, char *argv[])
           else
             {
               fprintf (stderr, "%s:%d.%d: syntax error expecting `÷' or `÷'\n",
-                       filename, lineno, p - line + 1);
+                       filename, lineno, (int) (p - line + 1));
               exit (1);
             }
 
@@ -126,7 +126,7 @@ main (int argc, char *argv[])
                 {
                   fprintf (stderr, "%s:%d.%d: syntax error at `%s' expecting "
                            "hexadecimal Unicode code point number\n",
-                           filename, lineno, p - line + 1, p);
+                           filename, lineno, (int) (p - line + 1), p);
                   exit (1);
                 }
               p += n;