On Thu, 19 Aug 2021 07:23:19 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Shouldn't it be better to call CHECK_EXCEPTION_NULL_RETURN()

If the jstring were garbage in such a case we would NOT want to check it 
against null, since
that would be a definite problem.

As it is NewString is specified to return NULL if there is a problem so the 
existing code is fine although the alternative pattern of 
CHECK_EXCEPTION_NULL_RETURN(jstr, NULL) would also work.

SInce I'm not changing this I think it fine to stick with the existing code.

>> the buffer must be large enough...aRange.length*sizeof(unichar) so shouldn't 
>> the NSRange be created for
(0, len * sizeof(unichar))

The buffer *is* large enough

buffer = (unichar*) calloc(len, sizeof(unichar));

the NSRange is the *number of elements* to copy. It is not the buffer storage

-------------

PR: https://git.openjdk.java.net/jdk/pull/5177

Reply via email to