Creating Java strings: don't include null char in length count

git-svn-id: svn://10.0.0.236/trunk@1151 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
selmer
1998-05-05 20:35:13 +00:00
parent ed863f453a
commit c7623e9c1a
2 changed files with 4 additions and 2 deletions

View File

@@ -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);

View File

@@ -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);