tvg_loader: code refactoring.

renamed internal functions, no logical changes.
This commit is contained in:
Hermet Park 2021-06-14 14:32:05 +09:00
parent 88a85c68fa
commit 26fd6b5dfd
3 changed files with 7 additions and 7 deletions

View file

@ -504,14 +504,14 @@ static LoaderResult _parsePaint(tvgBlock base_block, Paint **paint)
/* External Class Implementation */ /* External Class Implementation */
/************************************************************************/ /************************************************************************/
bool tvgValidateTvgHeader(const char *ptr, uint32_t size) bool tvgValidateData(const char *ptr, uint32_t size)
{ {
auto end = ptr + size; auto end = ptr + size;
if (!_readTvgHeader(&ptr) || ptr >= end) return false; if (!_readTvgHeader(&ptr) || ptr >= end) return false;
return true; return true;
} }
unique_ptr<Scene> tvgLoadTvgData(const char *ptr, uint32_t size) unique_ptr<Scene> tvgLoadData(const char *ptr, uint32_t size)
{ {
auto end = ptr + size; auto end = ptr + size;

View file

@ -26,7 +26,7 @@
#include "tvgCommon.h" #include "tvgCommon.h"
#include "tvgBinaryDesc.h" #include "tvgBinaryDesc.h"
bool tvgValidateTvgHeader(const char *ptr, uint32_t size); bool tvgValidateData(const char *ptr, uint32_t size);
unique_ptr<Scene> tvgLoadTvgData(const char *ptr, uint32_t size); unique_ptr<Scene> tvgLoadData(const char *ptr, uint32_t size);
#endif //_TVG_TVG_LOAD_PARSER_H_ #endif //_TVG_TVG_LOAD_PARSER_H_

View file

@ -79,7 +79,7 @@ bool TvgLoader::open(const string &path)
pointer = buffer; pointer = buffer;
return tvgValidateTvgHeader(pointer, size); return tvgValidateData(pointer, size);
} }
bool TvgLoader::open(const char *data, uint32_t size) bool TvgLoader::open(const char *data, uint32_t size)
@ -89,7 +89,7 @@ bool TvgLoader::open(const char *data, uint32_t size)
this->pointer = data; this->pointer = data;
this->size = size; this->size = size;
return tvgValidateTvgHeader(pointer, size); return tvgValidateData(pointer, size);
} }
bool TvgLoader::read() bool TvgLoader::read()
@ -111,7 +111,7 @@ bool TvgLoader::close()
void TvgLoader::run(unsigned tid) void TvgLoader::run(unsigned tid)
{ {
if (root) root.reset(); if (root) root.reset();
root = tvgLoadTvgData(pointer, size); root = tvgLoadData(pointer, size);
if (!root) clearBuffer(); if (!root) clearBuffer();
} }