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): NCAgÖÌÔ
+ ð 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: GfBAÌá¢ðzû·é½ßÉA
+ CFStringCreateFromExternalRepresentation Æ
+ CFStringCreateExternalRepresentation ðg¤æ¤ÉC³B
+
+ * AsciiConversionMode.cpp, KanjiConversionMode.cpp,
+ ClientConfiguration.cpp: T[o[ÖÌâ¢í¹ð Big Endian Éê
+ ·éæ¤ÉC³BܽAT[o[©çÌÔð Big Endian ¨ Host
+ Endian Ï··éæ¤ÉC³B
+
2006-03-18 Tomotaka SUWA <t.suw****@mac*****>
* UserDefaults.plist: óâEBhEÌtHgÆTCYðÏXB
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ÍAgpãÉK¸CFRelease·é±ÆB³àÈÎ[NB
- 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) {
// óâðÇÁ
- 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) {
// óâðÇÁ
- 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 è
// ÇÝÉ¢ÄÍSp¼¼Æ¼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 {
// ©È ¼¼@¨@-©È ¼¼
// ÇÝÉ¢ÄÍSp¼¼Æ¼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() {
// Sp¼¼Æ¼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) {
// óâðÇÁ
- 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) {
// óâðÇÁ
- 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 @@
// è¼¼ª³¯êνàÁ³ê¸»ÌÜÜRs[³êé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) {
// CCüÍð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 ³µ2oCg®
// +2 1t[É\¦·éóâÌ ³µ2oCg®
// +4 t[ ³µ2oCg®
//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() {
// EChEID(UInt16)ðÜÞCFDatað쬵AIÖé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[ÔðCNg
- 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() {
// EChEID(UInt16)ðÜÞCFDatað쬵AIÖé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[ÔðfNg
- 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() {
// EChEID(UInt16)ðÜÞCFDatað쬵AIÖé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) {
// ÇÁ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));
}