This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for Review: JvGetStringUTF and JvTempCString

On Sunday, Aug 10, 2003, at 14:50 Pacific/Auckland, Mohan Embar wrote:

Hi Tom,

Mohan> 	* gcj/cni.h: Added function JvGetStringUTF (puts and null
Mohan> 	terminates a jstring into a character buffer) and class
Mohan> 	JvTempCString (helper class for getting a temporary C string
Mohan> 	from a jstring)

Sorry for yet another go around on this...

I'm not ready to put this class in cni.h yet. How about jvm.h?

I coded this all up, but jvm.h is internal to libgcj and doesn't end up in the final installation :(. This would mean that this helper class wouldn't be usable anywhere other than within libgcj.

Hi Mohan,

Sorry if I missed earlier discussion on this. What is the rationale for adding these? I don't like JvGetStringUTF because it is unsafe - it knows nothing about the size of the buffer it is writing into. I think a variant which accepts the buffer size as an argument, and makes sure not to overrun it, would be better.

As for JvTempCString, do you have an example of when this is needed? What is wrong with, in client code, simply using JvGetStringUTF into a stack allocated buffer? I think it is better to keep CNI simple unless there is a compelling reason to have this.

What about gcj/javaprims.h?

gcj/cni.h is the place to put things which are to be part of the public CNI interface.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]