[aquaskk-changes 443] CVS update: AquaSKK

Back to archive index

t-suw****@users***** t-suw****@users*****
2008年 1月 19日 (土) 22:37:04 JST


Index: AquaSKK/CppCFString.cpp
diff -u AquaSKK/CppCFString.cpp:1.6 AquaSKK/CppCFString.cpp:1.7
--- AquaSKK/CppCFString.cpp:1.6	Mon Dec 18 00:05:41 2006
+++ AquaSKK/CppCFString.cpp	Sat Jan 19 22:37:04 2008
@@ -1,5 +1,5 @@
 /*
-  $Id: CppCFString.cpp,v 1.6 2006/12/17 15:05:41 t-suwa Exp $
+  $Id: CppCFString.cpp,v 1.7 2008/01/19 13:37:04 t-suwa Exp $
 	
   MacOS X implementation of the SKK input method.
 
@@ -100,7 +100,11 @@
 }
 
 CppCFString::CppCFString(CFStringRef cf_string_src) : cf_string(0) {
-    cf_string = CFStringCreateMutableCopy(NULL, 0, cf_string_src);
+    if(cf_string_src != 0) {
+	cf_string = CFStringCreateMutableCopy(NULL, 0, cf_string_src);
+    } else {
+	cf_string = CFStringCreateMutable(NULL, 0);
+    }
 }
 
 CppCFString::CppCFString(const UniChar* uni_string, unsigned int len) : cf_string(0) {
Index: AquaSKK/WordRegisterMode.cpp
diff -u AquaSKK/WordRegisterMode.cpp:1.6 AquaSKK/WordRegisterMode.cpp:1.7
--- AquaSKK/WordRegisterMode.cpp:1.6	Mon Dec 18 00:05:41 2006
+++ AquaSKK/WordRegisterMode.cpp	Sat Jan 19 22:37:04 2008
@@ -1,5 +1,5 @@
 /*
-  $Id: WordRegisterMode.cpp,v 1.6 2006/12/17 15:05:41 t-suwa Exp $
+  $Id: WordRegisterMode.cpp,v 1.7 2008/01/19 13:37:04 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -136,26 +136,31 @@
 	if(PasteboardGetItemIdentifier(pasteboard, pos + 1, &id) < 0) continue;
 
 	CFDataRef data;
-	CppCFString str;
+	CFStringRef tmp;
 	if(PasteboardCopyItemFlavorData(pasteboard, id, CFSTR("public.utf8-plain-text"), &data) == 0) {
-	    CFStringRef tmp = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(data), CFDataGetLength(data),
-						      kCFStringEncodingUTF8, false);
-	    str = CppCFString(tmp);
-	    CFRelease(tmp);
+	    tmp = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(data), CFDataGetLength(data),
+					  kCFStringEncodingUTF8, false);
 	} else {
 	    if(PasteboardCopyItemFlavorData(pasteboard, id, CFSTR("com.apple.traditional-mac-plain-text"), &data) < 0) {
 		continue;
 	    }
-	    CFStringRef tmp = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(data), CFDataGetLength(data),
-						      CFStringGetSystemEncoding(), false);
-	    str = CppCFString(tmp);
+	    tmp = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(data), CFDataGetLength(data),
+					  CFStringGetSystemEncoding(), false);
+	}
+
+	if(tmp) {
+	    CppCFString str(tmp);
+
+	    buffer.insert(caret, str);
+	    caret += str.length();
+	    display(CppCFString());
+
 	    CFRelease(tmp);
 	}
-	CFRelease(data);
 
-	buffer.insert(caret, str);
-	caret += str.length();
-	display(CppCFString());
+	if(data) {
+	    CFRelease(data);
+	}
 
 	break;
     }


aquaskk-changes メーリングリストの案内
Back to archive index