[sword-cvs] swordreader/src/Dll1/winceSword/src dirent.cpp,1.2,1.3
sword@www.crosswire.org
sword@www.crosswire.org
Sun, 18 Jan 2004 00:00:32 -0700
Update of /cvs/core/swordreader/src/Dll1/winceSword/src
In directory www:/tmp/cvs-serv31571/src/Dll1/winceSword/src
Modified Files:
dirent.cpp
Log Message:
experimenting with utf16
Index: dirent.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/Dll1/winceSword/src/dirent.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dirent.cpp 17 Jan 2004 02:57:42 -0000 1.2
+++ dirent.cpp 18 Jan 2004 07:00:29 -0000 1.3
@@ -7,16 +7,18 @@
using sword::SWBuf;
DIR* opendir(const char *pSpec) {
- SWBuf dirPath = windizePath(pSpec);
- dirPath += "\\*";
DIR *pDir = (DIR*) malloc(sizeof(DIR));
- pDir->hFind = FindFirstFile(strtowstr(dirPath), &pDir->wfd);
+ pDir->dirPath = new SWBuf();
+ *(pDir->dirPath) = windizePath(pSpec);
+ *(pDir->dirPath) += "\\*";
+ pDir->hFind = FindFirstFile(strtowstr(pDir->dirPath->c_str()), &(pDir->wfd));
return pDir;
}
void closedir(DIR * pDir) {
FindClose( pDir->hFind );
+ delete pDir->dirPath;
free(pDir);
}
@@ -24,7 +26,7 @@
struct dirent* readdir(DIR *pDir) {
if (pDir->hFind) {
strcpy(pDir->de.d_name, wstrtostr(pDir->wfd.cFileName));
- if ( !FindNextFile(pDir->hFind, &pDir->wfd) )
+ if ( !FindNextFile(pDir->hFind, &(pDir->wfd)) )
pDir->hFind = NULL;
return &pDir->de;
@@ -35,7 +37,7 @@
void rewinddir(DIR* dir) {
- lseek( (int) dir->hFind,0,SEEK_SET);
+ dir->hFind = FindFirstFile(strtowstr(dir->dirPath->c_str()), &(dir->wfd));
}