src/solaris/native/java/io/io_util_md.c

Print this page
rev 8725 : 8024854: Basic changes and files to build the class library on AIX
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan


  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "jni.h"
  27 #include "jni_util.h"
  28 #include "jvm.h"
  29 #include "io_util.h"
  30 #include "io_util_md.h"
  31 #include <string.h>
  32 #include <unistd.h>
  33 
  34 #ifdef __solaris__
  35 #include <sys/filio.h>
  36 #endif
  37 
  38 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
  39 #include <sys/ioctl.h>
  40 #endif
  41 
  42 #ifdef MACOSX
  43 
  44 #include <CoreFoundation/CoreFoundation.h>
  45 
  46 __private_extern__
  47 jstring newStringPlatform(JNIEnv *env, const char* str)
  48 {
  49     jstring rv = NULL;
  50     CFMutableStringRef csref = CFStringCreateMutable(NULL, 0);
  51     if (csref == NULL) {
  52         JNU_ThrowOutOfMemoryError(env, "native heap");
  53     } else {
  54         CFStringAppendCString(csref, str, kCFStringEncodingUTF8);
  55         CFStringNormalize(csref, kCFStringNormalizationFormC);
  56         int clen = CFStringGetLength(csref);
  57         int ulen = (clen + 1) * 2;        // utf16 + zero padding
  58         char* chars = malloc(ulen);




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "jni.h"
  27 #include "jni_util.h"
  28 #include "jvm.h"
  29 #include "io_util.h"
  30 #include "io_util_md.h"
  31 #include <string.h>
  32 #include <unistd.h>
  33 
  34 #ifdef __solaris__
  35 #include <sys/filio.h>
  36 #endif
  37 
  38 #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
  39 #include <sys/ioctl.h>
  40 #endif
  41 
  42 #ifdef MACOSX
  43 
  44 #include <CoreFoundation/CoreFoundation.h>
  45 
  46 __private_extern__
  47 jstring newStringPlatform(JNIEnv *env, const char* str)
  48 {
  49     jstring rv = NULL;
  50     CFMutableStringRef csref = CFStringCreateMutable(NULL, 0);
  51     if (csref == NULL) {
  52         JNU_ThrowOutOfMemoryError(env, "native heap");
  53     } else {
  54         CFStringAppendCString(csref, str, kCFStringEncodingUTF8);
  55         CFStringNormalize(csref, kCFStringNormalizationFormC);
  56         int clen = CFStringGetLength(csref);
  57         int ulen = (clen + 1) * 2;        // utf16 + zero padding
  58         char* chars = malloc(ulen);