summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-12-07 16:16:36 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-12-07 22:14:22 +0100
commit85b5253492cd1c87cebc98d4c453812562a2f9ef (patch)
tree249445f9c98672ad694021922af9becabd1c82ed
parentc29b89acc59f5913068f60d670e72918121e4e84 (diff)
clang-tidy(WIP): bugprone-signed-char-misuse findings 1
Use unsigned char conversion instead of adding 256 to negativ values. See also: SEI CERT STR34-C. Change-Id: I9a167a8993505052f9ee4f41191fbe80ee1ab0eb Reviewed-on: https://gerrit.libreoffice.org/84688 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx10
1 files changed, 2 insertions, 8 deletions
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index a29277078810..fe1db432f284 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -167,11 +167,7 @@ jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key )
}
else
{
- sal_Int32 tmpInt = aData[0];
- if (tmpInt < 0 )
- tmpInt = 256 +tmpInt;
-
- return tmpInt;
+ return static_cast<unsigned char>(aData[0]);;
}
}
return -1;
@@ -306,9 +302,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nativ
Sequence< sal_Int32 > ch(4);
for(sal_Int32 i = 0;i < 4; ++i)
{
- ch[i] = aData[i];
- if (ch[i] < 0 )
- ch[i] = 256 + ch[i];
+ ch[i] = static_cast<unsigned char>(aData[i]);
}
if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0)