diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-06-21 23:55:00 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-06-22 07:44:58 +0000 |
commit | 590d0a483e58abb8d2a88c83fe7ad3ac690fb9cc (patch) | |
tree | 3e61f73385036c54b176ebd85dc4831680bca8b8 /wiretap | |
parent | edc2bebcecbdfdf21e7b48869d28cc1ca562846f (diff) |
Declare lead_surrogate only in the block where it's used.
That makes it a bit clearer that we don't need to initialize it to zero
before the loop.
This fixes a Dead Store (Dead assignement/Dead increment) Warning found
by Clang.
Change-Id: Iabfc4b47a3c6300814492c37ccfb321afd0c54ea
Reviewed-on: https://code.wireshark.org/review/28374
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/netmon.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 54ec96734c..20f189aa93 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -235,7 +235,7 @@ static guint8 * utf_16_to_utf_8(const guint8 *in, guint32 length) { guint8 *result, *out; - gunichar2 uchar2, lead_surrogate; + gunichar2 uchar2; gunichar uchar; size_t n_bytes; guint32 i; @@ -245,7 +245,6 @@ utf_16_to_utf_8(const guint8 *in, guint32 length) * the input string in the process. */ n_bytes = 0; - lead_surrogate = 0; for (i = 0; i + 1 < length && (uchar2 = pletoh16(in + i)) != '\0'; i += 2) { if (IS_LEAD_SURROGATE(uchar2)) { @@ -253,6 +252,8 @@ utf_16_to_utf_8(const guint8 *in, guint32 length) * Lead surrogate. Must be followed by a trail * surrogate. */ + gunichar2 lead_surrogate; + i += 2; if (i + 1 >= length) { /* @@ -311,7 +312,6 @@ utf_16_to_utf_8(const guint8 *in, guint32 length) */ result = (guint8 *)g_malloc(n_bytes + 1); - lead_surrogate = 0; out = result; for (i = 0; i + 1 < length && (uchar2 = pletoh16(in + i)) != '\0'; i += 2) { @@ -320,6 +320,8 @@ utf_16_to_utf_8(const guint8 *in, guint32 length) * Lead surrogate. Must be followed by a trail * surrogate. */ + gunichar2 lead_surrogate; + i += 2; if (i + 1 >= length) { /* |