Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-05-09 18:51:13 +0000
committerAndrew Niefer2008-05-09 18:51:13 +0000
commita9049f67902ad98d4fafbb721a73c29c806af6c8 (patch)
treed99cd7254ccb8d4e83c4fd15db89844a7655bac2
parent55a3f945a9c7e0d833077809decd80f847d18b34 (diff)
downloadrt.equinox.framework-a9049f67902ad98d4fafbb721a73c29c806af6c8.tar.gz
rt.equinox.framework-a9049f67902ad98d4fafbb721a73c29c806af6c8.tar.xz
rt.equinox.framework-a9049f67902ad98d4fafbb721a73c29c806af6c8.zip
bug 222576 - Bidi characters in switch workspace
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c8
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseJNI.c23
-rw-r--r--bundles/org.eclipse.equinox.executable/library/make_version.mak2
4 files changed, 25 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
index 2661761af..6ad7da804 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
@@ -123,7 +123,7 @@ int showSplash( const _TCHAR* featureImage )
loadImageFns();
if (createWithURL && createAtIndex) {
- CFStringRef imageString = CFStringCreateWithCString(kCFAllocatorDefault, featureImage, kCFStringEncodingASCII);
+ CFStringRef imageString = CFStringCreateWithCString(kCFAllocatorDefault, featureImage, kCFStringEncodingUTF8);
if(imageString != NULL) {
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, imageString, kCFURLPOSIXPathStyle, false);
if(url != NULL) {
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
index eb89f4a50..4fb997846 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
@@ -72,11 +72,11 @@ void displayMessage(char *title, char *message)
if (c == '\n') c= ' ';
*to= c;
}
- inError= CFStringCreateWithCString(kCFAllocatorDefault, buffer, kCFStringEncodingASCII);
+ inError= CFStringCreateWithCString(kCFAllocatorDefault, buffer, kCFStringEncodingUTF8);
free(buffer);
- inDescription= CFStringCreateWithCString(kCFAllocatorDefault, pos+2, kCFStringEncodingASCII);
+ inDescription= CFStringCreateWithCString(kCFAllocatorDefault, pos+2, kCFStringEncodingUTF8);
} else {
- inError= CFStringCreateWithCString(kCFAllocatorDefault, message, kCFStringEncodingASCII);
+ inError= CFStringCreateWithCString(kCFAllocatorDefault, message, kCFStringEncodingUTF8);
}
init();
@@ -141,7 +141,7 @@ char * resolveSymlinks( char * path ) {
if(path == NULL)
return path;
- string = CFStringCreateWithCString(kCFAllocatorDefault, path, kCFStringEncodingASCII);
+ string = CFStringCreateWithCString(kCFAllocatorDefault, path, kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, string, kCFURLPOSIXPathStyle, false);
CFRelease(string);
if(url == NULL)
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
index f0e32f1bd..6ac45ce23 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
@@ -173,8 +173,19 @@ void setExitData(JNIEnv *env, jstring id, jstring s){
static const _TCHAR * JNI_GetStringChars(JNIEnv *env, jstring str) {
const _TCHAR * result = NULL;
#ifdef UNICODE
- result = (*env)->GetStringChars(env, str, 0);
+ /* GetStringChars is not null terminated, make a copy */
+ const _TCHAR * stringChars = (*env)->GetStringChars(env, str, 0);
+ int length = (*env)->GetStringLength(env, str);
+ _TCHAR * copy = malloc( (length + 1) * sizeof(_TCHAR));
+ _tcsncpy(copy, stringChars, length);
+ copy[length] = _T_ECLIPSE('\0');
+ (*env)->ReleaseStringChars(env, str, stringChars);
+ result = copy;
+#elif MACOSX
+ /* Use UTF on the Mac */
+ result = (*env)->GetStringUTFChars(env, str, 0);
#else
+ /* Other platforms, use java's default encoding */
_TCHAR* buffer = NULL;
jclass stringClass = (*env)->FindClass(env, "java/lang/String");
if (stringClass != NULL) {
@@ -202,7 +213,9 @@ static const _TCHAR * JNI_GetStringChars(JNIEnv *env, jstring str) {
/* Release the string that was obtained using JNI_GetStringChars */
static void JNI_ReleaseStringChars(JNIEnv *env, jstring s, const _TCHAR* data) {
#ifdef UNICODE
- (*env)->ReleaseStringChars(env, s, data);
+ free((_TCHAR*)data);
+#elif MACOSX
+ (*env)->ReleaseStringUTFChars(env, s, data);
#else
free((_TCHAR*)data);
#endif
@@ -211,11 +224,13 @@ static void JNI_ReleaseStringChars(JNIEnv *env, jstring s, const _TCHAR* data) {
static jstring newJavaString(JNIEnv *env, _TCHAR * str)
{
jstring newString = NULL;
- size_t length = _tcslen(str);
-
#ifdef UNICODE
+ size_t length = _tcslen(str);
newString = (*env)->NewString(env, str, length);
+#elif MACOSX
+ newString = (*env)->NewStringUTF(env, str);
#else
+ size_t length = _tcslen(str);
jbyteArray bytes = (*env)->NewByteArray(env, length);
if(bytes != NULL) {
(*env)->SetByteArrayRegion(env, bytes, 0, length, str);
diff --git a/bundles/org.eclipse.equinox.executable/library/make_version.mak b/bundles/org.eclipse.equinox.executable/library/make_version.mak
index 3662bd902..28addfcc8 100644
--- a/bundles/org.eclipse.equinox.executable/library/make_version.mak
+++ b/bundles/org.eclipse.equinox.executable/library/make_version.mak
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=1
-min_ver=113b
+min_ver=114
LIB_VERSION = $(maj_ver)$(min_ver)

Back to the top