\r
HMODULE g_hLib;\r
TPI_PROC g_prProc;\r
-unsigned int g_uFileCount;\r
-unsigned int g_uFilePointer;\r
-wxString g_szAppPath;\r
\r
//******************************************************************************\r
// Entry\r
//******************************************************************************\r
\r
#ifdef __LINUX__\r
-void __attribute__((constructor)) Attach(void)\r
-{\r
- wxStandardPaths p;\r
- g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-}\r
-\r
void __attribute__((destructor)) Detach(void)\r
{\r
::FreeLibrary(g_hLib);\r
{\r
switch (fdwReason)\r
{\r
- case DLL_PROCESS_ATTACH:\r
- {\r
- wxStandardPaths p;\r
- g_szAppPath = ::wxPathOnly(p.GetExecutablePath());\r
- break;\r
- }\r
case DLL_PROCESS_DETACH:\r
::FreeLibrary(g_hLib);\r
break;\r
piInfo.fiInfo.fnFileName = * (wxFileName *) _lData;\r
\r
// \83R\81[\83\8b\83o\83b\83N\8aÖ\90\94\82É\91\97\90M\81B\r
- if (g_prProc == NULL)\r
- {\r
- return TRUE;\r
- }\r
-\r
- return g_prProc(TPI_NOTIFY_COMMON, & piInfo) == TPI_CALLBACK_CANCEL;\r
+ return g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & piInfo) == TPI_CALLBACK_CANCEL;\r
}\r
\r
//******************************************************************************\r
wxULongLong\r
)\r
{\r
- wxDir fs(g_szAppPath + wxT("/lib/"));\r
- wxString szSPIName = wxEmptyString;\r
+ wxStandardPaths p;\r
+ wxString szSPIPath = wxPathOnly(p.GetExecutablePath()) + wxT("/lib/"), szSPIName = wxEmptyString;\r
+ wxDir fs(szSPIPath);\r
bool b = fs.GetFirst(& szSPIName, wxT("*.spi"));\r
while (b)\r
{\r
// SPI\82ð\83\8d\81[\83h\81B\r
- wxString szLibName = g_szAppPath + wxT("/lib/") + szSPIName;\r
+ wxString szLibName = szSPIPath + szSPIName;\r
g_hLib = ::LoadLibraryA(szLibName.char_str());\r
if (g_hLib == NULL)\r
{\r
return nReturnCode;\r
}\r
\r
- g_uFilePointer = 0;\r
- g_uFileCount = (unsigned int) (::LocalSize(* _hArchive) / sizeof(fileInfo));\r
-\r
return * _hArchive == NULL ? TPI_ERROR_IO_ARC_OPEN : nReturnCode;\r
}\r
\r
bool _bFirst\r
)\r
{\r
+ static unsigned int uFileCount, uFilePointer;\r
+\r
if (_bFirst)\r
{\r
- g_uFilePointer = 0;\r
+ uFilePointer = 0;\r
+ uFileCount = (unsigned int) (::LocalSize(_hArchive) / sizeof(fileInfo));\r
}\r
\r
- if (g_uFilePointer > g_uFileCount)\r
+ if (uFilePointer > uFileCount)\r
{\r
return TPI_ERROR_UNDEFINED;\r
}\r
\r
- fileInfo pfiInfo = ((fileInfo *) ::LocalLock(_hArchive))[g_uFilePointer];\r
+ fileInfo pfiInfo = ((fileInfo *) ::LocalLock(_hArchive))[uFilePointer];\r
if (pfiInfo.method[0] == 0)\r
{\r
// \92\9a\94J\82È\83v\83\89\83O\83C\83\93\82Ì\82½\82ß\82Ì\90\94\8d\87\82í\82¹ (^^;\r
- g_uFileCount = g_uFilePointer;\r
+ uFileCount = uFilePointer;\r
return TPI_ERROR_UNDEFINED;\r
}\r
\r
_fiInfo->llPackedSize = pfiInfo.compsize;\r
_fiInfo->llUnpackedSize = pfiInfo.filesize;\r
_fiInfo->wCompressRatio = pfiInfo.compsize >= pfiInfo.filesize ? 1000 : (WORD) (1000 * pfiInfo.compsize / pfiInfo.filesize);\r
- _fiInfo->llFileID = g_uFilePointer++;\r
+ _fiInfo->llFileID = uFilePointer++;\r
_fiInfo->tmModified = pfiInfo.timestamp;\r
- _fiInfo->pCustomInfo = NULL;\r
_fiInfo->szStoredName = MB2String(pfiInfo.path) + MB2String(pfiInfo.filename);\r
_fiInfo->fnFileName = wxFileName::FileName(_fiInfo->szStoredName);\r
_fiInfo->szMethod = MB2String((char *) pfiInfo.method);\r