(trunk libT) fix "dangerous pointer arithmetic" warning detected by clang static analyzer
This commit is contained in:
parent
d8e28ec284
commit
0d593d3254
|
@ -1398,11 +1398,11 @@ jsonStringFunc( const tr_benc * val, void * vdata )
|
||||||
*outwalk++ = *it;
|
*outwalk++ = *it;
|
||||||
else {
|
else {
|
||||||
const UTF8 * tmp = it;
|
const UTF8 * tmp = it;
|
||||||
UTF32 buf = 0;
|
UTF32 buf[1] = { 0 };
|
||||||
UTF32 * u32 = &buf;
|
UTF32 * u32 = buf;
|
||||||
ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, &buf + 1, 0 );
|
ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, buf + 1, 0 );
|
||||||
if((( result==conversionOK ) || (result==targetExhausted)) && (tmp!=it)) {
|
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;
|
it = tmp - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue