• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revision4bf2da0a7dd6992182cb0cc9afc800405eec34cc (tree)
Time2011-10-16 23:12:58
Authors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Fix bugs of importing INI file created by 1.97b or earlier.

Change Summary

Incremental Difference

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/registory.c
+++ b/registory.c
@@ -99,6 +99,9 @@ static int IsMasterPasswordError = PASSWORD_OK;
9999 static int IsRndSourceInit = 0;
100100 static ulong RndSource[9];
101101
102+// UTF-8対応
103+static int IniKanjiCode = KANJI_NOCNV;
104+
102105 /*===== 外部参照 =====*/
103106
104107 /* 設定値 */
@@ -638,6 +641,9 @@ int LoadRegistory(void)
638641 Sts = YES;
639642
640643 ReadIntValueFromReg(hKey3, "Version", &Version);
644+ // UTF-8対応
645+ if(Version < 1980)
646+ IniKanjiCode = KANJI_SJIS;
641647
642648 if(OpenSubKey(hKey3, "Options", &hKey4) == FFFTP_SUCCESS)
643649 {
@@ -2260,6 +2266,10 @@ static int ReadStringFromReg(void *Handle, char *Name, char *Str, DWORD Size)
22602266 {
22612267 int Sts;
22622268 char *Pos;
2269+ // UTF-8対応
2270+ char* pa0;
2271+ wchar_t* pw0;
2272+ DWORD TempSize;
22632273
22642274 Sts = FFFTP_FAIL;
22652275 if(TmpRegType == REGTYPE_REG)
@@ -2275,10 +2285,37 @@ static int ReadStringFromReg(void *Handle, char *Name, char *Str, DWORD Size)
22752285 {
22762286 if((Pos = ScanValue(Handle, Name)) != NULL)
22772287 {
2278- Size = min1(Size-1, strlen(Pos));
2279- Size = StrReadIn(Pos, Size, Str);
2280- *(Str + Size) = NUL;
2281- Sts = FFFTP_SUCCESS;
2288+ // UTF-8対応
2289+// Size = min1(Size-1, strlen(Pos));
2290+// Size = StrReadIn(Pos, Size, Str);
2291+// *(Str + Size) = NUL;
2292+// Sts = FFFTP_SUCCESS;
2293+ switch(IniKanjiCode)
2294+ {
2295+ case KANJI_SJIS:
2296+ if(pa0 = AllocateStringA(Size * 4))
2297+ {
2298+ if(pw0 = AllocateStringW(Size * 4 * 4))
2299+ {
2300+ TempSize = min1((Size * 4) - 1, strlen(Pos));
2301+ TempSize = StrReadIn(Pos, TempSize, pa0);
2302+ *(pa0 + TempSize) = NUL;
2303+ AtoW(pw0, Size * 4 * 4, pa0, -1);
2304+ WtoM(Str, Size, pw0, -1);
2305+ TerminateStringM(Str, Size);
2306+ Sts = FFFTP_SUCCESS;
2307+ FreeDuplicatedString(pw0);
2308+ }
2309+ FreeDuplicatedString(pa0);
2310+ }
2311+ break;
2312+ case KANJI_NOCNV:
2313+ Size = min1(Size-1, strlen(Pos));
2314+ Size = StrReadIn(Pos, Size, Str);
2315+ *(Str + Size) = NUL;
2316+ Sts = FFFTP_SUCCESS;
2317+ break;
2318+ }
22822319 }
22832320 }
22842321 return(Sts);