[aquaskk-changes 170] CVS update: AquaSKK

Zurück zum Archiv-Index

Tomotaka SUWA t-suw****@users*****
2006年 3月 22日 (水) 22:34:40 JST


Index: AquaSKK/AsciiConversionMode.cpp
diff -u AquaSKK/AsciiConversionMode.cpp:1.2.2.1 AquaSKK/AsciiConversionMode.cpp:1.2.2.2
--- AquaSKK/AsciiConversionMode.cpp:1.2.2.1	Sat Jan 14 20:01:58 2006
+++ AquaSKK/AsciiConversionMode.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: AsciiConversionMode.cpp,v 1.2.2.1 2006/01/14 11:01:58 t-suwa Exp $
+  $Id: AsciiConversionMode.cpp,v 1.2.2.2 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -662,7 +662,7 @@
 
     // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ª‘‚â‚·B
     current_candidate_index += candidates_window_cands_per_frame;
-    candidates_window_cands_per_frame = reply.getUInt16(0);
+    candidates_window_cands_per_frame = CFSwapInt16BigToHost(reply.getUInt16(0));
 }
 
 void AsciiConversionMode::goToPrevCandidatesFrame() {
@@ -675,7 +675,7 @@
     -- candidates_window_current_frame;
 
     // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ªŒ¸‚ç‚·B
-    candidates_window_cands_per_frame = reply.getUInt16(0);
+    candidates_window_cands_per_frame = CFSwapInt16BigToHost(reply.getUInt16(0));
     current_candidate_index -= candidates_window_cands_per_frame;
 }
 
Index: AquaSKK/BIM.cpp
diff -u AquaSKK/BIM.cpp:1.11.2.3 AquaSKK/BIM.cpp:1.11.2.4
--- AquaSKK/BIM.cpp:1.11.2.3	Sun Feb 19 13:50:54 2006
+++ AquaSKK/BIM.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: BIM.cpp,v 1.11.2.3 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: BIM.cpp,v 1.11.2.4 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -60,8 +60,7 @@
 
 enum {
     kAboutSKKMenuCommand = 'ABOU',
-    kPreferencesMenuCommand = 'PREF',
-    kRegisterWordMenuCommand = 'RGWR'
+    kPreferencesMenuCommand = 'PREF'
 };
 
 static MenuRef gPencilMenu;
@@ -441,15 +440,9 @@
 	case kAboutSKKMenuCommand:
 	    ServerConnectionFactory::theInstance().newConnection().send(kSKKShowAboutBox);
 	    break;
-	    
 	case kPreferencesMenuCommand:
 	    ServerConnectionFactory::theInstance().newConnection().send(kSKKShowPreferencesBox);
 	    break;
-            
-	case kRegisterWordMenuCommand:
-	    ServerConnectionFactory::theInstance().newConnection().send(kSKKShowWordRegistrationBox);
-	    break;
-            
 	default:
 	    BIMLog("unknown menu event[%d], index[%d]\n", command.commandID, command.menu.menuItemIndex);
 	    result = eventNotHandledErr;
Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.20.2.15 AquaSKK/ChangeLog:1.20.2.16
--- AquaSKK/ChangeLog:1.20.2.15	Sat Mar 18 02:30:14 2006
+++ AquaSKK/ChangeLog	Wed Mar 22 22:34:40 2006
@@ -1,3 +1,24 @@
+2006-03-22  Tomotaka SUWA  <t.suw****@mac*****>
+	
+	* BIM.cpp (BIMPencilMenuEventHandler): ’PŒê“o˜^—p‚̃R[ƒh‚ðœ‹ŽB
+
+	* ServerMessageReceiver.mm (messageReceived): ƒNƒ‰ƒCƒAƒ“ƒg‚Ö‚Ì•ÔŽ–
+	‚ð Big Endian ‚É“ˆêBŽóM‚µ‚½ ProcessSerialNumber ‚ð Big Endian ¨
+	Host Endian ‚É•ÏŠ·‚·‚é‚悤‚ɏC³B
+
+	* ServerConnection.cpp (createHeader): ƒT[ƒo[‚É‘—M‚·‚é
+	ProcessSerialNumber ‚ð Host Endian ¨ Big Endian ‚É•ÏŠ·‚·‚é‚悤‚ɏC
+	³B
+
+	* CppCFString.cpp: ƒGƒ“ƒfƒBƒAƒ“‚̈Ⴂ‚ð‹zŽû‚·‚邽‚߂ɁA
+	CFStringCreateFromExternalRepresentation ‚Æ
+	CFStringCreateExternalRepresentation ‚ðŽg‚¤‚悤‚ɏC³B
+
+	* AsciiConversionMode.cpp, KanjiConversionMode.cpp,
+	ClientConfiguration.cpp: ƒT[ƒo[‚Ö‚Ì–â‚¢‡‚킹‚ð Big Endian ‚É“ˆê
+	‚·‚é‚悤‚ɏC³B‚Ü‚½AƒT[ƒo[‚©‚ç‚Ì•ÔŽ–‚ð Big Endian ¨ Host
+	Endian •ÏŠ·‚·‚é‚悤‚ɏC³B
+
 2006-03-18  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* UserDefaults.plist: Œó•âƒEƒBƒ“ƒhƒE‚̃tƒHƒ“ƒg‚ƃTƒCƒY‚ð•ÏXB
Index: AquaSKK/ClientConfiguration.cpp
diff -u AquaSKK/ClientConfiguration.cpp:1.3.2.2 AquaSKK/ClientConfiguration.cpp:1.3.2.3
--- AquaSKK/ClientConfiguration.cpp:1.3.2.2	Sat Jan 14 20:01:58 2006
+++ AquaSKK/ClientConfiguration.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: ClientConfiguration.cpp,v 1.3.2.2 2006/01/14 11:01:58 t-suwa Exp $
+  $Id: ClientConfiguration.cpp,v 1.3.2.3 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -51,7 +51,7 @@
     CppCFData result = ServerConnectionFactory::theInstance().newConnection().send(msgid, kAquaSKKServerRunLoopMode);
     result.copyData(0, result.getLength(), &state);
 
-    return state;
+    return CFSwapInt32BigToHost(state);
 }
  
 ClientConfiguration& ClientConfiguration::reloadConfiguration() {
Index: AquaSKK/CppCFString.cpp
diff -u AquaSKK/CppCFString.cpp:1.3.2.2 AquaSKK/CppCFString.cpp:1.3.2.3
--- AquaSKK/CppCFString.cpp:1.3.2.2	Sat Jan 14 20:01:58 2006
+++ AquaSKK/CppCFString.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: CppCFString.cpp,v 1.3.2.2 2006/01/14 11:01:58 t-suwa Exp $
+  $Id: CppCFString.cpp,v 1.3.2.3 2006/03/22 13:34:40 t-suwa Exp $
 	
   MacOS X implementation of the SKK input method.
 
@@ -62,15 +62,9 @@
 }
 
 CppCFString::CppCFString(CFDataRef cfdata) : cf_string(0) {
-    // CFDataRef‚ÍUniChar‚Ì”z—ñ‚Å‚È‚¯‚ê‚΂Ȃç‚È‚¢B
-    const int size = CFDataGetLength(cfdata);
-    const int buflen = size / sizeof(UniChar);
-    UniChar* buf = new UniChar[buflen];
-
-    CFDataGetBytes(cfdata, CFRangeMake(0, size), reinterpret_cast<UInt8*>(buf));
-    cf_string = CFStringCreateMutable(NULL, 0);
-    CFStringAppendCharacters(cf_string, buf, buflen);
-    delete[] buf;
+    CFStringRef src = CFStringCreateFromExternalRepresentation(NULL, cfdata, kCFStringEncodingUnicode);
+    cf_string = CFStringCreateMutableCopy(NULL, 0, src);
+    CFRelease(src);
 }
 		
 CppCFString::~CppCFString() {
@@ -271,20 +265,9 @@
 
 CFMutableDataRef CppCFString::toCFData() const {
     // •Ô‚³‚ꂽCFDataRef‚́AŽg—pŒã‚É•K‚¸CFRelease‚·‚邱‚ƁB‚³‚à‚È‚­‚΃Š[ƒNB
-    const int len = CFStringGetLength(cf_string);
-    UniChar* unistr = const_cast<UniChar*>(CFStringGetCharactersPtr(cf_string));
-    bool unistr_is_independent = false;
-    if(unistr == NULL) {
-	unistr = new UniChar[len];
-	unistr_is_independent = true;
-	CFStringGetCharacters(cf_string, CFRangeMake(0, len), unistr);
-    }
-
-    unsigned int size = len * sizeof(UniChar);
-    CFMutableDataRef result = CFDataCreateMutable(NULL, size);
-    CFDataAppendBytes(result, reinterpret_cast<const UInt8*>(unistr), size);
-
-    if(unistr_is_independent) delete[] unistr;
+    CFDataRef src = CFStringCreateExternalRepresentation(NULL, cf_string, kCFStringEncodingUnicode, 0);
+    CFMutableDataRef result = CFDataCreateMutableCopy(NULL, 0, src);
+    CFRelease(src);
 
     return result;
 }
Index: AquaSKK/KanjiConversionMode.cpp
diff -u AquaSKK/KanjiConversionMode.cpp:1.2.2.1 AquaSKK/KanjiConversionMode.cpp:1.2.2.2
--- AquaSKK/KanjiConversionMode.cpp:1.2.2.1	Sat Jan 14 20:01:58 2006
+++ AquaSKK/KanjiConversionMode.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: KanjiConversionMode.cpp,v 1.2.2.1 2006/01/14 11:01:58 t-suwa Exp $
+  $Id: KanjiConversionMode.cpp,v 1.2.2.2 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -1011,30 +1011,27 @@
     static CppCFString space(" ");
     static CppCFString nbsp("[20]");
     
-    CppCFString reply(
-	ServerConnectionFactory::theInstance().newConnection().send(
-	    kSKKMessageSearch, query, kAquaSKKServerRunLoopMode).getData());
+    CppCFString reply(ServerConnectionFactory::theInstance().newConnection().
+		      send(kSKKMessageSearch, query, kAquaSKKServerRunLoopMode).getData());
 
     D_PRINTF("reply: %s\n", reply.toCString(kCFStringEncodingEUC_JP));
-    
+
     // ‹ó”’‚Å‹æØ‚éB
     candidates.clear();
     const int reply_len = reply.length();
     int blockstart = 0;
-    for (int i = 0;i < reply_len;i++) {
-	if (reply[i] == ' ') {
-	    if (i > blockstart) {
+    for(int i = 0; i < reply_len; ++ i) {
+	if(reply[i] == ' ') {
+	    if(i > blockstart) {
 		// Œó•â‚ð’ljÁ
-		addCandidate(
-		    reply.substring(blockstart,i).replace(nbsp,space),candidates);
+		addCandidate(reply.substring(blockstart, i).replace(nbsp, space), candidates);
 	    }
-	    blockstart = i+1;
+	    blockstart = i + 1;
 	}
     }
-    if (reply_len > blockstart) {
+    if(reply_len > blockstart) {
 	// Œó•â‚ð’ljÁ
-	addCandidate(
-	    reply.substring(blockstart,reply_len).replace(nbsp,space),candidates);
+	addCandidate(reply.substring(blockstart, reply_len).replace(nbsp, space), candidates);
     }
 }
 void addCandidate(const CppCFString& candidate, std::vector<CppCFString>& candidates) {
@@ -1052,7 +1049,7 @@
 
 void KanjiConversionMode::makeServerRemoveWord() {
     CppCFString query;
-    if (okuri.length() > 0) {
+    if(okuri.length() > 0) {
 	// ‚¨‚­‚è ‘—‚è@¨@+‚¨‚­r ‚è ‘—
 	// “ǂ݂ɂ‚¢‚Ä‚Í‘SŠp‰¼–¼‚Æ”¼Šp‰¼–¼‚𕽉¼–¼‚É•ÏŠ·
 	query.append('+');
@@ -1066,62 +1063,58 @@
 	}
 	query.append(' ').append(HiraganaInputMode::convert(okuri));
 	query.append(' ').append(candidates[current_candidate_index].clone().eraseLast(okuri.length())); // ‘—‚艼–¼‚ðÁ‚·B
-    }
-    else {
+    } else {
 	// ‚©‚È ‰¼–¼@¨@-‚©‚È ‰¼–¼
 	// “ǂ݂ɂ‚¢‚Ä‚Í‘SŠp‰¼–¼‚Æ”¼Šp‰¼–¼‚𕽉¼–¼‚É•ÏŠ·
 	query.append('-').append(HiraganaInputMode::convert(root)).append(' ');
 	query.append(candidates[current_candidate_index]);
     }
-    
+
     // ŽI‚É“n‚·
     CppCFData cfdata_query;
-	cfdata_query.own(query.toCFData());
+    cfdata_query.own(query.toCFData());
     ::makeServerRemoveWord(cfdata_query);
 }
 
 // ”ñƒƒ“ƒo
 void makeServerRemoveWord(const CppCFData& query) {
-    ServerConnectionFactory::theInstance().newConnection().send(
-	kSKKRemoveThisFromUserDic, query);
+    ServerConnectionFactory::theInstance().newConnection().send(kSKKRemoveThisFromUserDic, query);
 }
 
 void KanjiConversionMode::askServerTheCompletions() {
     // ‘SŠp‰¼–¼‚Æ”¼Šp‰¼–¼‚𕽉¼–¼‚É•ÏŠ·
     CppCFString query = HiraganaInputMode::convert(root);
-    
+
     // ŽI‚ɐq‚Ë‚é
     CppCFData cfdata_query;
-	cfdata_query.own(query.toCFData());
-	
+    cfdata_query.own(query.toCFData());
+
     current_completion_index = 0;
-    ::askServerTheCompletions(cfdata_query,completions);
+    ::askServerTheCompletions(cfdata_query, completions);
 }
 
 void askServerTheCompletions(const CppCFData& query, std::vector<CppCFString>& completions) {
-    CppCFString reply(
-	ServerConnectionFactory::theInstance().newConnection().send(
-	    kSKKFetchCompletions, query, kAquaSKKServerRunLoopMode).getData());
-    
     CppCFString space(" ");
     CppCFString nbsp("[20]");
-    
+    CppCFString reply(ServerConnectionFactory::theInstance().newConnection().
+		      send(kSKKFetchCompletions, query, kAquaSKKServerRunLoopMode).getData());
+
     // ‹ó”’‚Å‹æØ‚éB
     completions.clear();
     const int reply_len = reply.length();
     int blockstart = 0;
-    for (int i = 0;i < reply_len;i++) {
-	if (reply[i] == ' ') {
-	    if (i > blockstart) {
+    for(int i = 0; i < reply_len; ++ i) {
+	if(reply[i] == ' ') {
+	    if(i > blockstart) {
 		// Œó•â‚ð’ljÁ
-		completions.push_back(reply.substring(blockstart,i).replace(nbsp,space));
+		completions.push_back(reply.substring(blockstart, i).replace(nbsp, space));
 	    }
-	    blockstart = i+1;
+	    blockstart = i + 1;
 	}
     }
-    if (reply_len > blockstart) {
+    if(reply_len > blockstart) {
 	// Œó•â‚ð’ljÁ
-	completions.push_back(reply.substring(blockstart,reply_len).replace(nbsp,space));
+	completions.push_back(reply.substring(blockstart, reply_len).replace(nbsp, space));
     }
 }
 
@@ -1129,14 +1122,12 @@
 void sendWordToServerToRegister(const CppCFString& index,const CppCFString& okuri,const CppCFString& kanji) {
     CppCFString space(" ");
     CppCFString nbsp("[20]");
-    
+
     CppCFData query;
-	query.own(CppCFString().append('+').append(index.replaceClone(space,nbsp)).
-		    append(' ').append(okuri.replaceClone(space,nbsp)).
-		    append(' ').append(kanji.replaceClone(space,nbsp)).toCFData());
-    
-    ServerConnectionFactory::theInstance().newConnection().send(
-	kSKKRegisterThisToUserDic, query);
+    query.own(CppCFString().append('+').append(index.replaceClone(space,nbsp)).
+	      append(' ').append(okuri.replaceClone(space,nbsp)).
+	      append(' ').append(kanji.replaceClone(space,nbsp)).toCFData());
+    ServerConnectionFactory::theInstance().newConnection().send(kSKKRegisterThisToUserDic, query);
 }
 
 void sendWordToServerToRegister(const CppCFString& index,const CppCFString& kanji) {
@@ -1150,15 +1141,14 @@
     static CppCFString semicolon_ref("[3b]");
     
     CppCFString encoded_kanji = 
-	kanji.replaceClone(blockopen,blockopen_ref).replace(slash,slash_ref).
-	replace(semicolon,semicolon_ref).replace(space,nbsp);
-    
+	kanji.replaceClone(blockopen, blockopen_ref).replace(slash, slash_ref).
+	replace(semicolon, semicolon_ref).replace(space,nbsp);
+
     CppCFData query;
-	query.own(CppCFString().append('-').append(index.replaceClone(space,nbsp)).
-		    append(' ').append(encoded_kanji).toCFData());
-    
-    ServerConnectionFactory::theInstance().newConnection().send(
-	kSKKRegisterThisToUserDic, query);
+    query.own(CppCFString().append('-').append(index.replaceClone(space, nbsp)).
+	      append(' ').append(encoded_kanji).toCFData());
+
+    ServerConnectionFactory::theInstance().newConnection().send(kSKKRegisterThisToUserDic, query);
 }
 
 void KanjiConversionMode::openCandidatesWindow(OpenDirection mode) {
@@ -1166,48 +1156,38 @@
     // ‘—‚艼–¼‚ª–³‚¯‚ê‚Ή½‚àÁ‚³‚ꂸ‚»‚̂܂܃Rƒs[‚³‚ê‚éB
     CppCFString space(" ");
     CppCFString nbsp("[20]");
-    
+
     std::vector<CppCFString> cands_without_okuri;
     unsigned okuri_length = okuri.length();
-    if (okuri_length > 0) {
-	for (std::vector<CppCFString>::const_iterator ite = candidates.begin() +
-		 (show_cands_window_after_Nth_cand-1);
-	     ite != candidates.end();
-	     ite++) {
-	    cands_without_okuri.push_back(
-		ite->substring(0,ite->length() - okuri_length).replace(space,nbsp));
+    if(okuri_length > 0) {
+	for(std::vector<CppCFString>::const_iterator ite = candidates.begin() + (show_cands_window_after_Nth_cand - 1);
+	    ite != candidates.end(); ++ ite) {
+	    cands_without_okuri.push_back(ite->substring(0, ite->length() - okuri_length).replace(space, nbsp));
 	}
-    }
-    else {
-	for (std::vector<CppCFString>::const_iterator ite = candidates.begin() +
-		 (show_cands_window_after_Nth_cand-1);
-	     ite != candidates.end();
-	     ite++) {
+    } else {
+	for(std::vector<CppCFString>::const_iterator ite = candidates.begin() + (show_cands_window_after_Nth_cand - 1);
+	    ite != candidates.end(); ++ ite) {
 	    cands_without_okuri.push_back(ite->replaceClone(space,nbsp));
-	} 
+	}
     }
-    
-    ::openCandidatesWindow(join(' ',cands_without_okuri),
+
+    ::openCandidatesWindow(join(' ', cands_without_okuri),
 			   candidates_window_id,
 			   candidates_window_cands_per_frame,
 			   candidates_window_num_of_frames,
 			   candidates_window_current_frame,
-			   current_candidate_index,
-			   candidates.size(),
-			   mode);
+			   current_candidate_index, candidates.size(), mode);
 }
 
 // ”ñƒƒ“ƒo
-void openCandidatesWindow(
-    const CppCFString& str_candidates,
-    unsigned& window_id,
-    unsigned& cands_per_frame,
-    unsigned& num_of_frames,
-    unsigned& current_frame,
-    unsigned& current_index,
-    size_t num_of_candidates,
-    SInt16 open_direction) {
-    
+void openCandidatesWindow(const CppCFString& str_candidates,
+			  unsigned& window_id,
+			  unsigned& cands_per_frame,
+			  unsigned& num_of_frames,
+			  unsigned& current_frame,
+			  unsigned& current_index,
+			  size_t num_of_candidates,
+			  SInt16 open_direction) {
     // ƒCƒ“ƒ‰ƒCƒ““ü—Í‚ðs‚Á‚Ä‚¢‚éˆÊ’u‚ðŽæ“¾B
     struct OffsetToPosParams offset_to_pos_params;
     offset_to_pos_params.fRefCon = 0;
@@ -1218,26 +1198,28 @@
     BIMHandleOffsetToPos(&offset_to_pos_params);
     SInt16 qd_x = offset_to_pos_params.fReplyPoint.h;
     SInt16 qd_y = offset_to_pos_params.fReplyPoint.v;
-    
+
     // ƒT[ƒo[‚É‘—‚è•t‚¯‚éCFData‚ðì¬B
-	CppCFData cands_to_be_attached;
-	cands_to_be_attached.own(str_candidates.toCFData());
+    CppCFData cands_to_be_attached;
+    cands_to_be_attached.own(str_candidates.toCFData());
     CppCFData attachment;
-    attachment.append(qd_x).append(qd_y).append(open_direction).append(cands_to_be_attached);
-    
+    attachment.append(CFSwapInt16HostToBig(qd_x));
+    attachment.append(CFSwapInt16HostToBig(qd_y));
+    attachment.append(CFSwapInt16HostToBig(open_direction));
+    attachment.append(cands_to_be_attached);
+
     // ‘—ŽóM
-    CppCFData reply(
-	ServerConnectionFactory::theInstance().newConnection().send(
-	    kSKKCreateCandidatesWindow, attachment, kAquaSKKServerRunLoopMode));
-    
+    CppCFData reply(ServerConnectionFactory::theInstance().newConnection().
+		    send(kSKKCreateCandidatesWindow, attachment, kAquaSKKServerRunLoopMode));
+
     // •Ô‚Á‚Ä‚«‚½ƒf[ƒ^‚ð•ª‰ð‚µ‚Ä•Û‘¶B
     // +0  Œó•â‘I‘ð‰æ–ÊID             •„†–³‚µ2ƒoƒCƒg®”
     // +2  1ƒtƒŒ[ƒ€‚É•\Ž¦‚·‚éŒó•â‚̐”  •„†–³‚µ2ƒoƒCƒg®”
     // +4  ƒtƒŒ[ƒ€”                 •„†–³‚µ2ƒoƒCƒg®”
     //CppCFData reply(reply_data);
-    window_id = reply.getUInt16(0);
-    cands_per_frame = reply.getUInt16(2);
-    num_of_frames = reply.getUInt16(4);
+    window_id = CFSwapInt16BigToHost(reply.getUInt16(0));
+    cands_per_frame = CFSwapInt16BigToHost(reply.getUInt16(2));
+    num_of_frames = CFSwapInt16BigToHost(reply.getUInt16(4));
 
     if(open_direction == OpenReverse) {
 	current_frame = num_of_frames - 1;
@@ -1250,46 +1232,41 @@
 // ”ñƒƒ“ƒo
 CppCFData newCFDataRefWithWindowID(unsigned window_id) {
     CppCFData result;
-    result.append(static_cast<UInt16>(window_id));
-    
+    result.append(static_cast<UInt16>(CFSwapInt16HostToBig(window_id)));
+
     return result;
 }
 
 void KanjiConversionMode::goToNextCandidatesFrame() {
     // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    CppCFData reply(
-	ServerConnectionFactory::theInstance().newConnection().send(
-	    kSKKCandidatesWindowNext,
-	    newCFDataRefWithWindowID(candidates_window_id),
-	    kAquaSKKServerRunLoopMode));
-    
+    CppCFData reply(ServerConnectionFactory::theInstance().newConnection().
+		    send(kSKKCandidatesWindowNext, newCFDataRefWithWindowID(candidates_window_id),
+			 kAquaSKKServerRunLoopMode));
+
     // Œ»Ý‚̃tƒŒ[ƒ€”ԍ†‚ðƒCƒ“ƒNƒŠƒƒ“ƒg
-    candidates_window_current_frame++;
-    
+    ++ candidates_window_current_frame;
+
     // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ª‘‚â‚·B
     current_candidate_index += candidates_window_cands_per_frame;
-    candidates_window_cands_per_frame = reply.getUInt16(0);
+    candidates_window_cands_per_frame = CFSwapInt16BigToHost(reply.getUInt16(0));
 }
 
 void KanjiConversionMode::goToPrevCandidatesFrame() {
     // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    CppCFData reply(
-	ServerConnectionFactory::theInstance().newConnection().send(
-	    kSKKCandidatesWindowPrev,
-	    newCFDataRefWithWindowID(candidates_window_id),
-	    kAquaSKKServerRunLoopMode));
-    
+    CppCFData reply(ServerConnectionFactory::theInstance().newConnection().
+		    send(kSKKCandidatesWindowPrev, newCFDataRefWithWindowID(candidates_window_id),
+			 kAquaSKKServerRunLoopMode));
+
     // Œ»Ý‚̃tƒŒ[ƒ€”ԍ†‚ðƒfƒNƒŠƒƒ“ƒg
-    candidates_window_current_frame--;
-    
+    -- candidates_window_current_frame;
+
     // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ªŒ¸‚ç‚·B
-    candidates_window_cands_per_frame = reply.getUInt16(0);
+    candidates_window_cands_per_frame = CFSwapInt16BigToHost(reply.getUInt16(0));
     current_candidate_index -= candidates_window_cands_per_frame;
 }
 
 void KanjiConversionMode::closeCandidatesWindow() {
     // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    ServerConnectionFactory::theInstance().newConnection().send(
-	kSKKCloseCandidatesWindow,
-	newCFDataRefWithWindowID(candidates_window_id));
+    ServerConnectionFactory::theInstance().newConnection().
+	send(kSKKCloseCandidatesWindow, newCFDataRefWithWindowID(candidates_window_id));
 }
Index: AquaSKK/ServerConnection.cpp
diff -u AquaSKK/ServerConnection.cpp:1.2.2.1 AquaSKK/ServerConnection.cpp:1.2.2.2
--- AquaSKK/ServerConnection.cpp:1.2.2.1	Sat Jan  7 16:22:29 2006
+++ AquaSKK/ServerConnection.cpp	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: ServerConnection.cpp,v 1.2.2.1 2006/01/07 07:22:29 t-suwa Exp $
+  $Id: ServerConnection.cpp,v 1.2.2.2 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -40,6 +40,11 @@
     BasicMessageHeader header;
     GetCurrentProcess(&header.fProcessSerialNumber);
 
+    // PSN を Big Endian にする
+#define Host2Big32(arg)	arg = CFSwapInt32HostToBig(arg)
+    Host2Big32(header.fProcessSerialNumber.highLongOfPSN);
+    Host2Big32(header.fProcessSerialNumber.lowLongOfPSN);
+
     return CppCFData(&header, sizeof(BasicMessageHeader));
 }
 
Index: AquaSKK/ServerMessageReceiver.mm
diff -u AquaSKK/ServerMessageReceiver.mm:1.4.2.4 AquaSKK/ServerMessageReceiver.mm:1.4.2.5
--- AquaSKK/ServerMessageReceiver.mm:1.4.2.4	Sat Feb 25 16:27:32 2006
+++ AquaSKK/ServerMessageReceiver.mm	Wed Mar 22 22:34:40 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: ServerMessageReceiver.mm,v 1.4.2.4 2006/02/25 07:27:32 t-suwa Exp $
+  $Id: ServerMessageReceiver.mm,v 1.4.2.5 2006/03/22 13:34:40 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -57,6 +57,11 @@
 	packet.copyData(0, sizeof(BasicMessageHeader), &header);
     }
 
+    // PSN ‚ð Host Endian ‚É–ß‚·
+#define Big2Host32(arg)	arg = CFSwapInt32BigToHost(arg)
+    Big2Host32(header.fProcessSerialNumber.highLongOfPSN);
+    Big2Host32(header.fProcessSerialNumber.lowLongOfPSN);
+
     CppCFData body;
     if(packet.getLength() > sizeof(BasicMessageHeader)) {
 	body = packet.subdata(sizeof(BasicMessageHeader));
@@ -120,7 +125,7 @@
     case kBasicMessageKbdLayoutId:
 	reply = valueForKey(KEY_keyboard_layout_id);
 	break; 
-   default:
+    default:
 	break;
     }
 
@@ -137,9 +142,9 @@
 
 CppCFData ServerMessageReceiver::createCandidatesWindow(const CppCFData& attachment) {
     // ’ljÁƒf[ƒ^‚Æ‚µ‚ÄQuickDrawÀ•W‚ÆUniChar‚Ì”z—ñ‚ðŽæ‚éB
-    int qd_x = attachment.getSInt16(0);
-    int qd_y = attachment.getSInt16(2);
-    int showLast = attachment.getSInt16(4);
+    int qd_x = CFSwapInt16BigToHost(attachment.getSInt16(0));
+    int qd_y = CFSwapInt16BigToHost(attachment.getSInt16(2));
+    int showLast = CFSwapInt16BigToHost(attachment.getSInt16(4));
     CppCFString candidates(attachment.subdata(6).getData());
 
     CandidatesManager& cm = CandidatesManager::sharedManager();
@@ -150,15 +155,15 @@
     unsigned num_of_frames = [cwc getNumOfFrames];
 
     CppCFData reply;
-    reply.append(static_cast<UInt16>(window_id));
-    reply.append(static_cast<UInt16>(cands_per_frame));
-    reply.append(static_cast<UInt16>(num_of_frames));
+    reply.append(static_cast<UInt16>(CFSwapInt16HostToBig(window_id)));
+    reply.append(static_cast<UInt16>(CFSwapInt16HostToBig(cands_per_frame)));
+    reply.append(static_cast<UInt16>(CFSwapInt16HostToBig(num_of_frames)));
 
     return reply;
 }
 
 CppCFData ServerMessageReceiver::candidatesWindowNext(const CppCFData& attachment) {
-    unsigned window_id = attachment.getUInt16(0);
+    unsigned window_id = CFSwapInt16BigToHost(attachment.getUInt16(0));
 
     CandidatesManager& cm = CandidatesManager::sharedManager();
     cm.windowNext(window_id);
@@ -166,13 +171,13 @@
     CandidatesWindowController* cwc = cm.getWindowController(window_id);
     unsigned cands_per_frame = [cwc getCandidatesPerFrame];
     CppCFData reply;
-    reply.append(static_cast<UInt16>(cands_per_frame));
+    reply.append(static_cast<UInt16>(CFSwapInt16HostToBig(cands_per_frame)));
 
     return reply;
 }
 
 CppCFData ServerMessageReceiver::candidatesWindowPrev(const CppCFData& attachment) {
-    unsigned window_id = attachment.getUInt16(0);
+    unsigned window_id = CFSwapInt16BigToHost(attachment.getUInt16(0));
 
     CandidatesManager& cm = CandidatesManager::sharedManager();
     cm.windowPrev(window_id);
@@ -180,13 +185,13 @@
     CandidatesWindowController* cwc = cm.getWindowController(window_id);
     unsigned cands_per_frame = [cwc getCandidatesPerFrame];
     CppCFData reply;
-    reply.append(static_cast<UInt16>(cands_per_frame));
+    reply.append(static_cast<UInt16>(CFSwapInt16HostToBig(cands_per_frame)));
 
     return reply;
 }
 
 void ServerMessageReceiver::closeCandidatesWindow(const CppCFData& attachment) {
-    CandidatesManager::sharedManager().closeWindow(attachment.getUInt16(0));
+    CandidatesManager::sharedManager().closeWindow(CFSwapInt16BigToHost(attachment.getUInt16(0)));
 }
 
 void ServerMessageReceiver::registerThisToUserDic(const CppCFData& attachment) {
@@ -217,7 +222,7 @@
 }
 
 CppCFData ServerMessageReceiver::valueForKey(NSString* key) {
-    int result = [[NSUserDefaults standardUserDefaults] integerForKey:key];
+    int result = CFSwapInt16HostToBig([[NSUserDefaults standardUserDefaults] integerForKey:key]);
 
     return CppCFData(&result, sizeof(result));
 }


aquaskk-changes メーリングリストの案内
Zurück zum Archiv-Index