From be5e07413f1e7bf306ba122f6ffc27a9a9564f29 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 4 Aug 2015 15:35:47 +0200 Subject: Ignore our own deprecations --- bin/fribidi-benchmark.c | 2 ++ bin/fribidi-main.c | 6 ++++++ lib/fribidi-common.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/bin/fribidi-benchmark.c b/bin/fribidi-benchmark.c index 53eeaf1..9a83819 100644 --- a/bin/fribidi-benchmark.c +++ b/bin/fribidi-benchmark.c @@ -218,6 +218,7 @@ benchmark ( { /* Create a bidi string */ base = FRIBIDI_PAR_ON; +FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS if (!fribidi_log2vis (us, len, &base, /* output */ out_us, positionVtoL, positionLtoV, @@ -225,6 +226,7 @@ benchmark ( die2 ("something failed in fribidi_log2vis.\n" "perhaps memory allocation failure.", NULL); +FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS } /* stop timer */ diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c index d93ccb4..ccdf576 100644 --- a/bin/fribidi-main.c +++ b/bin/fribidi-main.c @@ -376,8 +376,10 @@ main ( #endif /* !FRIBIDI_MAIN_USE_ICONV_H */ die2 ("unrecognized character set `%s'\n", char_set); +FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS fribidi_set_mirroring (do_mirror); fribidi_set_reorder_nsm (do_reorder_nsm); +FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS exit_val = 0; file_found = false; while (optind < argc || !file_found) @@ -468,9 +470,11 @@ main ( /* Create a bidi string. */ base = input_base_direction; +FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS log2vis = fribidi_log2vis (logical, len, &base, /* output */ visual, ltov, vtol, levels); +FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS if (log2vis) { @@ -481,9 +485,11 @@ main ( /* Remove explicit marks, if asked for. */ if (do_clean) +FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS len = fribidi_remove_bidi_marks (visual, len, ltov, vtol, levels); +FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS if (show_visual) { diff --git a/lib/fribidi-common.h b/lib/fribidi-common.h index 6dede39..28cfaa3 100644 --- a/lib/fribidi-common.h +++ b/lib/fribidi-common.h @@ -64,6 +64,8 @@ # define FRIBIDI_END_DECLS G_END_DECLS # define FRIBIDI_GNUC_CONST G_GNUC_CONST # define FRIBIDI_GNUC_DEPRECATED G_GNUC_DEPRECATED +# define FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS +# define FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS # if __GNUC__ > 2 # define FRIBIDI_GNUC_WARN_UNUSED \ __attribute__((__warn_unused_result__)) @@ -79,6 +81,8 @@ #else /* !FRIBIDI_USE_GLIB */ # define FRIBIDI_GNUC_CONST # define FRIBIDI_GNUC_DEPRECATED +# define FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS +# define FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS # define FRIBIDI_GNUC_WARN_UNUSED # define FRIBIDI_GNUC_MALLOC # define FRIBIDI_GNUC_HIDDEN -- cgit v1.2.1 From e71e49f9645d21ab511723caf8c75e8d9880aacf Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 4 Aug 2015 15:48:46 +0200 Subject: Unused variable warnings --- bin/fribidi-main.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c index ccdf576..4402f2e 100644 --- a/bin/fribidi-main.c +++ b/bin/fribidi-main.c @@ -452,7 +452,6 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS FriBidiChar *visual; FriBidiStrIndex *ltov, *vtol; FriBidiLevel *levels; - FriBidiStrIndex new_len; fribidi_boolean log2vis; visual = show_visual ? ALLOCATE (FriBidiChar, @@ -481,8 +480,6 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS if (show_input) printf ("%-*s => ", padding_width, S_); - new_len = len; - /* Remove explicit marks, if asked for. */ if (do_clean) FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -503,7 +500,7 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS FriBidiStrIndex idx, st; for (idx = 0; idx < len;) { - FriBidiStrIndex wid, inlen; + FriBidiStrIndex wid; wid = break_width; st = idx; @@ -530,24 +527,17 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS #endif /* !FRIBIDI_MAIN_USE_ICONV_H */ if (wid < 0 && idx - st > 1) idx--; - inlen = idx - st; #if FRIBIDI_MAIN_USE_ICONV_H+0 { char *str = outstring, *ust = (char *) (visual + st); - int in_len = inlen * sizeof visual[0]; - new_len = sizeof outstring; + int in_len = (idx - st) * sizeof visual[0]; + FriBidiStrIndex new_len = sizeof outstring; iconv (from_ucs4, &ust, &in_len, &str, (int *) &new_len); *str = '\0'; - new_len = str - outstring; } -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ - new_len = - fribidi_unicode_to_charset (char_set_num, - visual + st, inlen, - outstring); #endif /* !FRIBIDI_MAIN_USE_ICONV_H */ if (FRIBIDI_IS_RTL (base)) printf ("%*s", -- cgit v1.2.1 From a6d3dfe04a560ba5ee69e38a62b80c5939d401bc Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 4 Aug 2015 15:56:21 +0200 Subject: Remove bitrot code FRIBIDI_MAIN_USE_ICONV_H is not defined anywhere and the code does not even build, better to clean up the unnecessary #if #else maze. --- bin/fribidi-main.c | 61 +----------------------------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c index 4402f2e..d3fc35d 100644 --- a/bin/fribidi-main.c +++ b/bin/fribidi-main.c @@ -38,11 +38,7 @@ #include #if FRIBIDI_CHARSETS+0 #else -# if FRIBIDI_MAIN_USE_ICONV_H -# include -# else /* !FRIBIDI_MAIN_USE_ICONV_H */ -# include -# endif /* FRIBIDI_MAIN_USE_ICONV_H */ +# include #endif /* !FRIBIDI_CHARSETS */ #include @@ -97,11 +93,7 @@ int text_width; const char *char_set; const char *bol_text, *eol_text; FriBidiParType input_base_direction; -#if FRIBIDI_MAIN_USE_ICONV_H+0 -iconv_t to_ucs4, from_ucs4; -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ int char_set_num; -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ static void help ( @@ -122,16 +114,10 @@ help ( ", same as --clean --nobreak\n" " --showinput --reordernsm --width %d\n", default_text_width); -#if FRIBIDI_MAIN_USE_ICONV_H+0 - printf (" -c, --charset CS Specify character set, default is %s.\n" - " CS should be a valid iconv character set name\n", - char_set); -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ printf (" -c, --charset CS Specify character set, default is %s\n" " --charsetdesc CS Show descriptions for character set CS and exit\n" " --caprtl Old style: set character set to CapRTL\n", char_set); -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ printf (" --showinput Output the input string too\n" " --nopad Do not right justify RTL lines\n" " --nobreak Do not break long lines\n" @@ -163,8 +149,6 @@ help ( " [input-str` => '][BOL][[padding space]visual-str][EOL]\n" " [\\n base-dir][\\n ltov-map][\\n vtol-map][\\n levels][\\n changes]\n"); -#if FRIBIDI_MAIN_USE_ICONV_H+0 -#else { int i; printf ("\n" "Available character sets:\n"); @@ -175,7 +159,6 @@ help ( printf (" X: Character set has descriptions, use --charsetdesc to see\n"); } -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ printf ("\nReport bugs online at\n<" FRIBIDI_BUGREPORT ">.\n"); exit (0); @@ -259,11 +242,8 @@ main ( {"debug", 0, 0, 'd'}, {"test", 0, 0, 't'}, {"charset", 1, 0, 'c'}, -#if FRIBIDI_MAIN_USE_ICONV_H+0 -#else {"charsetdesc", 1, 0, CHARSETDESC}, {"caprtl", 0, 0, CAPRTL}, -#endif /* FRIBIDI_MAIN_USE_ICONV_H */ {"showinput", 0, (int *) (void *) &show_input, true}, {"nopad", 0, (int *) (void *) &do_pad, false}, {"nobreak", 0, (int *) (void *) &do_break, false}, @@ -333,8 +313,6 @@ main ( if (!char_set) die1 ("memory allocation failed for char_set!"); break; -#if FRIBIDI_MAIN_USE_ICONV_H+0 -#else case CAPRTL: char_set = "CapRTL"; break; @@ -352,7 +330,6 @@ main ( fribidi_char_set_desc (char_set_num)); exit (0); break; -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ case ':': case '?': die2 (NULL, NULL); @@ -362,18 +339,9 @@ main ( } } -#if FRIBIDI_MAIN_USE_ICONV_H+0 - to_ucs4 = iconv_open ("WCHAR_T", char_set); - from_ucs4 = iconv_open (char_set, "WCHAR_T"); -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ char_set_num = fribidi_parse_charset (char_set); -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ -#if FRIBIDI_MAIN_USE_ICONV_H+0 - if (to_ucs4 == (iconv_t) (-1) || from_ucs4 == (iconv_t) (-1)) -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ if (!char_set_num) -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ die2 ("unrecognized character set `%s'\n", char_set); FRIBIDI_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -436,17 +404,7 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS new_line = ""; /* TODO: handle \r */ -#if FRIBIDI_MAIN_USE_ICONV_H+0 - { - char *st = S_, *ust = (char *) logical; - int in_len = (int) len; - len = sizeof logical; - iconv (to_ucs4, &st, &in_len, &ust, (int *) &len); - len = (FriBidiChar *) ust - logical; - } -#else /* !FRIBIDI_MAIN_USE_ICONV_H */ len = fribidi_charset_to_unicode (char_set_num, S_, len, logical); -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ { FriBidiChar *visual; @@ -504,10 +462,7 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS wid = break_width; st = idx; -#if FRIBIDI_MAIN_USE_ICONV_H+0 -#else if (char_set_num != FRIBIDI_CHAR_SET_CAP_RTL) -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ while (wid > 0 && idx < len) { wid -= @@ -516,29 +471,15 @@ FRIBIDI_GNUC_END_IGNORE_DEPRECATIONS : 1; idx++; } -#if FRIBIDI_MAIN_USE_ICONV_H+0 -#else else while (wid > 0 && idx < len) { wid--; idx++; } -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ if (wid < 0 && idx - st > 1) idx--; -#if FRIBIDI_MAIN_USE_ICONV_H+0 - { - char *str = outstring, *ust = - (char *) (visual + st); - int in_len = (idx - st) * sizeof visual[0]; - FriBidiStrIndex new_len = sizeof outstring; - iconv (from_ucs4, &ust, &in_len, &str, - (int *) &new_len); - *str = '\0'; - } -#endif /* !FRIBIDI_MAIN_USE_ICONV_H */ if (FRIBIDI_IS_RTL (base)) printf ("%*s", (int) (do_pad ? (padding_width + -- cgit v1.2.1