changeset 10084:b2023f11a0e5

8041498: Remove npt library Summary: Get rid of npt library and move utf-related code to share/backend Reviewed-by: sla
author dsamersoff
date Mon, 16 Jun 2014 07:25:11 -0700
parents 7790a9e0f168
children c5e7ba8e1d4b
files make/CompileDemos.gmk make/lib/CoreLibraries.gmk make/lib/ServiceabilityLibraries.gmk make/mapfiles/libnpt/mapfile-vers make/profile-includes.txt src/share/back/debugInit.c src/share/back/error_messages.c src/share/back/inStream.c src/share/back/outStream.c src/share/back/transport.c src/share/back/utf_util.c src/share/back/utf_util.h src/share/back/util.h src/share/demo/jvmti/hprof/hprof.h src/share/demo/jvmti/hprof/hprof_init.c src/share/npt/README.txt src/share/npt/npt.c src/share/npt/npt.h src/share/npt/utf.c src/share/npt/utf.h src/solaris/npt/npt_md.h src/solaris/npt/utf_md.c src/solaris/npt/utf_md.h src/windows/npt/npt_md.h src/windows/npt/utf_md.c src/windows/npt/utf_md.h
diffstat 26 files changed, 608 insertions(+), 1533 deletions(-) [+]
line wrap: on
line diff
--- a/make/CompileDemos.gmk	Mon Jun 16 13:40:49 2014 +0100
+++ b/make/CompileDemos.gmk	Mon Jun 16 07:25:11 2014 -0700
@@ -1,6 +1,5 @@
-
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -320,7 +319,6 @@
 endif
 
 $(eval $(call SetupJVMTIDemo,hprof, java_crw_demo, \
-    -I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
     $(BUILD_LIBHPROF_AIX_EXTRA_CFLAGS), C, \
     -ldl, ws2_32.lib winmm.lib, -lsocket -lnsl, -lpthread, $(BUILD_LIBHPROF_AIX_EXTRA_SRC)))
 
--- a/make/lib/CoreLibraries.gmk	Mon Jun 16 13:40:49 2014 +0100
+++ b/make/lib/CoreLibraries.gmk	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -526,30 +526,3 @@
   BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
 
 endif
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \
-    LIBRARY := npt, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
-    LANG := C, \
-    OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) \
-        -I$(JDK_TOPDIR)/src/share/npt \
-        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
-    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnpt/mapfile-vers, \
-    LDFLAGS := $(LDFLAGS_JDKLIB) \
-        $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_macosx := -liconv, \
-    LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \
-    LDFLAGS_SUFFIX_solaris := -lc, \
-    VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=npt.dll" \
-        -D "JDK_INTERNAL_NAME=npt" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \
-    DEBUG_SYMBOLS := true))
-
-BUILD_LIBRARIES += $(BUILD_LIBNPT)
--- a/make/lib/ServiceabilityLibraries.gmk	Mon Jun 16 13:40:49 2014 +0100
+++ b/make/lib/ServiceabilityLibraries.gmk	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -147,8 +147,6 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \
         -I$(JDK_TOPDIR)/src/share/transport/export \
         -I$(JDK_TOPDIR)/src/share/back/export \
-        -I$(JDK_TOPDIR)/src/share/npt \
-        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
         -I$(JDK_TOPDIR)/src/share/back \
         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
         -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \
@@ -158,6 +156,7 @@
     LDFLAGS_SUFFIX_linux := $(LIBDL), \
     LDFLAGS_SUFFIX_solaris := $(LIBDL) -lc, \
     LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
+    LDFLAGS_SUFFIX_macosx := -liconv, \
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=jdwp.dll" \
@@ -340,8 +339,6 @@
 
 BUILD_LIBHPROF_SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
 BUILD_LIBHPROF_CFLAGS := -I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
-    -I$(JDK_TOPDIR)/src/share/npt \
-    -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
     -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo
 
 ifeq ($(OPENJDK_TARGET_OS), aix)
--- a/make/mapfiles/libnpt/mapfile-vers	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# Define public interface.
-
-SUNWprivate_1.1 {
-	global:
-	    nptInitialize;
-	    nptTerminate;
-	local:
-	    *;
-};
--- a/make/profile-includes.txt	Mon Jun 16 13:40:49 2014 +0100
+++ b/make/profile-includes.txt	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,8 +127,6 @@
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
     jvm.hprof.txt \
--- a/src/share/back/debugInit.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/debugInit.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -202,8 +202,6 @@
     jint              jvmtiCompileTimeMajorVersion;
     jint              jvmtiCompileTimeMinorVersion;
     jint              jvmtiCompileTimeMicroVersion;
-    char              *boot_path = NULL;
-    char              npt_lib[MAXPATHLEN];
 
     /* See if it's already loaded */
     if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) {
@@ -268,24 +266,6 @@
         forceExit(1); /* Kill entire process, no core dump wanted */
     }
 
-    JVMTI_FUNC_PTR(gdata->jvmti, GetSystemProperty)
-        (gdata->jvmti, (const char *)"sun.boot.library.path",
-         &boot_path);
-
-    dbgsysBuildLibName(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
-    /* Npt and Utf function init */
-    NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
-    jvmtiDeallocate(boot_path);
-    if (gdata->npt == NULL) {
-        ERROR_MESSAGE(("JDWP: unable to initialize NPT library"));
-        return JNI_ERR;
-    }
-    gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
-    if (gdata->npt->utf == NULL) {
-        ERROR_MESSAGE(("JDWP: UTF function initialization failed"));
-        return JNI_ERR;
-    }
-
     /* Parse input options */
     if (!parseOptions(options)) {
         /* No message necessary, should have been printed out already */
--- a/src/share/back/error_messages.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/error_messages.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
 #include <errno.h>
 
 #include "util.h"
+#include "utf_util.h"
 #include "proc_md.h"
 
 /* Maximim length of a message */
@@ -70,13 +71,8 @@
     len = (int)strlen((char*)utf8buf);
 
     /* Convert to platform encoding (ignore errors, dangerous area) */
-    if (gdata->npt != NULL) {
-        (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
-               utf8buf, len, pbuf, MAX_MESSAGE_LEN);
-    } else {
-        /* May be called before NPT is initialized so don't fault */
-        strncpy(pbuf, (char*)utf8buf, len);
-    }
+    (void)utf8ToPlatform(utf8buf, len, pbuf, MAX_MESSAGE_LEN);
+
     (void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix);
 }
 
--- a/src/share/back/inStream.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/inStream.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  */
 
 #include "util.h"
+#include "utf_util.h"
 #include "stream.h"
 #include "inStream.h"
 #include "transport.h"
@@ -379,15 +380,12 @@
         string[length] = '\0';
 
         /* This is Standard UTF-8, convert to Modified UTF-8 if necessary */
-        new_length = (gdata->npt->utf8sToUtf8mLength)
-                             (gdata->npt->utf, (jbyte*)string, length);
+        new_length = utf8sToUtf8mLength((jbyte*)string, length);
         if ( new_length != length ) {
             char *new_string;
 
             new_string = jvmtiAllocate(new_length+1);
-            (gdata->npt->utf8sToUtf8m)
-                             (gdata->npt->utf, (jbyte*)string, length,
-                              (jbyte*)new_string, new_length);
+            utf8sToUtf8m((jbyte*)string, length, (jbyte*)new_string, new_length);
             jvmtiDeallocate(string);
             return new_string;
         }
--- a/src/share/back/outStream.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/outStream.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  */
 
 #include "util.h"
+#include "utf_util.h"
 #include "stream.h"
 #include "outStream.h"
 #include "inStream.h"
@@ -307,8 +308,7 @@
     } else {
         jint      new_length;
 
-        new_length = (gdata->npt->utf8mToUtf8sLength)
-                            (gdata->npt->utf, (jbyte*)string, length);
+        new_length = utf8mToUtf8sLength((jbyte*)string, length);
         if ( new_length == length ) {
             (void)outStream_writeInt(stream, length);
             error = writeBytes(stream, (jbyte *)string, length);
@@ -316,9 +316,7 @@
             char *new_string;
 
             new_string = jvmtiAllocate(new_length+1);
-            (gdata->npt->utf8mToUtf8s)
-                            (gdata->npt->utf, (jbyte*)string, length,
-                             (jbyte*)new_string, new_length);
+            utf8mToUtf8s((jbyte*)string, length, (jbyte*)new_string, new_length);
             (void)outStream_writeInt(stream, new_length);
             error = writeBytes(stream, (jbyte *)new_string, new_length);
             jvmtiDeallocate(new_string);
--- a/src/share/back/transport.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/transport.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  */
 
 #include "util.h"
+#include "utf_util.h"
 #include "transport.h"
 #include "debugLoop.h"
 #include "sys.h"
@@ -65,8 +66,7 @@
         len = (int)strlen(msg);
         maxlen = len+len/2+2; /* Should allow for plenty of room */
         utf8msg = (jbyte*)jvmtiAllocate(maxlen+1);
-        (void)(gdata->npt->utf8FromPlatform)(gdata->npt->utf,
-            msg, len, utf8msg, maxlen);
+        (void)utf8FromPlatform(msg, len, utf8msg, maxlen);
         utf8msg[maxlen] = 0;
     }
     if (rv == JDWPTRANSPORT_ERROR_NONE) {
@@ -110,8 +110,7 @@
         int  len;
 
         len = (int)strlen(libdir);
-        (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
-            (jbyte*)libdir, len, buf, (int)sizeof(buf));
+        (void)utf8ToPlatform((jbyte*)libdir, len, buf, (int)sizeof(buf));
         plibdir = buf;
     }
 
@@ -392,8 +391,7 @@
     /* Convert commandLine from UTF-8 to platform encoding */
     len = (int)strlen(commandLine);
     buf = jvmtiAllocate(len*3+3);
-    (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
-        (jbyte*)commandLine, len, buf, len*3+3);
+    (void)utf8ToPlatform((jbyte*)commandLine, len, buf, len*3+3);
 
     /* Exec commandLine */
     rc = dbgsysExec(buf);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/back/utf_util.c	Mon Jun 16 07:25:11 2014 -0700
@@ -0,0 +1,540 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "jni.h"
+
+#include "utf_util.h"
+
+
+/* Error and assert macros */
+#define UTF_ERROR(m) utfError(__FILE__, __LINE__,  m)
+#define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 )
+
+// Platform independed part
+
+static void utfError(char *file, int line, char *message) {
+    (void)fprintf(stderr, "UTF ERROR [\"%s\":%d]: %s\n", file, line, message);
+    abort();
+}
+
+/* Determine length of this Standard UTF-8 in Modified UTF-8.
+ *    Validation is done of the basic UTF encoding rules, returns
+ *    length (no change) when errors are detected in the UTF encoding.
+ *
+ *    Note: Accepts Modified UTF-8 also, no verification on the
+ *          correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok.
+ */
+int JNICALL utf8sToUtf8mLength(jbyte *string, int length) {
+  int newLength;
+  int i;
+
+  newLength = 0;
+  for ( i = 0 ; i < length ; i++ ) {
+    unsigned byte;
+
+    byte = (unsigned char)string[i];
+    if ( (byte & 0x80) == 0 ) { /* 1byte encoding */
+      newLength++;
+      if ( byte == 0 ) {
+        newLength++; /* We gain one byte in length on NULL bytes */
+      }
+    } else if ( (byte & 0xE0) == 0xC0 ) { /* 2byte encoding */
+      /* Check encoding of following bytes */
+      if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) {
+        break; /* Error condition */
+      }
+      i++; /* Skip next byte */
+      newLength += 2;
+    } else if ( (byte & 0xF0) == 0xE0 ) { /* 3byte encoding */
+      /* Check encoding of following bytes */
+      if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80
+        || (string[i+2] & 0xC0) != 0x80 ) {
+        break; /* Error condition */
+        }
+        i += 2; /* Skip next two bytes */
+        newLength += 3;
+    } else if ( (byte & 0xF8) == 0xF0 ) { /* 4byte encoding */
+      /* Check encoding of following bytes */
+      if ( (i+3) >= length || (string[i+1] & 0xC0) != 0x80
+        || (string[i+2] & 0xC0) != 0x80
+        || (string[i+3] & 0xC0) != 0x80 ) {
+        break; /* Error condition */
+        }
+        i += 3; /* Skip next 3 bytes */
+        newLength += 6; /* 4byte encoding turns into 2 3byte ones */
+    } else {
+      break; /* Error condition */
+    }
+  }
+  if ( i != length ) {
+    /* Error in finding new length, return old length so no conversion */
+    /* FIXUP: ERROR_MESSAGE? */
+    return length;
+  }
+  return newLength;
+}
+
+/* Convert Standard UTF-8 to Modified UTF-8.
+ *    Assumes the UTF-8 encoding was validated by utf8mLength() above.
+ *
+ *    Note: Accepts Modified UTF-8 also, no verification on the
+ *          correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok.
+ */
+void JNICALL utf8sToUtf8m(jbyte *string, int length, jbyte *newString, int newLength) {
+    int i;
+    int j;
+
+    j = 0;
+    for ( i = 0 ; i < length ; i++ ) {
+        unsigned byte1;
+
+        byte1 = (unsigned char)string[i];
+
+        /* NULL bytes and bytes starting with 11110xxx are special */
+        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
+            if ( byte1 == 0 ) {
+                /* Bits out: 11000000 10000000 */
+                newString[j++] = (jbyte)0xC0;
+                newString[j++] = (jbyte)0x80;
+            } else {
+                /* Single byte */
+                newString[j++] = byte1;
+            }
+        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
+            newString[j++] = byte1;
+            newString[j++] = string[++i];
+        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
+            newString[j++] = byte1;
+            newString[j++] = string[++i];
+            newString[j++] = string[++i];
+        } else if ( (byte1 & 0xF8) == 0xF0 ) { /* 4byte encoding */
+            /* Beginning of 4byte encoding, turn into 2 3byte encodings */
+            unsigned byte2, byte3, byte4, u21;
+
+            /* Bits in: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
+            byte2 = (unsigned char)string[++i];
+            byte3 = (unsigned char)string[++i];
+            byte4 = (unsigned char)string[++i];
+            /* Reconstruct full 21bit value */
+            u21  = (byte1 & 0x07) << 18;
+            u21 += (byte2 & 0x3F) << 12;
+            u21 += (byte3 & 0x3F) << 6;
+            u21 += (byte4 & 0x3F);
+            /* Bits out: 11101101 1010xxxx 10xxxxxx */
+            newString[j++] = (jbyte)0xED;
+            newString[j++] = (jbyte)(0xA0 + (((u21 >> 16) - 1) & 0x0F));
+            newString[j++] = (jbyte)(0x80 + ((u21 >> 10) & 0x3F));
+            /* Bits out: 11101101 1011xxxx 10xxxxxx */
+            newString[j++] = (jbyte)0xED;
+            newString[j++] = (jbyte)(0xB0 + ((u21 >>  6) & 0x0F));
+            newString[j++] = byte4;
+        }
+    }
+    UTF_ASSERT(i==length);
+    UTF_ASSERT(j==newLength);
+    newString[j] = (jbyte)0;
+}
+
+/* Given a Modified UTF-8 string, calculate the Standard UTF-8 length.
+ *   Basic validation of the UTF encoding rules is done, and length is
+ *   returned (no change) when errors are detected.
+ *
+ *   Note: No validation is made that this is indeed Modified UTF-8 coming in.
+ *
+ */
+int JNICALL utf8mToUtf8sLength(jbyte *string, int length) {
+    int newLength;
+    int i;
+
+    newLength = 0;
+    for ( i = 0 ; i < length ; i++ ) {
+        unsigned byte1, byte2, byte3, byte4, byte5, byte6;
+
+        byte1 = (unsigned char)string[i];
+        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
+            newLength++;
+        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
+            /* Check encoding of following bytes */
+            if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) {
+                break; /* Error condition */
+            }
+            byte2 = (unsigned char)string[++i];
+            if ( byte1 != 0xC0 || byte2 != 0x80 ) {
+                newLength += 2; /* Normal 2byte encoding, not 0xC080 */
+            } else {
+                newLength++;    /* We will turn 0xC080 into 0 */
+            }
+        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
+            /* Check encoding of following bytes */
+            if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80
+                                 || (string[i+2] & 0xC0) != 0x80 ) {
+                break; /* Error condition */
+            }
+            byte2 = (unsigned char)string[++i];
+            byte3 = (unsigned char)string[++i];
+            newLength += 3;
+            /* Possible process a second 3byte encoding */
+            if ( (i+3) < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
+                /* See if this is a pair of 3byte encodings */
+                byte4 = (unsigned char)string[i+1];
+                byte5 = (unsigned char)string[i+2];
+                byte6 = (unsigned char)string[i+3];
+                if ( byte4 == 0xED && (byte5 & 0xF0) == 0xB0 ) {
+                    /* Check encoding of 3rd byte */
+                    if ( (byte6 & 0xC0) != 0x80 ) {
+                        break; /* Error condition */
+                    }
+                    newLength++; /* New string will have 4byte encoding */
+                    i += 3;       /* Skip next 3 bytes */
+                }
+            }
+        } else {
+            break; /* Error condition */
+        }
+    }
+    if ( i != length ) {
+        /* Error in UTF encoding */
+        /*  FIXUP: ERROR_MESSAGE()? */
+        return length;
+    }
+    return newLength;
+}
+
+/* Convert a Modified UTF-8 string into a Standard UTF-8 string
+ *   It is assumed that this string has been validated in terms of the
+ *   basic UTF encoding rules by utf8Length() above.
+ *
+ *   Note: No validation is made that this is indeed Modified UTF-8 coming in.
+ *
+ */
+void JNICALL utf8mToUtf8s(jbyte *string, int length, jbyte *newString, int newLength) {
+    int i;
+    int j;
+
+    j = 0;
+    for ( i = 0 ; i < length ; i++ ) {
+        unsigned byte1, byte2, byte3, byte4, byte5, byte6;
+
+        byte1 = (unsigned char)string[i];
+        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
+            /* Single byte */
+            newString[j++] = byte1;
+        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
+            byte2 = (unsigned char)string[++i];
+            if ( byte1 != 0xC0 || byte2 != 0x80 ) {
+                newString[j++] = byte1;
+                newString[j++] = byte2;
+            } else {
+                newString[j++] = 0;
+            }
+        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
+            byte2 = (unsigned char)string[++i];
+            byte3 = (unsigned char)string[++i];
+            if ( i+3 < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
+                /* See if this is a pair of 3byte encodings */
+                byte4 = (unsigned char)string[i+1];
+                byte5 = (unsigned char)string[i+2];
+                byte6 = (unsigned char)string[i+3];
+                if ( byte4 == 0xED && (byte5 & 0xF0) == 0xB0 ) {
+                    unsigned u21;
+
+                    /* Bits in: 11101101 1010xxxx 10xxxxxx */
+                    /* Bits in: 11101101 1011xxxx 10xxxxxx */
+                    i += 3;
+
+                    /* Reconstruct 21 bit code */
+                    u21  = ((byte2 & 0x0F) + 1) << 16;
+                    u21 += (byte3 & 0x3F) << 10;
+                    u21 += (byte5 & 0x0F) << 6;
+                    u21 += (byte6 & 0x3F);
+
+                    /* Bits out: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
+
+                    /* Convert to 4byte encoding */
+                    newString[j++] = 0xF0 + ((u21 >> 18) & 0x07);
+                    newString[j++] = 0x80 + ((u21 >> 12) & 0x3F);
+                    newString[j++] = 0x80 + ((u21 >>  6) & 0x3F);
+                    newString[j++] = 0x80 + (u21 & 0x3F);
+                    continue;
+                }
+            }
+            /* Normal 3byte encoding */
+            newString[j++] = byte1;
+            newString[j++] = byte2;
+            newString[j++] = byte3;
+        }
+    }
+    UTF_ASSERT(i==length);
+    UTF_ASSERT(j==newLength);
+    newString[j] = 0;
+}
+
+#ifdef _WIN32
+// Microsoft Windows specific part
+
+#include <windows.h>
+
+static UINT getCodepage() {
+    LANGID langID;
+    LCID localeID;
+    TCHAR strCodePage[7];       // ANSI code page id
+
+    static UINT intCodePage = -1;
+
+    if (intCodePage == -1) {
+        // Firts call, get codepage from the os
+        langID = LANGIDFROMLCID(GetUserDefaultLCID());
+        localeID = MAKELCID(langID, SORT_DEFAULT);
+        if (GetLocaleInfo(localeID, LOCALE_IDEFAULTANSICODEPAGE,
+                         strCodePage, sizeof(strCodePage)/sizeof(TCHAR)) > 0 ) {
+            intCodePage = atoi(strCodePage);
+        }
+        else {
+            intCodePage = GetACP();
+        }
+    }
+
+    return intCodePage;
+}
+
+/*
+ * Get wide string  (assumes len>0)
+ */
+static WCHAR* getWideString(UINT codePage, char* str, int len, int *pwlen) {
+    int wlen;
+    WCHAR* wstr;
+
+    /* Convert the string to WIDE string */
+    wlen = MultiByteToWideChar(codePage, 0, str, len, NULL, 0);
+    *pwlen = wlen;
+    if (wlen <= 0) {
+        UTF_ERROR(("Can't get WIDE string length"));
+        return NULL;
+    }
+    wstr = (WCHAR*)malloc(wlen * sizeof(WCHAR));
+    if (wstr == NULL) {
+        UTF_ERROR(("Can't malloc() any space"));
+        return NULL;
+    }
+    if (MultiByteToWideChar(codePage, 0, str, len, wstr, wlen) == 0) {
+        UTF_ERROR(("Can't get WIDE string"));
+        return NULL;
+    }
+    return wstr;
+}
+
+/*
+ * Convert UTF-8 to a platform string
+ */
+int JNICALL utf8ToPlatform(jbyte *utf8, int len, char* output, int outputMaxLen) {
+    int wlen;
+    int plen;
+    WCHAR* wstr;
+    UINT codepage;
+
+    UTF_ASSERT(utf8);
+    UTF_ASSERT(output);
+    UTF_ASSERT(outputMaxLen > len);
+
+    /* Zero length is ok, but we don't need to do much */
+    if ( len == 0 ) {
+        output[0] = 0;
+        return 0;
+    }
+
+    /* Get WIDE string version (assumes len>0) */
+    wstr = getWideString(CP_UTF8, (char*)utf8, len, &wlen);
+    if ( wstr == NULL ) {
+        // Can't allocate WIDE string
+        goto just_copy_bytes;
+    }
+
+    /* Convert WIDE string to MultiByte string */
+    codepage = getCodepage();
+    plen = WideCharToMultiByte(codepage, 0, wstr, wlen,
+                               output, outputMaxLen, NULL, NULL);
+    free(wstr);
+    if (plen <= 0) {
+        // Can't convert WIDE string to multi-byte
+        goto just_copy_bytes;
+    }
+    output[plen] = '\0';
+    return plen;
+
+just_copy_bytes:
+    (void)memcpy(output, utf8, len);
+    output[len] = 0;
+    return len;
+}
+
+/*
+ * Convert Platform Encoding to UTF-8.
+ */
+int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen) {
+    int wlen;
+    int plen;
+    WCHAR* wstr;
+    UINT codepage;
+
+    UTF_ASSERT(str);
+    UTF_ASSERT(output);
+    UTF_ASSERT(outputMaxLen > len);
+
+    /* Zero length is ok, but we don't need to do much */
+    if ( len == 0 ) {
+        output[0] = 0;
+        return 0;
+    }
+
+    /* Get WIDE string version (assumes len>0) */
+    codepage = getCodepage();
+    wstr = getWideString(codepage, str, len, &wlen);
+    if ( wstr == NULL ) {
+        goto just_copy_bytes;
+    }
+
+    /* Convert WIDE string to UTF-8 string */
+    plen = WideCharToMultiByte(CP_UTF8, 0, wstr, wlen,
+                               (char*)output, outputMaxLen, NULL, NULL);
+    free(wstr);
+    if (plen <= 0) {
+        UTF_ERROR(("Can't convert WIDE string to multi-byte"));
+        goto just_copy_bytes;
+    }
+    output[plen] = '\0';
+    return plen;
+
+just_copy_bytes:
+    (void)memcpy(output, str, len);
+    output[len] = 0;
+    return len;
+}
+
+
+#else
+// *NIX specific part
+
+#include <iconv.h>
+#include <locale.h>
+#include <langinfo.h>
+#include <string.h>
+
+typedef enum {TO_UTF8, FROM_UTF8} conv_direction;
+
+/*
+ * Do iconv() conversion.
+ *    Returns length or -1 if output overflows.
+ */
+static int iconvConvert(conv_direction drn, char *bytes, size_t len, char *output, size_t outputMaxLen) {
+
+    static char *codeset = 0;
+    iconv_t func;
+    size_t bytes_converted;
+    size_t inLeft, outLeft;
+    char *inbuf, *outbuf;
+
+    UTF_ASSERT(bytes);
+    UTF_ASSERT(output);
+    UTF_ASSERT(outputMaxLen > len);
+
+    /* Zero length is ok, but we don't need to do much */
+    if ( len == 0 ) {
+        output[0] = 0;
+        return 0;
+    }
+
+    if (codeset == NULL && codeset != (char *) -1) {
+        // locale is not initialized, do it now
+        if (setlocale(LC_ALL, "") != NULL) {
+            // nl_langinfo returns ANSI_X3.4-1968 by default
+            codeset = (char*)nl_langinfo(CODESET);
+        }
+
+        if (codeset == NULL) {
+           // Not able to intialize process locale from platform one.
+           codeset = (char *) -1;
+        }
+    }
+
+    if (codeset == (char *) -1) {
+      // There was an error during initialization, so just bail out
+      goto just_copy_bytes;
+    }
+
+    func = (drn == TO_UTF8) ? iconv_open(codeset, "UTF-8") : iconv_open("UTF-8", codeset);
+    if (func == (iconv_t) -1) {
+        // Requested charset combination is not supported, conversion couldn't be done.
+        // make sure we will not try it again
+        codeset = (char *) -1;
+        goto just_copy_bytes;
+    }
+
+    // perform conversion
+    inbuf = bytes;
+    outbuf = output;
+    inLeft = len;
+    outLeft = outputMaxLen;
+
+    bytes_converted = iconv(func, (void*)&inbuf, &inLeft, &outbuf, &outLeft);
+    if (bytes_converted == (size_t) -1 || bytes_converted == 0 || inLeft != 0) {
+        // Input string is invalid, not able to convert entire string
+        // or some other iconv error happens.
+        iconv_close(func);
+        goto just_copy_bytes;
+    }
+
+    iconv_close(func);
+    // Overwrite bytes_converted with value of actually stored bytes
+    bytes_converted = outputMaxLen-outLeft;
+    output[bytes_converted] = 0;
+    return bytes_converted;
+
+
+just_copy_bytes:
+    (void)memcpy(output, bytes, len);
+    output[len] = 0;
+    return len;
+ }
+
+/*
+ * Convert UTF-8 to Platform Encoding.
+ *    Returns length or -1 if output overflows.
+ */
+int JNICALL utf8ToPlatform(jbyte *utf8, int len, char *output, int outputMaxLen) {
+    return iconvConvert(FROM_UTF8, (char*)utf8, len, output, outputMaxLen);
+}
+
+/*
+ * Convert Platform Encoding to UTF-8.
+ *    Returns length or -1 if output overflows.
+ */
+int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen) {
+    return iconvConvert(TO_UTF8, str, len, (char*) output, outputMaxLen);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/back/utf_util.h	Mon Jun 16 07:25:11 2014 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _utf_util_h_
+#define _utf_util_h_
+
+#include "jni.h"
+
+
+int JNICALL utf8sToUtf8mLength(jbyte *string, int length);
+void JNICALL utf8sToUtf8m(jbyte *string, int length, jbyte *newString, int newLength);
+int JNICALL utf8mToUtf8sLength(jbyte *string, int length);
+void JNICALL utf8mToUtf8s(jbyte *string, int length, jbyte *newString, int newLength);
+
+int JNICALL utf8ToPlatform(jbyte *utf8, int len, char* output, int outputMaxLen);
+int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen);
+
+#endif
--- a/src/share/back/util.h	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/back/util.h	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,6 @@
 #include "error_messages.h"
 #include "debugInit.h"
 
-/* Get access to Native Platform Toolkit functions */
-#include "npt.h"
-
 /* Definition of a CommonRef tracked by the backend for the frontend */
 typedef struct RefNode {
     jlong        seqNum;        /* ID of reference, also key for hash table */
@@ -123,9 +120,6 @@
 
     unsigned log_flags;
 
-    /* The Native Platform Toolkit access */
-    NptEnv *npt;
-
     /* Common References static data */
     jrawMonitorID refLock;
     jlong         nextSeqNum;
--- a/src/share/demo/jvmti/hprof/hprof.h	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/demo/jvmti/hprof/hprof.h	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -67,10 +67,6 @@
 #include "classfile_constants.h"
 #include "jvm_md.h"
 
-#ifndef SKIP_NPT
-#include "npt.h"   /* To get NptEnv for doing character conversions */
-#endif
-
 /* Macros to extract the upper and lower 32 bits of a jlong */
 
 #define jlong_high(a)    ((jint)((a)>>32))
@@ -207,9 +203,6 @@
 
     jvmtiEnv            *jvmti; /* JVMTI env for this session */
     JavaVM              *jvm;   /* JavaVM* for this session */
-#ifndef SKIP_NPT
-    NptEnv              *npt;   /* NptEnv* for this session, see npt.h */
-#endif
     jint                cachedJvmtiVersion; /* JVMTI version number */
 
     char               *header; /* "JAVA PROFILE 1.0.[12]" */
--- a/src/share/demo/jvmti/hprof/hprof_init.c	Mon Jun 16 13:40:49 2014 +0100
+++ b/src/share/demo/jvmti/hprof/hprof_init.c	Mon Jun 16 07:25:11 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -740,16 +740,11 @@
     }
 
     if ( gdata->utf8_output_filename != NULL ) {
-        /* UTF-8 to platform encoding (fill in gdata->output_filename) */
+        // Don't attempt to convert output filename.
+        // If fileystem uses the same encoding as the rest of the OS it will work as is.
         ulen = (int)strlen(gdata->utf8_output_filename);
         gdata->output_filename = (char*)HPROF_MALLOC(ulen*3+3);
-#ifdef SKIP_NPT
         (void)strcpy(gdata->output_filename, gdata->utf8_output_filename);
-#else
-        (void)(gdata->npt->utf8ToPlatform)
-              (gdata->npt->utf, (jbyte*)gdata->utf8_output_filename, ulen,
-               gdata->output_filename, ulen*3+3);
-#endif
     }
 
     /* By default we turn on gdata->alloc_sites and gdata->heap_dump */
@@ -1949,7 +1944,6 @@
 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
 {
     char *boot_path = NULL;
-    char npt_lib[JVM_MAXPATHLEN];
 
     /* See if it's already loaded */
     if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) {
@@ -1970,24 +1964,6 @@
     /* Get the JVMTI environment */
     getJvmti();
 
-#ifndef SKIP_NPT
-    getSystemProperty("sun.boot.library.path", &boot_path);
-    /* Load in NPT library for character conversions */
-    md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
-    if ( strlen(npt_lib) == 0 ) {
-        HPROF_ERROR(JNI_TRUE, "Could not find npt library");
-    }
-    jvmtiDeallocate(boot_path);
-    NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
-    if ( gdata->npt == NULL ) {
-        HPROF_ERROR(JNI_TRUE, "Cannot load npt library");
-    }
-    gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
-    if ( gdata->npt->utf == NULL ) {
-        HPROF_ERROR(JNI_TRUE, "Cannot initialize npt utf functions");
-    }
-#endif
-
     /* Lock needed to protect debug_malloc() code, which is not MT safe */
     #ifdef DEBUG
         gdata->debug_malloc_lock = createRawMonitor("HPROF debug_malloc lock");
--- a/src/share/npt/README.txt	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-
-README: For NPT Library.
-------------------------
-
-To use this Native Platform Toolkit library, you need to add 
--Isrc/share/npt and -I/src/${platform}/npt (platform is solaris or windows)
-to your compilation lines.
-
-To initialize/use the library:
-
-    #include "npt.h"
-    
-    NptEnv *npt;
-    
-    NPT_INITIALIZE(&npt, NPT_VERSION, NULL);
-    if (npt == NULL) {
-        FATAL_ERROR_MESSAGE(("Unable to gain access to Npt library"));
-    }
-
-    /* To use the npt utf functions, they require initialization */
-    npt->utf = (npt->utfInitialize)(NULL);
-    if (npt->utf == NULL) {
-        FATAL_ERROR_MESSAGE(("Unable to gain access to Npt utf functions"));
-    }
-
-    ...
-
-
-    /* After all uses is done, it can be terminated, however, if the
-     *   process will be exiting anyway it isn't necessary, and if
-     *   you have other threads running that might use these handles
-     *   you will need to wait here until all those threads have terminated.
-     *   So in general, termination can be a pain and slow your process
-     *   termination down.
-     */
-    (npt->utfTerminate)(npt->utf,NULL);
-    NPT_TERMINATE(&npt, NULL);
-
-
--- a/src/share/npt/npt.c	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "jni.h"
-
-#include "npt.h"
-
-#include "utf.h"
-
-static int
-version_check(char *version)
-{
-    if ( version==NULL || strcmp(version, NPT_VERSION)!=0 ) {
-        return 1;
-    }
-    return 0;
-}
-
-JNIEXPORT void JNICALL
-nptInitialize(NptEnv **pnpt, char *nptVersion, char *options)
-{
-    NptEnv *npt;
-
-    (*pnpt) = NULL;
-
-    if ( version_check(nptVersion) ) {
-        NPT_ERROR("NPT version doesn't match");
-        return;
-    }
-
-    npt = (NptEnv*)calloc(sizeof(NptEnv), 1);
-    if ( npt == NULL ) {
-        NPT_ERROR("Cannot allocate calloc space for NptEnv*");
-        return;
-    }
-
-    if ( options != NULL ) {
-        npt->options = strdup(options);
-    }
-    npt->utfInitialize          = &utfInitialize;
-    npt->utfTerminate           = &utfTerminate;
-    npt->utf8ToPlatform         = &utf8ToPlatform;
-    npt->utf8FromPlatform       = &utf8FromPlatform;
-    npt->utf8ToUtf16            = &utf8ToUtf16;
-    npt->utf16ToUtf8m           = &utf16ToUtf8m;
-    npt->utf16ToUtf8s           = &utf16ToUtf8s;
-    npt->utf8sToUtf8mLength     = &utf8sToUtf8mLength;
-    npt->utf8sToUtf8m           = &utf8sToUtf8m;
-    npt->utf8mToUtf8sLength     = &utf8mToUtf8sLength;
-    npt->utf8mToUtf8s           = &utf8mToUtf8s;
-
-    (*pnpt) = npt;
-}
-
-JNIEXPORT void JNICALL
-nptTerminate(NptEnv* npt, char *options)
-{
-
-    /* FIXUP: options? Check memory or something? */
-    if ( npt->options != NULL ) {
-        (void)free(npt->options);
-    }
-    (void)free(npt);
-}
--- a/src/share/npt/npt.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Native Platform Toolkit */
-
-#ifndef  _NPT_H
-#define _NPT_H
-
-#define NPT_VERSION "0.0.0"
-
-#include <stdio.h>
-
-#include "jni.h"
-
-#include "npt_md.h"
-#include "utf.h"
-
-#define NPT_ERROR(s) { (void)fprintf(stderr, "NPT ERROR: %s\n", s); exit(1); }
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-
-    /* Used to save handle to our own dynamicly loaded library */
-    void *libhandle;
-
-    /* Copy of the options sent in at initialization */
-    char *options;
-
-    /* Can be used to save the UtfInst handle */
-    struct UtfInst *utf;
-
-    /* UTF interfaces, see utf.c */
-    struct UtfInst* (JNICALL *utfInitialize)
-                         (char *options);
-    void     (JNICALL *utfTerminate)
-                         (struct UtfInst *utf, char *options);
-    int      (JNICALL *utf8ToPlatform)
-                         (struct UtfInst *utf, jbyte *utf8, int len,
-                          char *output, int outputMaxLen);
-    int      (JNICALL *utf8FromPlatform)
-                         (struct UtfInst *utf, char *str, int len,
-                          jbyte *output, int outputMaxLen);
-    int      (JNICALL *utf8ToUtf16)
-                         (struct UtfInst *utf, jbyte *utf8, int len,
-                          jchar *output, int outputMaxLen);
-    int      (JNICALL *utf16ToUtf8m)
-                         (struct UtfInst *utf, jchar *utf16, int len,
-                          jbyte *output, int outputMaxLen);
-    int      (JNICALL *utf16ToUtf8s)
-                         (struct UtfInst *utf, jchar *utf16, int len,
-                          jbyte *output, int outputMaxLen);
-    int      (JNICALL *utf8sToUtf8mLength)
-                         (struct UtfInst *utf, jbyte *string, int length);
-    void     (JNICALL *utf8sToUtf8m)
-                         (struct UtfInst *utf, jbyte *string, int length,
-                          jbyte *newString, int newLength);
-    int      (JNICALL *utf8mToUtf8sLength)
-                         (struct UtfInst *utf, jbyte *string, int length);
-    void     (JNICALL *utf8mToUtf8s)
-                         (struct UtfInst *utf, jbyte *string, int length,
-                          jbyte *newString, int newLength);
-
-} NptEnv;
-
-/* Typedefs for the only 2 'extern' functions in npt library:
- *    nptInitialize and nptTerminate
- *    See NPT_INITIALIZE() and NPT_TERMINATE() in npt_md.h.
- */
-
-JNIEXPORT void JNICALL nptInitialize
-                       (NptEnv **pnpt, char *nptVersion, char *options);
-typedef void (JNICALL *NptInitialize)
-             (NptEnv **pnpt, char *nptVersion, char *options);
-
-JNIEXPORT void JNICALL nptTerminate
-                       (NptEnv* npt, char *options);
-typedef void (JNICALL *NptTerminate)
-             (NptEnv* npt, char *options);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif
--- a/src/share/npt/utf.c	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,500 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Misc functions for conversion of Unicode and UTF-8 and platform encoding */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "jni.h"
-
-#include "utf.h"
-
-/*
- * Error handler
- */
-void
-utfError(char *file, int line, char *message)
-{
-    (void)fprintf(stderr, "UTF ERROR [\"%s\":%d]: %s\n", file, line, message);
-    abort();
-}
-
-/*
- * Convert UTF-8 to UTF-16
- *    Returns length or -1 if output overflows.
- */
-int JNICALL
-utf8ToUtf16(struct UtfInst *ui, jbyte *utf8, int len, unsigned short *output, int outputMaxLen)
-{
-    int outputLen;
-    int i;
-
-    UTF_ASSERT(utf8);
-    UTF_ASSERT(len>=0);
-    UTF_ASSERT(output);
-    UTF_ASSERT(outputMaxLen>0);
-
-    i = 0;
-    outputLen = 0;
-    while ( i<len ) {
-        unsigned code, x, y, z;
-
-        if ( outputLen >= outputMaxLen ) {
-            return -1;
-        }
-        x = (unsigned char)utf8[i++];
-        code = x;
-        if ( (x & 0xE0)==0xE0 ) {
-            y = (unsigned char)utf8[i++];
-            z = (unsigned char)utf8[i++];
-            code = ((x & 0xF)<<12) + ((y & 0x3F)<<6) + (z & 0x3F);
-        } else if ( (x & 0xC0)==0xC0 ) {
-            y = (unsigned char)utf8[i++];
-            code = ((x & 0x1F)<<6) + (y & 0x3F);
-        }
-        output[outputLen++] = code;
-    }
-    return outputLen;
-}
-
-/*
- * Convert UTF-16 to UTF-8 Modified
- *    Returns length or -1 if output overflows.
- */
-int JNICALL
-utf16ToUtf8m(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, int outputMaxLen)
-{
-    int i;
-    int outputLen;
-
-    UTF_ASSERT(utf16);
-    UTF_ASSERT(len>=0);
-    UTF_ASSERT(output);
-    UTF_ASSERT(outputMaxLen>0);
-
-    outputLen = 0;
-    for (i = 0; i < len; i++) {
-        unsigned code;
-
-        code = utf16[i];
-        if ( code >= 0x0001 && code <= 0x007F ) {
-            if ( outputLen + 1 >= outputMaxLen ) {
-                return -1;
-            }
-            output[outputLen++] = code;
-        } else if ( code == 0 || ( code >= 0x0080 && code <= 0x07FF ) ) {
-            if ( outputLen + 2 >= outputMaxLen ) {
-                return -1;
-            }
-            output[outputLen++] = ((code>>6) & 0x1F) | 0xC0;
-            output[outputLen++] = (code & 0x3F) | 0x80;
-        } else if ( code >= 0x0800 && code <= 0xFFFF ) {
-            if ( outputLen + 3 >= outputMaxLen ) {
-                return -1;
-            }
-            output[outputLen++] = ((code>>12) & 0x0F) | 0xE0;
-            output[outputLen++] = ((code>>6) & 0x3F) | 0x80;
-            output[outputLen++] = (code & 0x3F) | 0x80;
-        }
-    }
-    output[outputLen] = 0;
-    return outputLen;
-}
-
-int JNICALL
-utf16ToUtf8s(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, int outputMaxLen)
-{
-    return -1; /* FIXUP */
-}
-
-/* Determine length of this Standard UTF-8 in Modified UTF-8.
- *    Validation is done of the basic UTF encoding rules, returns
- *    length (no change) when errors are detected in the UTF encoding.
- *
- *    Note: Accepts Modified UTF-8 also, no verification on the
- *          correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok.
- */
-int JNICALL
-utf8sToUtf8mLength(struct UtfInst *ui, jbyte *string, int length)
-{
-    int newLength;
-    int i;
-
-    newLength = 0;
-    for ( i = 0 ; i < length ; i++ ) {
-        unsigned byte;
-
-        byte = (unsigned char)string[i];
-        if ( (byte & 0x80) == 0 ) { /* 1byte encoding */
-            newLength++;
-            if ( byte == 0 ) {
-                newLength++; /* We gain one byte in length on NULL bytes */
-            }
-        } else if ( (byte & 0xE0) == 0xC0 ) { /* 2byte encoding */
-            /* Check encoding of following bytes */
-            if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) {
-                break; /* Error condition */
-            }
-            i++; /* Skip next byte */
-            newLength += 2;
-        } else if ( (byte & 0xF0) == 0xE0 ) { /* 3byte encoding */
-            /* Check encoding of following bytes */
-            if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80
-                                 || (string[i+2] & 0xC0) != 0x80 ) {
-                break; /* Error condition */
-            }
-            i += 2; /* Skip next two bytes */
-            newLength += 3;
-        } else if ( (byte & 0xF8) == 0xF0 ) { /* 4byte encoding */
-            /* Check encoding of following bytes */
-            if ( (i+3) >= length || (string[i+1] & 0xC0) != 0x80
-                                 || (string[i+2] & 0xC0) != 0x80
-                                 || (string[i+3] & 0xC0) != 0x80 ) {
-                break; /* Error condition */
-            }
-            i += 3; /* Skip next 3 bytes */
-            newLength += 6; /* 4byte encoding turns into 2 3byte ones */
-        } else {
-            break; /* Error condition */
-        }
-    }
-    if ( i != length ) {
-        /* Error in finding new length, return old length so no conversion */
-        /* FIXUP: ERROR_MESSAGE? */
-        return length;
-    }
-    return newLength;
-}
-
-/* Convert Standard UTF-8 to Modified UTF-8.
- *    Assumes the UTF-8 encoding was validated by utf8mLength() above.
- *
- *    Note: Accepts Modified UTF-8 also, no verification on the
- *          correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok.
- */
-void JNICALL
-utf8sToUtf8m(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, int newLength)
-{
-    int i;
-    int j;
-
-    j = 0;
-    for ( i = 0 ; i < length ; i++ ) {
-        unsigned byte1;
-
-        byte1 = (unsigned char)string[i];
-
-        /* NULL bytes and bytes starting with 11110xxx are special */
-        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
-            if ( byte1 == 0 ) {
-                /* Bits out: 11000000 10000000 */
-                newString[j++] = (jbyte)0xC0;
-                newString[j++] = (jbyte)0x80;
-            } else {
-                /* Single byte */
-                newString[j++] = byte1;
-            }
-        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
-            newString[j++] = byte1;
-            newString[j++] = string[++i];
-        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
-            newString[j++] = byte1;
-            newString[j++] = string[++i];
-            newString[j++] = string[++i];
-        } else if ( (byte1 & 0xF8) == 0xF0 ) { /* 4byte encoding */
-            /* Beginning of 4byte encoding, turn into 2 3byte encodings */
-            unsigned byte2, byte3, byte4, u21;
-
-            /* Bits in: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
-            byte2 = (unsigned char)string[++i];
-            byte3 = (unsigned char)string[++i];
-            byte4 = (unsigned char)string[++i];
-            /* Reconstruct full 21bit value */
-            u21  = (byte1 & 0x07) << 18;
-            u21 += (byte2 & 0x3F) << 12;
-            u21 += (byte3 & 0x3F) << 6;
-            u21 += (byte4 & 0x3F);
-            /* Bits out: 11101101 1010xxxx 10xxxxxx */
-            newString[j++] = (jbyte)0xED;
-            newString[j++] = (jbyte)(0xA0 + (((u21 >> 16) - 1) & 0x0F));
-            newString[j++] = (jbyte)(0x80 + ((u21 >> 10) & 0x3F));
-            /* Bits out: 11101101 1011xxxx 10xxxxxx */
-            newString[j++] = (jbyte)0xED;
-            newString[j++] = (jbyte)(0xB0 + ((u21 >>  6) & 0x0F));
-            newString[j++] = byte4;
-        }
-    }
-    UTF_ASSERT(i==length);
-    UTF_ASSERT(j==newLength);
-    newString[j] = (jbyte)0;
-}
-
-/* Given a Modified UTF-8 string, calculate the Standard UTF-8 length.
- *   Basic validation of the UTF encoding rules is done, and length is
- *   returned (no change) when errors are detected.
- *
- *   Note: No validation is made that this is indeed Modified UTF-8 coming in.
- *
- */
-int JNICALL
-utf8mToUtf8sLength(struct UtfInst *ui, jbyte *string, int length)
-{
-    int newLength;
-    int i;
-
-    newLength = 0;
-    for ( i = 0 ; i < length ; i++ ) {
-        unsigned byte1, byte2, byte3, byte4, byte5, byte6;
-
-        byte1 = (unsigned char)string[i];
-        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
-            newLength++;
-        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
-            /* Check encoding of following bytes */
-            if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) {
-                break; /* Error condition */
-            }
-            byte2 = (unsigned char)string[++i];
-            if ( byte1 != 0xC0 || byte2 != 0x80 ) {
-                newLength += 2; /* Normal 2byte encoding, not 0xC080 */
-            } else {
-                newLength++;    /* We will turn 0xC080 into 0 */
-            }
-        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
-            /* Check encoding of following bytes */
-            if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80
-                                 || (string[i+2] & 0xC0) != 0x80 ) {
-                break; /* Error condition */
-            }
-            byte2 = (unsigned char)string[++i];
-            byte3 = (unsigned char)string[++i];
-            newLength += 3;
-            /* Possible process a second 3byte encoding */
-            if ( (i+3) < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
-                /* See if this is a pair of 3byte encodings */
-                byte4 = (unsigned char)string[i+1];
-                byte5 = (unsigned char)string[i+2];
-                byte6 = (unsigned char)string[i+3];
-                if ( byte4 == 0xED && (byte5 & 0xF0) == 0xB0 ) {
-                    /* Check encoding of 3rd byte */
-                    if ( (byte6 & 0xC0) != 0x80 ) {
-                        break; /* Error condition */
-                    }
-                    newLength++; /* New string will have 4byte encoding */
-                    i += 3;       /* Skip next 3 bytes */
-                }
-            }
-        } else {
-            break; /* Error condition */
-        }
-    }
-    if ( i != length ) {
-        /* Error in UTF encoding */
-        /*  FIXUP: ERROR_MESSAGE()? */
-        return length;
-    }
-    return newLength;
-}
-
-/* Convert a Modified UTF-8 string into a Standard UTF-8 string
- *   It is assumed that this string has been validated in terms of the
- *   basic UTF encoding rules by utf8Length() above.
- *
- *   Note: No validation is made that this is indeed Modified UTF-8 coming in.
- *
- */
-void JNICALL
-utf8mToUtf8s(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, int newLength)
-{
-    int i;
-    int j;
-
-    j = 0;
-    for ( i = 0 ; i < length ; i++ ) {
-        unsigned byte1, byte2, byte3, byte4, byte5, byte6;
-
-        byte1 = (unsigned char)string[i];
-        if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
-            /* Single byte */
-            newString[j++] = byte1;
-        } else if ( (byte1 & 0xE0) == 0xC0 ) { /* 2byte encoding */
-            byte2 = (unsigned char)string[++i];
-            if ( byte1 != 0xC0 || byte2 != 0x80 ) {
-                newString[j++] = byte1;
-                newString[j++] = byte2;
-            } else {
-                newString[j++] = 0;
-            }
-        } else if ( (byte1 & 0xF0) == 0xE0 ) { /* 3byte encoding */
-            byte2 = (unsigned char)string[++i];
-            byte3 = (unsigned char)string[++i];
-            if ( i+3 < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
-                /* See if this is a pair of 3byte encodings */
-                byte4 = (unsigned char)string[i+1];
-                byte5 = (unsigned char)string[i+2];
-                byte6 = (unsigned char)string[i+3];
-                if ( byte4 == 0xED && (byte5 & 0xF0) == 0xB0 ) {
-                    unsigned u21;
-
-                    /* Bits in: 11101101 1010xxxx 10xxxxxx */
-                    /* Bits in: 11101101 1011xxxx 10xxxxxx */
-                    i += 3;
-
-                    /* Reconstruct 21 bit code */
-                    u21  = ((byte2 & 0x0F) + 1) << 16;
-                    u21 += (byte3 & 0x3F) << 10;
-                    u21 += (byte5 & 0x0F) << 6;
-                    u21 += (byte6 & 0x3F);
-
-                    /* Bits out: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
-
-                    /* Convert to 4byte encoding */
-                    newString[j++] = 0xF0 + ((u21 >> 18) & 0x07);
-                    newString[j++] = 0x80 + ((u21 >> 12) & 0x3F);
-                    newString[j++] = 0x80 + ((u21 >>  6) & 0x3F);
-                    newString[j++] = 0x80 + (u21 & 0x3F);
-                    continue;
-                }
-            }
-            /* Normal 3byte encoding */
-            newString[j++] = byte1;
-            newString[j++] = byte2;
-            newString[j++] = byte3;
-        }
-    }
-    UTF_ASSERT(i==length);
-    UTF_ASSERT(j==newLength);
-    newString[j] = 0;
-}
-
-/* ================================================================= */
-
-#ifdef COMPILE_WITH_UTF_TEST  /* Test program */
-
-/*
- * Convert any byte array into a printable string.
- *    Returns length or -1 if output overflows.
- */
-static int
-bytesToPrintable(struct UtfInst *ui, char *bytes, int len, char *output, int outputMaxLen)
-{
-    int outputLen;
-    int i;
-
-    UTF_ASSERT(bytes);
-    UTF_ASSERT(len>=0);
-    UTF_ASSERT(output);
-    UTF_ASSERT(outputMaxLen>=0);
-
-    outputLen = 0;
-    for ( i=0; i<len ; i++ ) {
-        unsigned byte;
-
-        byte = bytes[i];
-        if ( byte <= 0x7f && isprint(byte) && !iscntrl(byte) ) {
-            if ( outputLen + 1 >= outputMaxLen ) {
-                return -1;
-            }
-            output[outputLen++] = (char)byte;
-        } else {
-            if ( outputLen + 4 >= outputMaxLen ) {
-                return -1;
-            }
-            (void)sprintf(output+outputLen,"\\x%02x",byte);
-            outputLen += 4;
-        }
-    }
-    output[outputLen] = 0;
-    return outputLen;
-}
-
-static void
-test(void)
-{
-    static char *strings[] = {
-                "characters",
-                "abcdefghijklmnopqrstuvwxyz",
-                "0123456789",
-                "!@#$%^&*()_+=-{}[]:;",
-                NULL };
-    int i;
-    struct UtfInst *ui;
-
-    ui = utfInitialize(NULL);
-
-    i = 0;
-    while ( strings[i] != NULL ) {
-        char *str;
-        #define MAX 1024
-        char buf0[MAX];
-        char buf1[MAX];
-        char buf2[MAX];
-        unsigned short buf3[MAX];
-        int len1;
-        int len2;
-        int len3;
-
-        str = strings[i];
-
-        (void)bytesToPrintable(ui, str, (int)strlen(str), buf0, 1024);
-
-        len1 = utf8FromPlatform(ui, str, (int)strlen(str), (jbyte*)buf1, 1024);
-
-        UTF_ASSERT(len1==(int)strlen(str));
-
-        len3 = utf8ToUtf16(ui, (jbyte*)buf1, len1, (jchar*)buf3, 1024);
-
-        UTF_ASSERT(len3==len1);
-
-        len1 = utf16ToUtf8m(ui, (jchar*)buf3, len3, (jbyte*)buf1, 1024);
-
-        UTF_ASSERT(len1==len3);
-        UTF_ASSERT(strcmp(str, buf1) == 0);
-
-        len2 = utf8ToPlatform(ui, (jbyte*)buf1, len1, buf2, 1024);
-
-        UTF_ASSERT(len2==len1);
-        UTF_ASSERT(strcmp(str, buf2) == 0);
-
-        i++;
-    }
-
-    utfTerminate(ui, NULL);
-
-}
-
-int
-main(int argc, char **argv)
-{
-    test();
-    return 0;
-}
-
-#endif
--- a/src/share/npt/utf.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Routines for various UTF conversions */
-
-#ifndef  _UTF_H
-#define _UTF_H
-
-#include <stdio.h>
-
-#include "jni.h"
-#include "utf_md.h"
-
-/* Use THIS_FILE when it is available. */
-#ifndef THIS_FILE
-    #define THIS_FILE __FILE__
-#endif
-
-/* Error and assert macros */
-#define UTF_ERROR(m) utfError(THIS_FILE, __LINE__,  m)
-#define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 )
-
-void utfError(char *file, int line, char *message);
-
-struct UtfInst* JNICALL utfInitialize
-                            (char *options);
-void            JNICALL utfTerminate
-                            (struct UtfInst *ui, char *options);
-int             JNICALL utf8ToPlatform
-                            (struct UtfInst *ui, jbyte *utf8,
-                             int len, char *output, int outputMaxLen);
-int             JNICALL utf8FromPlatform
-                            (struct UtfInst *ui, char *str, int len,
-                             jbyte *output, int outputMaxLen);
-int             JNICALL utf8ToUtf16
-                            (struct UtfInst *ui, jbyte *utf8, int len,
-                             jchar *output, int outputMaxLen);
-int             JNICALL utf16ToUtf8m
-                            (struct UtfInst *ui, jchar *utf16, int len,
-                             jbyte *output, int outputMaxLen);
-int             JNICALL utf16ToUtf8s
-                            (struct UtfInst *ui, jchar *utf16, int len,
-                             jbyte *output, int outputMaxLen);
-int             JNICALL utf8sToUtf8mLength
-                            (struct UtfInst *ui, jbyte *string, int length);
-void            JNICALL utf8sToUtf8m
-                            (struct UtfInst *ui, jbyte *string, int length,
-                             jbyte *new_string, int new_length);
-int             JNICALL utf8mToUtf8sLength
-                            (struct UtfInst *ui, jbyte *string, int length);
-void            JNICALL utf8mToUtf8s
-                            (struct UtfInst *ui, jbyte *string, int length,
-                             jbyte *new_string, int new_length);
-
-#endif
--- a/src/solaris/npt/npt_md.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Native Platform Toolkit */
-
-#ifndef  _NPT_MD_H
-#define _NPT_MD_H
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-#include <jvm_md.h>
-
-#define NPT_LIBNAME "npt"
-
-#define NPT_INITIALIZE(path,pnpt,version,options)                       \
-    {                                                                   \
-        void   *_handle;                                                \
-        void   *_sym;                                                   \
-                                                                        \
-        if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL");             \
-        *(pnpt) = NULL;                                                 \
-        _handle =  dlopen(path, RTLD_LAZY);                             \
-        if ( _handle == NULL ) NPT_ERROR("Cannot open library");        \
-        _sym = dlsym(_handle, "nptInitialize");                         \
-        if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize");     \
-        ((NptInitialize)_sym)((pnpt), version, (options));              \
-        if ( (*(pnpt)) == NULL ) NPT_ERROR("Cannot initialize NptEnv"); \
-        (*(pnpt))->libhandle = _handle;                                 \
-    }
-
-#define NPT_TERMINATE(npt,options)                                      \
-    {                                                                   \
-        void *_handle;                                                  \
-        void *_sym;                                                     \
-                                                                        \
-        if ( (npt) == NULL ) NPT_ERROR("NptEnv* is NULL");              \
-        _handle = (npt)->libhandle;                                     \
-        _sym = dlsym(_handle, "nptTerminate");                          \
-        if ( _sym == NULL ) NPT_ERROR("Cannot find nptTerminate");      \
-        ((NptTerminate)_sym)((npt), (options));                         \
-        if ( _handle != NULL ) (void)dlclose(_handle);                  \
-    }
-
-
-#endif
--- a/src/solaris/npt/utf_md.c	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <langinfo.h>
-#include <iconv.h>
-
-#include "utf.h"
-
-/* Global variables */
-
-/*
- * Initialize all utf processing.
- */
-struct UtfInst *JNICALL
-utfInitialize(char *options)
-{
-    struct UtfInst *ui;
-    char           *codeset;
-
-    ui = (struct UtfInst*)calloc(sizeof(struct UtfInst), 1);
-    ui->iconvToPlatform         = (void *)-1;
-    ui->iconvFromPlatform       = (void *)-1;
-
-    /* Set the locale from the environment */
-    (void)setlocale(LC_ALL, "");
-
-    /* Get the codeset name */
-    codeset = (char*)nl_langinfo(CODESET);
-    if ( codeset == NULL || codeset[0] == 0 ) {
-        return ui;
-    }
-
-    /* If we don't need this, skip it */
-    if (strcmp(codeset, "UTF-8") == 0 || strcmp(codeset, "utf8") == 0 ) {
-        return ui;
-    }
-
-    /* Open conversion descriptors */
-    ui->iconvToPlatform   = iconv_open(codeset, "UTF-8");
-    if ( ui->iconvToPlatform == (void *)-1 ) {
-        UTF_ERROR("Failed to complete iconv_open() setup");
-    }
-    ui->iconvFromPlatform = iconv_open("UTF-8", codeset);
-    if ( ui->iconvFromPlatform == (void *)-1 ) {
-        UTF_ERROR("Failed to complete iconv_open() setup");
-    }
-    return ui;
-}
-
-/*
- * Terminate all utf processing
- */
-void  JNICALL
-utfTerminate(struct UtfInst *ui, char *options)
-{
-    if ( ui->iconvFromPlatform != (void *)-1 ) {
-        (void)iconv_close(ui->iconvFromPlatform);
-    }
-    if ( ui->iconvToPlatform != (void *)-1 ) {
-        (void)iconv_close(ui->iconvToPlatform);
-    }
-    ui->iconvToPlatform   = (void *)-1;
-    ui->iconvFromPlatform = (void *)-1;
-    (void)free(ui);
-}
-
-/*
- * Do iconv() conversion.
- *    Returns length or -1 if output overflows.
- */
-static int
-iconvConvert(iconv_t ic, char *bytes, int len, char *output, int outputMaxLen)
-{
-    int outputLen = 0;
-
-    UTF_ASSERT(bytes);
-    UTF_ASSERT(len>=0);
-    UTF_ASSERT(output);
-    UTF_ASSERT(outputMaxLen>len);
-
-    output[0] = 0;
-    outputLen = 0;
-
-    if ( ic != (iconv_t)(void *)-1 ) {
-        int          returnValue;
-        size_t       inLeft;
-        size_t       outLeft;
-        char        *inbuf;
-        char        *outbuf;
-
-        inbuf        = bytes;
-        outbuf       = output;
-        inLeft       = len;
-        outLeft      = outputMaxLen;
-        returnValue  = iconv(ic, (void*)&inbuf, &inLeft, &outbuf, &outLeft);
-        if ( returnValue >= 0 && inLeft==0 ) {
-            outputLen = outputMaxLen-outLeft;
-            output[outputLen] = 0;
-            return outputLen;
-        }
-
-        /* Failed to do the conversion */
-        return -1;
-    }
-
-    /* Just copy bytes */
-    outputLen = len;
-    (void)memcpy(output, bytes, len);
-    output[len] = 0;
-    return outputLen;
-}
-
-/*
- * Convert UTF-8 to Platform Encoding.
- *    Returns length or -1 if output overflows.
- */
-int  JNICALL
-utf8ToPlatform(struct UtfInst*ui, jbyte *utf8, int len, char *output, int outputMaxLen)
-{
-    /* Negative length is an error */
-    if ( len < 0 ) {
-        return -1;
-    }
-
-    /* Zero length is ok, but we don't need to do much */
-    if ( len == 0 ) {
-        output[0] = 0;
-        return 0;
-    }
-
-    return iconvConvert(ui->iconvToPlatform, (char*)utf8, len, output, outputMaxLen);
-}
-
-/*
- * Convert Platform Encoding to UTF-8.
- *    Returns length or -1 if output overflows.
- */
-int  JNICALL
-utf8FromPlatform(struct UtfInst*ui, char *str, int len, jbyte *output, int outputMaxLen)
-{
-    /* Negative length is an error */
-    if ( len < 0 ) {
-        return -1;
-    }
-
-    /* Zero length is ok, but we don't need to do much */
-    if ( len == 0 ) {
-        output[0] = 0;
-        return 0;
-    }
-
-    return iconvConvert(ui->iconvFromPlatform, str, len, (char*)output, outputMaxLen);
-}
--- a/src/solaris/npt/utf_md.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef  _UTF_MD_H
-#define _UTF_MD_H
-
-struct UtfInst {
-    void *iconvToPlatform;
-    void *iconvFromPlatform;
-};
-
-#endif
--- a/src/windows/npt/npt_md.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Native Platform Toolkit */
-
-#ifndef  _NPT_MD_H
-#define _NPT_MD_H
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#define NPT_LIBNAME "npt"
-
-#define NPT_INITIALIZE(path,pnpt,version,options)                       \
-    {                                                                   \
-        void   *_handle;                                                \
-        void   *_sym;                                                   \
-                                                                        \
-        if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL");             \
-        *(pnpt) = NULL;                                                 \
-        _handle =  LoadLibrary(path);                                   \
-        if ( _handle == NULL ) NPT_ERROR("Cannot open library");        \
-        _sym = GetProcAddress(_handle, "nptInitialize");                \
-        if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize");     \
-        ((NptInitialize)_sym)((pnpt), version, (options));              \
-        if ( *(pnpt) == NULL ) NPT_ERROR("Cannot initialize NptEnv");   \
-        (*(pnpt))->libhandle = _handle;                                 \
-    }
-
-#define NPT_TERMINATE(npt,options)                                      \
-    {                                                                   \
-        void *_handle;                                                  \
-        void *_sym;                                                     \
-                                                                        \
-        if ( (npt) == NULL ) NPT_ERROR("NptEnv* is NULL");              \
-        _handle = (npt)->libhandle;                                     \
-        if ( _handle == NULL ) NPT_ERROR("npt->libhandle is NULL");     \
-        _sym = GetProcAddress(_handle, "nptTerminate");                 \
-        if ( _sym == NULL ) NPT_ERROR("Cannot find nptTerminate");      \
-        ((NptTerminate)_sym)((npt), (options));                         \
-        (void)FreeLibrary(_handle);                                     \
-    }
-
-#endif
--- a/src/windows/npt/utf_md.c	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "utf.h"
-
-#include <windows.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/*
- * Initialize all utf processing.
- */
-struct UtfInst * JNICALL
-utfInitialize(char *options)
-{
-    struct UtfInst *ui;
-    LANGID langID;
-    LCID localeID;
-    TCHAR strCodePage[7];       // ANSI code page id
-
-    ui = (struct UtfInst*)calloc(sizeof(struct UtfInst), 1);
-
-    /*
-     * Get the code page for this locale
-     */
-    langID = LANGIDFROMLCID(GetUserDefaultLCID());
-    localeID = MAKELCID(langID, SORT_DEFAULT);
-    if (GetLocaleInfo(localeID, LOCALE_IDEFAULTANSICODEPAGE,
-                      strCodePage, sizeof(strCodePage)/sizeof(TCHAR)) > 0 ) {
-        ui->platformCodePage = atoi(strCodePage);
-    } else {
-        ui->platformCodePage = GetACP();
-    }
-    return ui;
-}
-
-/*
- * Terminate all utf processing
- */
-void JNICALL
-utfTerminate(struct UtfInst *ui, char *options)
-{
-    (void)free(ui);
-}
-
-/*
- * Get wide string  (assumes len>0)
- */
-static WCHAR*
-getWideString(UINT codePage, char* str, int len, int *pwlen)
-{
-    int wlen;
-    WCHAR* wstr;
-
-    /* Convert the string to WIDE string */
-    wlen = MultiByteToWideChar(codePage, 0, str, len, NULL, 0);
-    *pwlen = wlen;
-    if (wlen <= 0) {
-        UTF_ERROR(("Can't get WIDE string length"));
-        return NULL;
-    }
-    wstr = (WCHAR*)malloc(wlen * sizeof(WCHAR));
-    if (wstr == NULL) {
-        UTF_ERROR(("Can't malloc() any space"));
-        return NULL;
-    }
-    if (MultiByteToWideChar(codePage, 0, str, len, wstr, wlen) == 0) {
-        UTF_ERROR(("Can't get WIDE string"));
-        return NULL;
-    }
-    return wstr;
-}
-
-/*
- * Convert UTF-8 to a platform string
- */
-int JNICALL
-utf8ToPlatform(struct UtfInst *ui, jbyte *utf8, int len, char* output, int outputMaxLen)
-{
-    int wlen;
-    int plen;
-    WCHAR* wstr;
-
-    /* Negative length is an error */
-    if ( len < 0 ) {
-        return -1;
-    }
-
-    /* Zero length is ok, but we don't need to do much */
-    if ( len == 0 ) {
-        output[0] = 0;
-        return 0;
-    }
-
-    /* Get WIDE string version (assumes len>0) */
-    wstr = getWideString(CP_UTF8, (char*)utf8, len, &wlen);
-    if ( wstr == NULL ) {
-        return -1;
-    }
-
-    /* Convert WIDE string to MultiByte string */
-    plen = WideCharToMultiByte(ui->platformCodePage, 0, wstr, wlen,
-                               output, outputMaxLen, NULL, NULL);
-    free(wstr);
-    if (plen <= 0) {
-        UTF_ERROR(("Can't convert WIDE string to multi-byte"));
-        return -1;
-    }
-    output[plen] = '\0';
-    return plen;
-}
-
-/*
- * Convert Platform Encoding to UTF-8.
- */
-int JNICALL
-utf8FromPlatform(struct UtfInst *ui, char *str, int len, jbyte *output, int outputMaxLen)
-{
-    int wlen;
-    int plen;
-    WCHAR* wstr;
-
-    /* Negative length is an error */
-    if ( len < 0 ) {
-        return -1;
-    }
-
-    /* Zero length is ok, but we don't need to do much */
-    if ( len == 0 ) {
-        output[0] = 0;
-        return 0;
-    }
-
-    /* Get WIDE string version (assumes len>0) */
-    wstr = getWideString(ui->platformCodePage, str, len, &wlen);
-    if ( wstr == NULL ) {
-        return -1;
-    }
-
-    /* Convert WIDE string to UTF-8 string */
-    plen = WideCharToMultiByte(CP_UTF8, 0, wstr, wlen,
-                               (char*)output, outputMaxLen, NULL, NULL);
-    free(wstr);
-    if (plen <= 0) {
-        UTF_ERROR(("Can't convert WIDE string to multi-byte"));
-        return -1;
-    }
-    output[plen] = '\0';
-    return plen;
-}
--- a/src/windows/npt/utf_md.h	Mon Jun 16 13:40:49 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef  _UTF_MD_H
-#define _UTF_MD_H
-
-struct UtfInst {
-    unsigned int platformCodePage;
-};
-
-#endif