From 344f327e19b2ed7f39892065c5791ce3761dd20d Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Mon, 18 Apr 2011 16:54:56 +0200 Subject: [PATCH] render.h & size_t --- include/psyc.h | 12 ++++++------ include/psyc/render.h | 13 +++++++++++++ src/match.c | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 include/psyc/render.h diff --git a/include/psyc.h b/include/psyc.h index f41c8a2..0252999 100644 --- a/include/psyc.h +++ b/include/psyc.h @@ -5,8 +5,8 @@ /** @brief Checks if short keyword string matches long keyword string */ -int PSYC_matches(uint8_t* sho, unsigned int slen, - uint8_t* lon, unsigned int llen); +int PSYC_matches(uint8_t* sho, size_t slen, + uint8_t* lon, size_t llen); /** @brief Callback for PSYC_text() that produces a value for a match * @@ -16,8 +16,8 @@ int PSYC_matches(uint8_t* sho, unsigned int slen, * number of bytes written. 0 is a legal return value. Should the * callback return -1, PSYC_text leaves the original template text as is. */ -typedef int (*PSYC_textCB)(uint8_t* match, unsigned int mlen, - uint8_t** buffer, unsigned int* blen); +typedef int (*PSYC_textCB)(uint8_t* match, size_t mlen, + uint8_t** buffer, size_t * blen); /** @brief Fills out text templates by asking a callback for content * @@ -31,8 +31,8 @@ typedef int (*PSYC_textCB)(uint8_t* match, unsigned int mlen, * * See also http://about.psyc.eu/psyctext */ -int PSYC_text(uint8_t* template, unsigned int tlen, - uint8_t** buffer, unsigned int* blen, +int PSYC_text(uint8_t* template, size_t tlen, + uint8_t** buffer, size_t * blen, PSYC_textCB lookupValue, char* braceOpen, char* braceClose); diff --git a/include/psyc/render.h b/include/psyc/render.h new file mode 100644 index 0000000..1b3f576 --- /dev/null +++ b/include/psyc/render.h @@ -0,0 +1,13 @@ +int PSYC_renderHeader(struct PSYC_Buffers* pbuf, + const uint8_t* name, const size_t nlength, + const uint8_t* value, const size_t vlength, + const uchar flags, const uchar modifier); + +int PSYC_renderBody(struct PSYC_Buffers* pbuf, + const uint8_t* method, const size_t mlength, + const uint8_t* data, const size_t dlength, + const uchar flags); + +int PSYC_doneRender(struct PSYC_Buffers* pbuf, + uint8_t** buf, size_t* written); + diff --git a/src/match.c b/src/match.c index 70fb200..8b159f4 100644 --- a/src/match.c +++ b/src/match.c @@ -2,8 +2,8 @@ /* TODO: PSYC_inherits() */ -int PSYC_matches(uint8_t* sho, unsigned int slen, - uint8_t* lon, unsigned int llen) { +int PSYC_matches(uint8_t* sho, size_t slen, + uint8_t* lon, size_t llen) { uint8_t *s, *l, *se, *le; if (!slen) slen = strlen(sho);