зеркало из https://github.com/mozilla/gecko-dev.git
Creating Java strings: don't include null char in length count
This commit is contained in:
Родитель
98203d21ad
Коммит
5d338236b0
|
@ -209,7 +209,8 @@ native_netscape_npasw_SetupPlugin_SECURE_0005fGetNameValuePair(JRIEnv *env,
|
|||
|
||||
ret = GetPrivateProfileString(section, name, "", buf, INI_BUFFER_SIZE, file);
|
||||
|
||||
len = (short)ret + 1;
|
||||
// len = (short)ret + 1; // This appears to be incorrect, causes null char in string
|
||||
len = (short)ret;
|
||||
}
|
||||
|
||||
value = JRI_NewStringPlatform(env, buf, len, NULL, 0);
|
||||
|
|
|
@ -522,7 +522,8 @@ java_lang_String * getRegElement(JRIEnv *env,
|
|||
}
|
||||
|
||||
|
||||
long length = 1 + strlen(value); // 1 extra for the null char
|
||||
// long length = 1 + strlen(value); // 1 extra for the null char -- WRONG!
|
||||
long length = strlen(value);
|
||||
|
||||
if (extendLen == TRUE) {
|
||||
rtnValue = (char *)malloc(sizeof(char) * length);
|
||||
|
|
Загрузка…
Ссылка в новой задаче