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 like a flaw in the article; it can't

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 versions of the C standard allowed the above

Re: JNI problem

2009-10-08 Thread Mohamedin
, Mohamedin - Original Message - From: Christopher Schultz ch...@christopherschultz.net To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, October 07, 2009 8:39 PM Subject: Re: JNI problem -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mohamedin, On 10/7/2009 10:40 AM, Mohamedin

Re: JNI problem

2009-10-08 Thread Konstantin Kolinko
2009/10/8 Mohamedin mohame...@easy-dialog.info: 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,

Re: JNI problem

2009-10-08 Thread Mohamedin
@tomcat.apache.org Sent: Thursday, October 08, 2009 10:37 AM Subject: Re: JNI problem 2009/10/8 Mohamedin mohame...@easy-dialog.info: 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

Re: JNI problem

2009-10-08 Thread Konstantin Kolinko
2009/10/8 Mohamedin mohame...@easy-dialog.info: 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

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 mohame...@easy-dialog.info: 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

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 correction: the operator

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 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 KR book in front of me... besides, it wouldn't cover this case,

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'd item; sizeof

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

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 this

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

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 by me that uses