mturk       2005/05/31 23:33:37

  Modified:    jni/native/src jnilib.c
  Log:
  Change String creation to allow creating without terminating NUL.
  
  Revision  Changes    Path
  1.8       +5 -5      jakarta-tomcat-connectors/jni/native/src/jnilib.c
  
  Index: jnilib.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/jnilib.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- jnilib.c  30 May 2005 06:17:14 -0000      1.7
  +++ jnilib.c  1 Jun 2005 06:33:37 -0000       1.8
  @@ -88,17 +88,17 @@
       apr_terminate();
   }
   
  -jstring tcn_new_string(JNIEnv *env, const char *str)
  +jstring tcn_new_string(JNIEnv *env, const char *str, int l)
   {
       jstring result;
       jbyteArray bytes = 0;
  -    size_t len;
  +    size_t len = l;
   
       if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
           return NULL; /* out of memory error */
       }
  -
  -    len = strlen(str);
  +    if (l < 0)
  +        len = strlen(str);
       bytes = (*env)->NewByteArray(env, (jsize)len);
       if (bytes != NULL) {
           (*env)->SetByteArrayRegion(env, bytes, 0, (jint)len, (jbyte *)str);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to