Skip to content

Commit

Permalink
Merge pull request #522 from dseliskar/develop
Browse files Browse the repository at this point in the history
Fix for TemplateFileStream
Typo fix for eSST_TemplateFile
  • Loading branch information
alonewolfx2 committed Jan 2, 2016
2 parents dfb3b43 + 805e23c commit f3459ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Sming/SmingCore/DataSourceStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ uint16_t TemplateFileStream::readMemoryBlock(char* data, int bufSize)
memcpy(varname, cur + 1, p - cur - 1); // name without { and }
varName = varname;
state = eTES_Found;
varWaitSize = cur - tpl;
debugf("found var: %s, at %d (%d) - %d, send size %d", varName.c_str(), cur - tpl + 1, cur - tpl + getPos(), p - tpl, cur - tpl);
int sz = cur - tpl;
varWaitSize = sz;
debugf("found var: %s, at %d (%d) - %d, send size %d", varName.c_str(), sz + 1, sz + getPos(), p - tpl, sz);
skipBlockSize = block;
return cur - tpl; // return only plain text from template without our variable
if (sz == 0) state = eTES_StartVar;
return sz; // return only plain text from template without our variable
}
}
cur = (char*)memchr(p, '{', len - (p - tpl)); // continue searching..
Expand Down
4 changes: 2 additions & 2 deletions Sming/SmingCore/DataSourceStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum StreamType
{
eSST_Memory,
eSST_File,
eSST_TepmplateFile,
eSST_TemplateFile,
eSST_JsonObject,
eSST_User,
eSST_Unknown
Expand Down Expand Up @@ -104,7 +104,7 @@ class TemplateFileStream : public FileStream
TemplateFileStream(String templateFileName);
virtual ~TemplateFileStream();

virtual StreamType getStreamType() { return eSST_TepmplateFile; }
virtual StreamType getStreamType() { return eSST_TemplateFile; }

virtual uint16_t readMemoryBlock(char* data, int bufSize);
virtual bool seek(int len);
Expand Down

0 comments on commit f3459ac

Please sign in to comment.