Author: rjung Date: Thu Mar 12 15:03:31 2015 New Revision: 1666217 URL: http://svn.apache.org/r1666217 Log: Backport of r1650304 from trunk:
Remove zero-boundary-check on String length argument, as this argument is unsigned and can therefore never be less than zero. Removes a compiler warning and simplifies the code a bit. Modified: tomcat/native/branches/1.1.x/ (props changed) tomcat/native/branches/1.1.x/native/src/jnilib.c Propchange: tomcat/native/branches/1.1.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 12 15:03:31 2015 @@ -1,3 +1,3 @@ -/tomcat/native/trunk:815411,1342003,1342008,1342013,1342020,1342024,1394258,1394342,1424947,1424971,1430753,1437081,1438342,1439337,1441884,1441886,1442579,1442581,1445972,1507113,1532577,1532590,1539594,1555184,1559180,1588195,1607262,1607267,1607278,1607291,1607477,1648821,1650119,1658557,1658641-1658642,1658724 +/tomcat/native/trunk:815411,1342003,1342008,1342013,1342020,1342024,1394258,1394342,1424947,1424971,1430753,1437081,1438342,1439337,1441884,1441886,1442579,1442581,1445972,1507113,1532577,1532590,1539594,1555184,1559180,1588195,1607262,1607267,1607278,1607291,1607477,1648821,1650119,1650304,1658557,1658641-1658642,1658724 /tomcat/tc7.0.x/trunk:1199985,1200164,1349932,1434887,1435769 /tomcat/trunk:815418,832198,1001939,1033916,1043103,1044729,1078522,1145209,1145285,1149092,1241356,1241406-1241407,1242254,1292671,1299980,1300102,1434905,1437083 Modified: tomcat/native/branches/1.1.x/native/src/jnilib.c URL: http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/jnilib.c?rev=1666217&r1=1666216&r2=1666217&view=diff ============================================================================== --- tomcat/native/branches/1.1.x/native/src/jnilib.c (original) +++ tomcat/native/branches/1.1.x/native/src/jnilib.c Thu Mar 12 15:03:31 2015 @@ -120,18 +120,15 @@ jstring tcn_new_stringn(JNIEnv *env, con { jstring result; jbyteArray bytes = 0; - size_t len = l; if (!str) return NULL; if ((*env)->EnsureLocalCapacity(env, 2) < 0) { return NULL; /* out of memory error */ } - if (l < 0) - len = strlen(str); - bytes = (*env)->NewByteArray(env, (jsize)len); + bytes = (*env)->NewByteArray(env, l); if (bytes != NULL) { - (*env)->SetByteArrayRegion(env, bytes, 0, (jint)len, (jbyte *)str); + (*env)->SetByteArrayRegion(env, bytes, 0, l, (jbyte *)str); result = (*env)->NewObject(env, jString_class, jString_init, bytes); (*env)->DeleteLocalRef(env, bytes); return result; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org