aboutsummaryrefslogtreecommitdiff
path: root/extensions/smdatapack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/smdatapack.cpp')
-rw-r--r--extensions/smdatapack.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/extensions/smdatapack.cpp b/extensions/smdatapack.cpp
index 78082bb..2e77324 100644
--- a/extensions/smdatapack.cpp
+++ b/extensions/smdatapack.cpp
@@ -36,7 +36,7 @@ bool smDtpFileR::openDtp(const char* path)
m[std::string(f.path)]=f;
}
}
-bool smDtpFileR::openDtpFromMemory(char* ptr,DWORD size)
+bool smDtpFileR::openDtpFromMemory(const char* ptr,DWORD size)
{
enmemory=true;msize=size;
if(!ptr||size<4)return false;
@@ -84,6 +84,7 @@ char* smDtpFileR::getPrevFile(const char* path)
char* smDtpFileR::getFilePtr(const char* path)
{
std::string fns(path);
+ if(m.find(fns)==m.end()){printf("error: file not found in the archive.\n");return NULL;}
if(m.at(fns).data)return m.at(fns).data;
else
{
@@ -112,6 +113,7 @@ char* smDtpFileR::getFilePtr(const char* path)
void smDtpFileR::releaseFilePtr(const char* path)
{
std::string fns(path);
+ if(m.find(fns)==m.end()){printf("error: file not found in the archive.\n");return;}
if(m[fns].data)
{
delete[] m[fns].data;
@@ -119,7 +121,7 @@ void smDtpFileR::releaseFilePtr(const char* path)
}
}
DWORD smDtpFileR::getFileSize(const char* path)
-{return m[std::string(path)].size;}
+{if(m.find(std::string(path))==m.end()){printf("error: file not found in the archive.\n");return 0;}return m[std::string(path)].size;}
smDtpFileW::smDtpFileW(){fcnt=0;}
bool smDtpFileW::addFile(const char* path,const char* realpath)