提交 6420811c 编写于 作者: H Hongze Cheng

mor

上级 734ff3f8
此差异已折叠。
......@@ -14,28 +14,15 @@
*/
#include "encode.h"
#include "freelist.h"
#define CODER_NODE_FIELDS \
uint8_t* data; \
int32_t size; \
int32_t pos;
struct SCoderNode {
TD_SLIST_NODE(SCoderNode);
CODER_NODE_FIELDS
};
typedef struct {
td_endian_t endian;
SFreeList fl;
CODER_NODE_FIELDS
TD_SLIST(SCoderNode) stack;
} SCoder;
bool tDecodeIsEnd(SCoder* pCoder) { return (pCoder->size == pCoder->pos); }
void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type) {
if (type == TD_ENCODER) {
if (data == NULL) size = 0;
} else {
ASSERT(data && size > 0);
}
void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size) {
pCoder->type = type;
pCoder->endian = endian;
pCoder->data = data;
pCoder->size = size;
......@@ -55,6 +42,8 @@ void tCoderClear(SCoder* pCoder) {
}
}
bool tDecodeIsEnd(SCoder* pCoder) { return (pCoder->size == pCoder->pos); }
int tStartEncode(SCoder* pCoder) {
struct SCoderNode* pNode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册