From 0d593d3254fd11ad2db80d5527a59849326f482d Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 31 Mar 2011 04:24:57 +0000 Subject: [PATCH] (trunk libT) fix "dangerous pointer arithmetic" warning detected by clang static analyzer --- libtransmission/bencode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libtransmission/bencode.c b/libtransmission/bencode.c index f582496f2..2b06f8420 100644 --- a/libtransmission/bencode.c +++ b/libtransmission/bencode.c @@ -1398,11 +1398,11 @@ jsonStringFunc( const tr_benc * val, void * vdata ) *outwalk++ = *it; else { const UTF8 * tmp = it; - UTF32 buf = 0; - UTF32 * u32 = &buf; - ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, &buf + 1, 0 ); + UTF32 buf[1] = { 0 }; + UTF32 * u32 = buf; + ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, buf + 1, 0 ); if((( result==conversionOK ) || (result==targetExhausted)) && (tmp!=it)) { - outwalk += tr_snprintf( outwalk, outend-outwalk, "\\u%04x", (unsigned int)buf ); + outwalk += tr_snprintf( outwalk, outend-outwalk, "\\u%04x", (unsigned int)buf[0] ); it = tmp - 1; } }