OSDN Git Service

Modify documents.
[ffftp/ffftp.git] / filelist.c
index b3e1da2..74d14bb 100644 (file)
@@ -124,6 +124,8 @@ extern int RemoteWidth;
 extern int ListHeight;\r
 extern char FilterStr[FILTER_EXT_LEN+1];\r
 extern HWND hHelpWin;\r
+// 外部アプリケーションへドロップ後にローカル側のファイル一覧に作業フォルダが表示されるバグ対策\r
+extern int SuppressRefresh;\r
 \r
 /* 設定値 */\r
 extern int LocalWidth;\r
@@ -183,6 +185,9 @@ int MakeListWin(HWND hWnd, HINSTANCE hInst)
        LV_COLUMN LvCol;\r
        long Tmp;\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvCol, 0, sizeof(LV_COLUMN));\r
+\r
        /*===== ローカル側のリストビュー =====*/\r
 \r
        hWndListLocal = CreateWindowEx(/*WS_EX_STATICEDGE*/WS_EX_CLIENTEDGE,\r
@@ -495,6 +500,11 @@ static void doTransferRemoteFile(void)
                remove(fn);\r
        }\r
 \r
+       // 同時接続対応\r
+       DisableUserOpe();\r
+       // 外部アプリケーションへドロップ後にローカル側のファイル一覧に作業フォルダが表示されるバグ対策\r
+       SuppressRefresh = 1;\r
+\r
        // ダウンロード先をテンポラリに設定\r
        SetLocalDirHist(TmpDir);\r
 \r
@@ -526,6 +536,12 @@ static void doTransferRemoteFile(void)
        SetLocalDirHist(LocDir);\r
        SetCurrentDirAsDirHist();\r
 \r
+       // 外部アプリケーションへドロップ後にローカル側のファイル一覧に作業フォルダが表示されるバグ対策\r
+       SuppressRefresh = 0;\r
+       GetLocalDirForWnd();\r
+       // 同時接続対応\r
+       EnableUserOpe();\r
+\r
        remoteFileListBase = FileListBase;  // あとでフリーすること\r
        remoteFileListBaseNoExpand = FileListBaseNoExpand;  // あとでフリーすること\r
        strncpy_s(remoteFileDir, sizeof(remoteFileDir), TmpDir, _TRUNCATE);\r
@@ -1125,6 +1141,9 @@ void GetListTabWidth(void)
        LV_COLUMN LvCol;\r
        int i;\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvCol, 0, sizeof(LV_COLUMN));\r
+\r
        for(i = 0; i <= 3; i++)\r
        {\r
                LvCol.mask = LVCF_WIDTH;\r
@@ -1525,20 +1544,36 @@ static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LON
 \r
                        if((Sort & SORT_GET_ORD) == SORT_ASCENT)\r
                        {\r
-                               if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
-                                       ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) < 0)) ||\r
+                               // 読みにくいのでリファクタリング\r
+//                             if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+//                                     ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) < 0)) ||\r
+//#if defined(HAVE_TANDEM)\r
+//                                ((AskHostType() == HTYPE_TANDEM) &&\r
+//                                 ((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+//                                     ((Cmp = Attr - Pos->Attr) < 0)) ||\r
+//#endif\r
+//                                (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
+//                                     ((Cmp = Size - Pos->Size) < 0)) ||\r
+//                                (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
+//                                     ((Cmp = CompareFileTime(Time, &Pos->Time)) < 0)))\r
+//                             {\r
+//                                     break;\r
+//                             }\r
+                               if(((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+                                       ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) < 0))\r
+                                       break;\r
 #if defined(HAVE_TANDEM)\r
-                                  ((AskHostType() == HTYPE_TANDEM) &&\r
-                                   ((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
-                                       ((Cmp = Attr - Pos->Attr) < 0)) ||\r
+                               if((AskHostType() == HTYPE_TANDEM) &&\r
+                                       ((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+                                       ((Cmp = Attr - Pos->Attr) < 0))\r
+                                       break;\r
 #endif\r
-                                  (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
-                                       ((Cmp = Size - Pos->Size) < 0)) ||\r
-                                  (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
-                                       ((Cmp = CompareFileTime(Time, &Pos->Time)) < 0)))\r
-                               {\r
+                               if(((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
+                                       ((Cmp = Size - Pos->Size) < 0))\r
+                                       break;\r
+                               if(((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
+                                       ((Cmp = CompareFileTime(Time, &Pos->Time)) < 0))\r
                                        break;\r
-                               }\r
 \r
                                if(((Sort & SORT_MASK_ORD) == SORT_NAME) || (Cmp == 0))\r
                                {\r
@@ -1692,6 +1727,8 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size,
        if(Pos == -1)\r
                Pos = SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        /* アイコン/ファイル名 */\r
        LvItem.mask = LVIF_TEXT | LVIF_IMAGE;\r
        LvItem.iItem = Pos;\r
@@ -1814,6 +1851,8 @@ void SelectFileInList(HWND hWnd, int Type)
        FILETIME Time2;\r
        int Find;\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        Win = WIN_LOCAL;\r
        WinDst = WIN_REMOTE;\r
        if(hWnd == GetRemoteHwnd())\r
@@ -1994,6 +2033,8 @@ void FindFileInList(HWND hWnd, int Type)
        LV_ITEM LvItem;\r
        char *Title;\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        Win = WIN_LOCAL;\r
        Title = MSGJPN050;\r
        if(hWnd == GetRemoteHwnd())\r
@@ -2275,6 +2316,8 @@ int FindNameNode(int Win, char *Name)
        if(Win == WIN_REMOTE)\r
                hWnd = GetRemoteHwnd();\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&FindInfo, 0, sizeof(LV_FINDINFO));\r
        FindInfo.flags = LVFI_STRING;\r
        FindInfo.psz = Name;\r
        return(SendMessage(hWnd, LVM_FINDITEM, -1, (LPARAM)&FindInfo));\r
@@ -2302,6 +2345,8 @@ void GetNodeName(int Win, int Pos, char *Buf, int Max)
        if(Win == WIN_REMOTE)\r
                hWnd = GetRemoteHwnd();\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        LvItem.mask = LVIF_TEXT;\r
        LvItem.iItem = Pos;\r
        LvItem.iSubItem = 0;\r
@@ -2335,6 +2380,8 @@ int GetNodeTime(int Win, int Pos, FILETIME *Buf)
        if(Win == WIN_REMOTE)\r
                hWnd = GetRemoteHwnd();\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        LvItem.mask = LVIF_TEXT;\r
        LvItem.iItem = Pos;\r
        LvItem.iSubItem = 1;\r
@@ -2369,6 +2416,8 @@ int GetNodeSize(int Win, int Pos, LONGLONG *Buf)
        if(Win == WIN_REMOTE)\r
                hWnd = GetRemoteHwnd();\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        LvItem.mask = LVIF_TEXT;\r
        LvItem.iItem = Pos;\r
        LvItem.iSubItem = 2;\r
@@ -2416,6 +2465,8 @@ int GetNodeAttr(int Win, int Pos, int *Buf)
        Ret = NO;\r
        if(Win == WIN_REMOTE)\r
        {\r
+               // 変数が未初期化のバグ修正\r
+               memset(&LvItem, 0, sizeof(LV_ITEM));\r
                LvItem.mask = LVIF_TEXT;\r
                LvItem.iItem = Pos;\r
 #if defined(HAVE_TANDEM)\r
@@ -2463,6 +2514,8 @@ int GetNodeType(int Win, int Pos)
        if(Win == WIN_REMOTE)\r
                hWnd = GetRemoteHwnd();\r
 \r
+       // 変数が未初期化のバグ修正\r
+       memset(&LvItem, 0, sizeof(LV_ITEM));\r
        LvItem.mask = LVIF_TEXT;\r
        LvItem.iItem = Pos;\r
        LvItem.iSubItem = 2;\r
@@ -2500,6 +2553,8 @@ void GetNodeOwner(int Win, int Pos, char *Buf, int Max)
        strcpy(Buf, "");\r
        if(Win == WIN_REMOTE)\r
        {\r
+               // 変数が未初期化のバグ修正\r
+               memset(&LvItem, 0, sizeof(LV_ITEM));\r
                LvItem.mask = LVIF_TEXT;\r
                LvItem.iItem = Pos;\r
                LvItem.iSubItem = 5;\r
@@ -2599,6 +2654,9 @@ void MakeSelectedFileList(int Win, int Expand, int All, FILELIST **Base, int *Ca
                        if((Node == NODE_FILE) ||\r
                           ((Expand == NO) && (Node == NODE_DIR)))\r
                        {\r
+                               // 変数が未初期化のバグ修正\r
+                               memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                Pkt.InfoExist = 0;\r
                                GetNodeName(Win, Pos, Pkt.File, FMAX_PATH);\r
                                if(GetNodeSize(Win, Pos, &Pkt.Size) == YES)\r
@@ -2635,6 +2693,9 @@ void MakeSelectedFileList(int Win, int Expand, int All, FILELIST **Base, int *Ca
                        {\r
                                if(GetNodeType(Win, Pos) == NODE_DIR)\r
                                {\r
+                                       // 変数が未初期化のバグ修正\r
+                                       memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                        GetNodeName(Win, Pos, Name, FMAX_PATH);\r
                                        strcpy(Pkt.File, Name);\r
                                        ReplaceAll(Pkt.File, '\\', '/');\r
@@ -2732,6 +2793,9 @@ void MakeDroppedFileList(WPARAM wParam, char *Cur, FILELIST **Base)
 \r
                if((GetFileAttributes(Name) & FILE_ATTRIBUTE_DIRECTORY) == 0)\r
                {\r
+                       // 変数が未初期化のバグ修正\r
+                       memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                        Pkt.Node = NODE_FILE;\r
                        strcpy(Pkt.File, GetFileName(Name));\r
 \r
@@ -2762,6 +2826,9 @@ void MakeDroppedFileList(WPARAM wParam, char *Cur, FILELIST **Base)
 \r
                if(GetFileAttributes(Name) & FILE_ATTRIBUTE_DIRECTORY)\r
                {\r
+                       // 変数が未初期化のバグ修正\r
+                       memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                        Pkt.Node = NODE_DIR;\r
                        strcpy(Pkt.File, GetFileName(Name));\r
                        AddFileList(&Pkt, Base);\r
@@ -2881,6 +2948,9 @@ static void MakeRemoteTree2(char *Path, char *Cur, FILELIST **Base, int *CancelC
                        {\r
                                if(Pos->Node == NODE_DIR)\r
                                {\r
+                                       // 変数が未初期化のバグ修正\r
+                                       memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                        /* まずディレクトリ名をセット */\r
                                        strcpy(Pkt.File, Pos->File);\r
                                        Pkt.Node = NODE_DIR;\r
@@ -2971,6 +3041,9 @@ void AddRemoteTreeToFileList(int Num, char *Path, int IncDir, FILELIST **Base)
                                {\r
                                        if(IncDir == RDIR_NLST)\r
                                        {\r
+                                               // 変数が未初期化のバグ修正\r
+                                               memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                                strcpy(Pkt.File, Dir);\r
                                                Pkt.Node = NODE_DIR;\r
                                                Pkt.Size = 0;\r
@@ -2989,6 +3062,9 @@ void AddRemoteTreeToFileList(int Num, char *Path, int IncDir, FILELIST **Base)
                                        if((Node == NODE_FILE) ||\r
                                           ((IncDir == RDIR_CWD) && (Node == NODE_DIR)))\r
                                        {\r
+                                               // 変数が未初期化のバグ修正\r
+                                               memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                                strcpy(Pkt.File, Dir);\r
                                                if(strlen(Pkt.File) > 0)\r
                                                        SetSlashTail(Pkt.File);\r
@@ -3156,6 +3232,9 @@ static void MakeLocalTree(char *Path, FILELIST **Base)
                        {\r
                                if(AskFilterStr(FindBuf.cFileName, NODE_FILE) == YES)\r
                                {\r
+                                       // 変数が未初期化のバグ修正\r
+                                       memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                        strcpy(Pkt.File, Path);\r
                                        SetSlashTail(Pkt.File);\r
                                        strcat(Pkt.File, FindBuf.cFileName);\r
@@ -3184,6 +3263,9 @@ static void MakeLocalTree(char *Path, FILELIST **Base)
                           (strcmp(FindBuf.cFileName, ".") != 0) &&\r
                           (strcmp(FindBuf.cFileName, "..") != 0))\r
                        {\r
+                               // 変数が未初期化のバグ修正\r
+                               memset(&Pkt, 0, sizeof(FILELIST));\r
+\r
                                strcpy(Src, Path);\r
                                SetYenTail(Src);\r
                                strcat(Src, FindBuf.cFileName);\r