From 498668223e938f438c4ef64b097ddc5710ba0a25 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 10 Apr 2016 09:54:20 +0000 Subject: more accurate way to prevent Chinese in db_get_tstatic git-svn-id: http://svn.miranda-ng.org/main/trunk@16622 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbsettings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index a1e89cb4d4..c12a0e0d3e 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -349,10 +349,11 @@ STDMETHODIMP_(BOOL) CDb3Mmap::GetContactSettingStatic(MCONTACT contactID, LPCSTR if (bNeedsWchars) { char *pBuf = NEWSTR_ALLOCA(dbv->pszVal); - if (Utf8toUcs2(pBuf, dbv->cchVal, dbv->pwszVal, cbSaved) < 0) + int cbLen = Utf8toUcs2(pBuf, dbv->cchVal, dbv->pwszVal, cbSaved); + if (cbLen < 0) return 1; - dbv->pwszVal[cbSaved] = 0; + dbv->pwszVal[cbLen] = 0; } else if (dbv->type == DBVT_UTF8) { mir_utf8decode(dbv->pszVal, NULL); -- cgit v1.2.3