# HG changeset patch # User Bruno Haible # Date 1293993258 -3600 # Node ID 5400154288e566ef880091483fb26ec4733106e6 # Parent b3fb554bb01205d178541ea17a0f633a6d37bb9d 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'. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2011-01-02 Bruno Haible + + 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 pwrite: Fix test whether it works and make it work on HP-UX 11.11. diff --git a/lib/unigbrk/u16-grapheme-breaks.c b/lib/unigbrk/u16-grapheme-breaks.c --- a/lib/unigbrk/u16-grapheme-breaks.c +++ b/lib/unigbrk/u16-grapheme-breaks.c @@ -32,7 +32,6 @@ for (; n > 0; s += mblen, p += mblen, n -= mblen) { ucs4_t next; - int i; mblen = u16_mbtouc (&next, s, n); diff --git a/lib/unigbrk/u16-grapheme-prev.c b/lib/unigbrk/u16-grapheme-prev.c --- a/lib/unigbrk/u16-grapheme-prev.c +++ b/lib/unigbrk/u16-grapheme-prev.c @@ -26,7 +26,6 @@ u16_grapheme_prev (const uint16_t *s, const uint16_t *start) { ucs4_t next; - int mblen; if (s == start) return NULL; diff --git a/lib/unigbrk/u8-grapheme-prev.c b/lib/unigbrk/u8-grapheme-prev.c --- a/lib/unigbrk/u8-grapheme-prev.c +++ b/lib/unigbrk/u8-grapheme-prev.c @@ -26,7 +26,6 @@ u8_grapheme_prev (const uint8_t *s, const uint8_t *start) { ucs4_t next; - int mblen; if (s == start) return NULL; diff --git a/tests/unigbrk/test-u16-grapheme-breaks.c b/tests/unigbrk/test-u16-grapheme-breaks.c --- a/tests/unigbrk/test-u16-grapheme-breaks.c +++ b/tests/unigbrk/test-u16-grapheme-breaks.c @@ -81,8 +81,6 @@ 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); diff --git a/tests/unigbrk/test-u32-grapheme-breaks.c b/tests/unigbrk/test-u32-grapheme-breaks.c --- a/tests/unigbrk/test-u32-grapheme-breaks.c +++ b/tests/unigbrk/test-u32-grapheme-breaks.c @@ -81,8 +81,6 @@ 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); diff --git a/tests/unigbrk/test-u8-grapheme-breaks.c b/tests/unigbrk/test-u8-grapheme-breaks.c --- a/tests/unigbrk/test-u8-grapheme-breaks.c +++ b/tests/unigbrk/test-u8-grapheme-breaks.c @@ -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 @@ int main (void) { - static const char s[] = "abc"; - /* Standalone 1-unit graphemes. */ test_u8_grapheme_breaks ("a", "#"); test_u8_grapheme_breaks ("ab", "##"); diff --git a/tests/unigbrk/test-u8-grapheme-next.c b/tests/unigbrk/test-u8-grapheme-next.c --- a/tests/unigbrk/test-u8-grapheme-next.c +++ b/tests/unigbrk/test-u8-grapheme-next.c @@ -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) { diff --git a/tests/unigbrk/test-u8-grapheme-prev.c b/tests/unigbrk/test-u8-grapheme-prev.c --- a/tests/unigbrk/test-u8-grapheme-prev.c +++ b/tests/unigbrk/test-u8-grapheme-prev.c @@ -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 @@ int main (void) { - static const char s[] = "abc"; + static const uint8_t s[] = "abc"; /* Empty string. */ ASSERT (u8_grapheme_prev (NULL, NULL) == NULL); diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c --- a/tests/unigbrk/test-uc-is-grapheme-break.c +++ b/tests/unigbrk/test-uc-is-grapheme-break.c @@ -110,7 +110,7 @@ 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 @@ { 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;