Patch for Review: JvGetStringUTF and JvTempCString

Tom Tromey tromey@redhat.com
Fri Aug 8 16:18:00 GMT 2003


>>>>> "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



More information about the Java-patches mailing list