13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
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 #include "jni.h"
26 #include "jni_util.h"
27 #include "jvm.h"
28 #include "io_util.h"
29 #include "io_util_md.h"
30 #include <string.h>
31 #include <unistd.h>
32
33 #ifdef __solaris__
34 #include <sys/filio.h>
35 #endif
36
37 #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
38 #include <sys/ioctl.h>
39 #endif
40
41 #ifdef MACOSX
42
43 #include <CoreFoundation/CoreFoundation.h>
44
45 __private_extern__
46 jstring newStringPlatform(JNIEnv *env, const char* str)
47 {
48 jstring rv = NULL;
49 CFMutableStringRef csref = CFStringCreateMutable(NULL, 0);
50 if (csref == NULL) {
51 JNU_ThrowOutOfMemoryError(env, "native heap");
52 } else {
53 CFStringAppendCString(csref, str, kCFStringEncodingUTF8);
54 CFStringNormalize(csref, kCFStringNormalizationFormC);
55 int clen = CFStringGetLength(csref);
56 int ulen = (clen + 1) * 2; // utf16 + zero padding
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
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 #include "jni.h"
26 #include "jni_util.h"
27 #include "jvm.h"
28 #include "io_util.h"
29 #include "io_util_md.h"
30 #include <string.h>
31 #include <unistd.h>
32
33 #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
34 #include <sys/ioctl.h>
35 #endif
36
37 #ifdef MACOSX
38
39 #include <CoreFoundation/CoreFoundation.h>
40
41 __private_extern__
42 jstring newStringPlatform(JNIEnv *env, const char* str)
43 {
44 jstring rv = NULL;
45 CFMutableStringRef csref = CFStringCreateMutable(NULL, 0);
46 if (csref == NULL) {
47 JNU_ThrowOutOfMemoryError(env, "native heap");
48 } else {
49 CFStringAppendCString(csref, str, kCFStringEncodingUTF8);
50 CFStringNormalize(csref, kCFStringNormalizationFormC);
51 int clen = CFStringGetLength(csref);
52 int ulen = (clen + 1) * 2; // utf16 + zero padding
|