[aquaskk-changes 268] CVS update: AquaSKK

Back to archive index

Tomotaka SUWA t-suw****@users*****
2006年 12月 9日 (土) 09:58:29 JST


Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.33.2.4 AquaSKK/ChangeLog:1.33.2.5
--- AquaSKK/ChangeLog:1.33.2.4	Fri Dec  8 23:38:57 2006
+++ AquaSKK/ChangeLog	Sat Dec  9 09:58:29 2006
@@ -1,3 +1,9 @@
+2006-12-09  Tomotaka SUWA  <t.suw****@mac*****>
+
+	* CppCFString.cpp (CppCFString::toCString): len * ratio ‚ÅŠ„‚è“–‚Ä
+	‚½ƒoƒbƒtƒ@‚̃TƒCƒY‚ðAlen * (ratio + 1) ‚Æ‚µ‚Ä•ÏŠ·ŠÖ”‚É“n‚µ‚Ä‚¢‚½
+	•s‹ï‡‚ðC³B
+
 2006-12-08  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* NumericConverter.*: UTF-8 ‰»BCppCFString ‚ð std::string ‚É’uŠ·B
Index: AquaSKK/CppCFString.cpp
diff -u AquaSKK/CppCFString.cpp:1.5 AquaSKK/CppCFString.cpp:1.5.2.1
--- AquaSKK/CppCFString.cpp:1.5	Fri May  5 00:27:02 2006
+++ AquaSKK/CppCFString.cpp	Sat Dec  9 09:58:29 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: CppCFString.cpp,v 1.5 2006/05/04 15:27:02 t-suwa Exp $
+  $Id: CppCFString.cpp,v 1.5.2.1 2006/12/09 00:58:29 t-suwa Exp $
 	
   MacOS X implementation of the SKK input method.
 
@@ -344,17 +344,15 @@
     // •Ô‚³‚ꂽchar*‚́AŽg—pŒã‚É•K‚¸delete[]‚·‚邱‚ƁB‚³‚à‚È‚­‚΃Š[ƒNB
     const int len = CFStringGetLength(cf_string);
     char* buf = NULL;
-	
+
     if(len == 0) {
 	buf = new char[1];
 	buf[0] = 0;
     } else {
-	int ratio = 3;
-	do {
-	    if(buf) delete[] buf;
-	    buf = new char[len * ratio];
-	    ++ ratio;
-	} while(!CFStringGetCString(cf_string, buf, len * ratio, encoding));
+	int bufsize = CFStringGetMaximumSizeForEncoding(len, encoding);
+	bufsize += 1;		// for NULL terminator
+	buf = new char[bufsize];
+	CFStringGetCString(cf_string, buf, bufsize, encoding);
     }
     return buf;
 }


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