This is the mail archive of the java-patches@gcc.gnu.org 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


>>>>> "Mohan" == Mohan Embar <gnustuff@thisiscool.com> writes:

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?  And
change it to _Jv_TempUTFString.  I think we want to be explicit about
the UTF, we'll probably want another version that converts to the
default encoding.

As for the function, it can definitely go in cni.h.  However, you'll
also need to update gcj.texi to document it.  Shouldn't we call it
"JvGetStringUTFChars"?

Mohan> +  operator const char*() const  {return buf_;}

These should be formatted like:

    operator const char*() const
    {
      return buf_;
    }

Mohan> +inline JvTempCString::JvTempCString (jstring jstr):
Mohan> +  buf_(0)

The ":" should be on the next line.

    inline JvTempCString::JvTempCString (jstring jstr)
      : buf_(0)

Mohan> +  if (len < jsize(sizeof(stackbuf_)-1))
Mohan> +    {
Mohan> +      buf_ = stackbuf_;
Mohan> +    }

And there's no need to put braces around a single statement.

Tom


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