aboutsummaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/smanim.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/extensions/smanim.cpp b/extensions/smanim.cpp
index 6d09032..d57292b 100644
--- a/extensions/smanim.cpp
+++ b/extensions/smanim.cpp
@@ -22,9 +22,9 @@ void smAnmFile::parseMeta(const char* meta,DWORD size)
while(cp-meta<=size)
{
int cc=0;
- for(;*(cp+cc)!='\n';++cc);
+ for(;*(cp+cc)!='\n'&&(cp+cc-meta<=size);++cc);
char line[65];
- strncpy(line,cp,cc);line[cc-1]='\0';
+ strncpy(line,cp,cc+1);line[cc]='\0';
cp+=cc+1;++lc;
if(inAnim&&line[0]!='F'&&line[0]!='E'){METAWARN("Only instruction F is allowed between A and E.");continue;}
if(line[0]=='E')
@@ -75,13 +75,12 @@ void smAnmFile::parseMeta(const char* meta,DWORD size)
{
smTexInfo t;
int cn=0;while(line[cn+2]!=',')++cn;
- t.name=new char[cn];strncpy(t.name,line+2,cn);
- t.name[cn-1]='\0';
- int cn2=0;while(line[cn+3+cn2]!=',')++cn2;++cn2;
- t.path=new char[cn2];strncpy(t.path,line+3+cn,cn2);
- t.path[cn2-1]='\0';
+ t.name=new char[cn+1];strncpy(t.name,line+2,cn+1);
+ t.name[cn]='\0';
+ int cn2=0;while(line[cn+3+cn2]!=',')++cn2;
+ t.path=new char[cn2+1];strncpy(t.path,line+3+cn,cn2+1);
+ t.path[cn2]='\0';
sscanf(line+4+cn+cn2,"%f,%f,%f,%f",&t.rect.x,&t.rect.y,&t.rect.w,&t.rect.h);
- tm[std::string(t.name)]=t;
if(xm.find(std::string(t.path))!=xm.end())
t.tex=xm[std::string(t.path)];
else
@@ -92,6 +91,7 @@ void smAnmFile::parseMeta(const char* meta,DWORD size)
=sm->smTextureLoadFromMemory(texct,texsz);
anm.releaseFilePtr(t.path);
}
+ tm[std::string(t.name)]=t;
}
if(line[0]=='I')
{