1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

render.h & size_t

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-18 16:54:56 +02:00
parent e7772acb02
commit b44cca63dc
3 changed files with 21 additions and 8 deletions

View file

@ -5,8 +5,8 @@
/** @brief Checks if short keyword string matches long keyword string /** @brief Checks if short keyword string matches long keyword string
*/ */
int PSYC_matches(uint8_t* sho, unsigned int slen, int PSYC_matches(uint8_t* sho, size_t slen,
uint8_t* lon, unsigned int llen); uint8_t* lon, size_t llen);
/** @brief Callback for PSYC_text() that produces a value for a match /** @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 * number of bytes written. 0 is a legal return value. Should the
* callback return -1, PSYC_text leaves the original template text as is. * callback return -1, PSYC_text leaves the original template text as is.
*/ */
typedef int (*PSYC_textCB)(uint8_t* match, unsigned int mlen, typedef int (*PSYC_textCB)(uint8_t* match, size_t mlen,
uint8_t** buffer, unsigned int* blen); uint8_t** buffer, size_t * blen);
/** @brief Fills out text templates by asking a callback for content /** @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 * See also http://about.psyc.eu/psyctext
*/ */
int PSYC_text(uint8_t* template, unsigned int tlen, int PSYC_text(uint8_t* template, size_t tlen,
uint8_t** buffer, unsigned int* blen, uint8_t** buffer, size_t * blen,
PSYC_textCB lookupValue, PSYC_textCB lookupValue,
char* braceOpen, char* braceClose); char* braceOpen, char* braceClose);

13
include/psyc/render.h Normal file
View file

@ -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);

View file

@ -2,8 +2,8 @@
/* TODO: PSYC_inherits() */ /* TODO: PSYC_inherits() */
int PSYC_matches(uint8_t* sho, unsigned int slen, int PSYC_matches(uint8_t* sho, size_t slen,
uint8_t* lon, unsigned int llen) { uint8_t* lon, size_t llen) {
uint8_t *s, *l, *se, *le; uint8_t *s, *l, *se, *le;
if (!slen) slen = strlen(sho); if (!slen) slen = strlen(sho);