RE: [OT] JNI problem

2009-10-09 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: [OT] JNI problem > > C99 probably allows this: > char s[20]; > sizeof s; > > To yield 20, while strict, old-skool C would yield whatever "sizeof > char*" would. Not true; all v

Re: [OT] JNI problem

2009-10-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 10/8/2009 8:27 PM, Caldarale, Charles R wrote: >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Subject: Re: [OT] JNI problem >> >> C99 allows /dynamic/ size determination: > > Sounds

RE: [OT] JNI problem

2009-10-08 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: [OT] JNI problem > > C99 allows /dynamic/ size determination: Sounds like a flaw in the article; it can't possibly be true, since there is no standard-defined API to discover the size of a malloc&

Re: [OT] JNI problem

2009-10-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 10/8/2009 7:24 PM, Caldarale, Charles R wrote: > char array[6]; ... > sizeof array returns 6 This is what I was describing. The Wikipedia article states (I don't have my K&R book in front of me... besides, it wouldn't cover this case, any

Re: JNI problem

2009-10-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mohamedin, On 10/8/2009 5:42 AM, Mohamedin wrote: > I have fixed this bug (Long time without coding in C). But still the > error. You didn't look for all uses of "sizeof": > while((bytes = read(inF, buff, sizeof(buff))) > 0) I think you meant this:

RE: [OT] JNI problem

2009-10-08 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: [OT] JNI problem > > I saw the same thing at first glance, but then I looked-up the sizeof() > operator and it seems that sizeof /can/ return the number of bytes in > an array in C99 Minor correc

Re: [OT] JNI problem

2009-10-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Konstantin, On 10/8/2009 4:37 AM, Konstantin Kolinko wrote: > 2009/10/8 Mohamedin : >> Here is one function that always crash. The portion of the code that couse >> the crash in my opinion is the if which has malloc. I noticed it crash >> whenever it

Re: JNI problem

2009-10-08 Thread Konstantin Kolinko
2009/10/8 Mohamedin : > Thanks a lot > > I have fixed this bug (Long time without coding in C). But still the error. > Then I removed all malloc from the code. Still crashing You are using free(..). Thus you need to have malloc()s somewhere. Also, (void) fprintf(stderr,"%s %s %d %.1024s\n",GetMag

Re: JNI problem

2009-10-08 Thread Mohamedin
ImgFile = (*env)->GetStringUTFChars(env, composeImg, &iscopy); const char *imageFile = (*env)->GetStringUTFChars(env, image, &iscopy); int ret = compose(composeImgFile, imageFile, position, width, height, shiftDirection, shiftAmount); (*env)->ReleaseStringUTFChars(env,

Re: JNI problem

2009-10-08 Thread Konstantin Kolinko
2009/10/8 Mohamedin : > Here is one function that always crash. The portion of the code that couse > the crash in my opinion is the if which has malloc. I noticed it crash > whenever it is called with the same srcFile and dstFile > > int reduce_quality(const char * srcFile, const char * dstFile, in

Re: JNI problem

2009-10-08 Thread Mohamedin
le); (*env)->ReleaseStringUTFChars(env, dst, dstFile); return ret; } Thanks, Mohamedin - Original Message - From: "Christopher Schultz" To: "Tomcat Users List" Sent: Wednesday, October 07, 2009 8:39 PM Subject: Re: JNI problem -BEGIN PGP SIGNED MES

Re: JNI problem

2009-10-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 10/7/2009 8:18 PM, Warnier wrote: > Christopher Schultz wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Mohamedin, >> >> On 10/7/2009 10:40 AM, Mohamedin wrote: >>> Dear all, >>> >>> I am trying to use a JNI library written

Re: JNI problem

2009-10-07 Thread André Warnier
Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mohamedin, On 10/7/2009 10:40 AM, Mohamedin wrote: Dear all, I am trying to use a JNI library written by me that uses GraphicsMagick wand. It is working fine as a stand alone java application but when I tried to use it i

Re: JNI problem

2009-10-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mohamedin, On 10/7/2009 10:40 AM, Mohamedin wrote: > Dear all, > > I am trying to use a JNI library written by me that uses > GraphicsMagick wand. It is working fine as a stand alone java > application but when I tried to use it in tomcat it give me

JNI problem

2009-10-07 Thread Mohamedin
Dear all, I am trying to use a JNI library written by me that uses GraphicsMagick wand. It is working fine as a stand alone java application but when I tried to use it in tomcat it give me this error and tomcat crashed. I am running on: AMD64 Tomcat 6.0.20 CATALINA_OPTS => "-server -Xms512m -X