OSDN Git Service

TPIHandle内に書庫のハンドルを保持するよう変更。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 9 Oct 2009 11:13:58 +0000 (11:13 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 9 Oct 2009 11:13:58 +0000 (11:13 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@29 9df91469-1e22-0410-86e7-ea8537beb833

src/common/handle/TPIHandle.cpp
src/common/handle/TPIHandle.h
src/frontend/frm_main.cpp

index 4ee34ad..977f081 100644 (file)
@@ -115,7 +115,7 @@ int TPIHandle::CheckArchive(const wxString & _szArcName, int * _nFileCount)
        return ((int (__stdcall *)(const wxString &, int *)) p)(_szArcName, _nFileCount);\r
 }\r
 \r
-int TPIHandle::OpenArchive(const wxString & _szArcName, void * * _hArchive)\r
+int TPIHandle::OpenArchive(const wxString & _szArcName)\r
 {\r
        if (! this->lib.HasSymbol(wxT("OpenArchive")))\r
        {\r
@@ -127,10 +127,10 @@ int TPIHandle::OpenArchive(const wxString & _szArcName, void * * _hArchive)
                return -1;\r
        }\r
 \r
-       return ((int (__stdcall *)(const wxString &, void * *)) p)(_szArcName, _hArchive);\r
+       return ((int (__stdcall *)(const wxString &, void * *)) p)(_szArcName, & this->archive);\r
 }\r
 \r
-int TPIHandle::CloseArchive(void * _hArchive)\r
+int TPIHandle::CloseArchive(void)\r
 {\r
        if (! this->lib.HasSymbol(wxT("CloseArchive")))\r
        {\r
@@ -142,10 +142,10 @@ int TPIHandle::CloseArchive(void * _hArchive)
                return -1;\r
        }\r
 \r
-       return ((int (__stdcall *)(void *)) p)(_hArchive);\r
+       return ((int (__stdcall *)(void *)) p)(this->archive);\r
 }\r
 \r
-int TPIHandle::GetFileInformation(void * _hArchive, TPI_FILEINFO * _fiInfo, bool _bFirst)\r
+int TPIHandle::GetFileInformation(TPI_FILEINFO * _fiInfo, bool _bFirst)\r
 {\r
        if (! this->lib.HasSymbol(wxT("GetFileInformation")) || ! _fiInfo)\r
        {\r
@@ -173,10 +173,10 @@ int TPIHandle::GetFileInformation(void * _hArchive, TPI_FILEINFO * _fiInfo, bool
        _fiInfo->llFileID       = 0;\r
        _fiInfo->pCustomInfo    = NULL;\r
 \r
-       return ((int (__stdcall *)(void *, TPI_FILEINFO *, bool)) p)(_hArchive, _fiInfo, _bFirst);\r
+       return ((int (__stdcall *)(void *, TPI_FILEINFO *, bool)) p)(this->archive, _fiInfo, _bFirst);\r
 }\r
 \r
-int TPIHandle::GetArchiveInformation(void * _hArchive, TPI_ARCHIVEINFO * _aiInfo)\r
+int TPIHandle::GetArchiveInformation(TPI_ARCHIVEINFO * _aiInfo)\r
 {\r
        if (! this->lib.HasSymbol(wxT("GetArchiveInformation")) || ! _aiInfo)\r
        {\r
@@ -209,7 +209,7 @@ int TPIHandle::GetArchiveInformation(void * _hArchive, TPI_ARCHIVEINFO * _aiInfo
        _aiInfo->wCompressRatio = 0;\r
        _aiInfo->pCustomInfo    = NULL;\r
 \r
-       return ((int (__stdcall *)(void *, TPI_ARCHIVEINFO *)) p)(_hArchive, _aiInfo);\r
+       return ((int (__stdcall *)(void *, TPI_ARCHIVEINFO *)) p)(this->archive, _aiInfo);\r
 }\r
 \r
 int TPIHandle::Command(unsigned int _uCommand, TPI_SWITCHES * _swInfo, const wxString & _szArcName, const wxArrayString & _szFiles)\r
index aea42f4..e27a339 100644 (file)
@@ -38,16 +38,17 @@ class TPIHandle
                bool FreeLibrary(void);
 
                int CheckArchive(const wxString &, int *);
-               int OpenArchive(const wxString &, void * *);
-               int CloseArchive(void *);
-               int GetFileInformation(void *, TPI_FILEINFO *, bool);
-               int GetArchiveInformation(void *, TPI_ARCHIVEINFO *);
+               int OpenArchive(const wxString &);
+               int CloseArchive(void);
+               int GetFileInformation(TPI_FILEINFO *, bool);
+               int GetArchiveInformation(TPI_ARCHIVEINFO *);
 
                int Command(unsigned int, TPI_SWITCHES *, const wxString &, const wxArrayString &);
 
                int SetCallbackProc(TPI_PROC);
        private:
                wxDynamicLibrary lib;
+               void * archive;
 };
 
 #endif
index 2286de8..9e77e15 100644 (file)
@@ -693,8 +693,7 @@ void MainFrame::LoadArc(wxString szFileName)
        TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo);
 
        // \8f\91\8cÉ\82ð\8aJ\82­\81B
-       void * hArc = NULL;
-       if (tpi.OpenArchive(szFileName, & hArc) != TPI_ERROR_SUCCESS)
+       if (tpi.OpenArchive(szFileName) != TPI_ERROR_SUCCESS)
        {
                procDlg.Show(false);
                tpi.FreeLibrary();
@@ -724,7 +723,7 @@ void MainFrame::LoadArc(wxString szFileName)
        this->fileinfo.Alloc(nFileCount);
 
        // \83t\83@\83C\83\8b\8fî\95ñ\82ð\83\8d\81[\83h\81B
-       if (tpi.GetFileInformation(hArc, & piInfo.fiInfo, true) == TPI_ERROR_SUCCESS)
+       if (tpi.GetFileInformation(& piInfo.fiInfo, true) == TPI_ERROR_SUCCESS)
        {
                do
                {
@@ -733,7 +732,7 @@ void MainFrame::LoadArc(wxString szFileName)
                        if (TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo) == TPI_CALLBACK_CANCEL)
                        {
                                procDlg.Show(false);
-                               tpi.CloseArchive(hArc);
+                               tpi.CloseArchive();
                                wxCommandEvent e;
                                this->OnArcClose(e);
                                ::wxMessageBox(wxT("Fault : Canceled by user!"));
@@ -780,7 +779,7 @@ void MainFrame::LoadArc(wxString szFileName)
                        // \8fî\95ñ\82ð\95Û\91\82µ\82Ä\83J\83E\83\93\83g\83A\83b\83v\81B
                        this->fileinfo.Add(piInfo.fiInfo);
                }
-               while (tpi.GetFileInformation(hArc, & piInfo.fiInfo, false) == TPI_ERROR_SUCCESS);
+               while (tpi.GetFileInformation(& piInfo.fiInfo, false) == TPI_ERROR_SUCCESS);
        }
 
        // \8eG\91½\8f\88\97\9d\81B
@@ -792,7 +791,7 @@ void MainFrame::LoadArc(wxString szFileName)
 
        // \8f\91\8cÉ\82Ì\8fî\95ñ\82ð\8eæ\93¾\81B
        TPI_ARCHIVEINFO aiInfo;
-       if (tpi.GetArchiveInformation(hArc, & aiInfo) != TPI_ERROR_SUCCESS)
+       if (tpi.GetArchiveInformation(& aiInfo) != TPI_ERROR_SUCCESS)
        {
                procDlg.Show(false);
                tpi.FreeLibrary();
@@ -809,7 +808,7 @@ void MainFrame::LoadArc(wxString szFileName)
        this->statusbar->SetStatusText(szFileName, 5);
 
        // \8f\91\8cÉ\82ð\95Â\82\82é\81B
-       if (tpi.CloseArchive(hArc) != TPI_ERROR_SUCCESS)
+       if (tpi.CloseArchive() != TPI_ERROR_SUCCESS)
        {
                ::wxMessageBox(wxT("Fault : CloseArchive()!"));
        }