[Libreoffice-commits] core.git: connectivity/source
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 7 21:15:12 UTC 2019
connectivity/source/drivers/hsqldb/HStorageAccess.cxx | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
New commits:
commit 85b5253492cd1c87cebc98d4c453812562a2f9ef
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sat Dec 7 16:16:36 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Dec 7 22:14:22 2019 +0100
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 at collabora.com>
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)
More information about the Libreoffice-commits
mailing list