Null-terminated Unicode strings in java.io on Windows
Mark Wielaard
mark at klomp.org
Fri Jan 25 14:40:18 UTC 2008
Hi Roman,
Roman Kennke <roman.kennke at ...> writes:
> Hmm, I'm not talking about fixing the spec (I've read that bug report
> while searching for clarfication on the spec actually). When the spec
> doesn't tell _that_ the returned array is zero terminated, I think we
> should assume that it isn't (and it seems to be the trend that the spec
> should be clarfied by saying that an implementation isn't required to
> return a zero-terminated array, but this is only speculation). What I'm
> asking is, should we fix the java.io C code to deal with
> non-zero-terminated jchar arrays? Unfortunately, this probably means
> allocating additional buffers, because we really need zero terminated
> strings here (AFAICS).
If you rewrite WITH_UNICODE_STRING to not use the runtime to allocate and
deallocate the jchar array through GetStringChars and ReleaseStringChars but
allocate and deallocate the jchar arrray yourself using GetStringLength (+ 1)
and then fill it through GetStringRegion() it looks like you don't really need
to allocate any additional buffers.
Cheers,
Mark
More information about the core-libs-dev
mailing list