OSDN Git Service

Add support for retaining time stamps on uploading files.
[ffftp/ffftp.git] / filelist.c
index b3e1da2..0760c53 100644 (file)
@@ -183,6 +183,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
@@ -1125,6 +1128,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 +1531,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 +1714,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 +1838,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 +2020,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 +2303,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 +2332,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 +2367,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 +2403,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 +2452,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 +2501,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 +2540,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