Lines Matching refs:buf
155 static inline void mb_convert_buf_init(mb_convert_buf *buf, size_t initsize, uint32_t repl_char, un… in mb_convert_buf_init() argument
157 buf->state = buf->errors = 0; in mb_convert_buf_init()
158 buf->str = emalloc(_ZSTR_STRUCT_SIZE(initsize)); in mb_convert_buf_init()
159 buf->out = (unsigned char*)ZSTR_VAL(buf->str); in mb_convert_buf_init()
160 buf->limit = buf->out + initsize; in mb_convert_buf_init()
161 buf->replacement_char = repl_char; in mb_convert_buf_init()
162 buf->error_mode = err_mode; in mb_convert_buf_init()
165 #define MB_CONVERT_BUF_ENSURE(buf, out, limit, needed) \ argument
168 size_t oldsize = limit - (unsigned char*)ZSTR_VAL((buf)->str); \
170 zend_string *newstr = erealloc((buf)->str, _ZSTR_STRUCT_SIZE(newsize)); \
171 out = (unsigned char*)ZSTR_VAL(newstr) + (out - (unsigned char*)ZSTR_VAL((buf)->str)); \
173 (buf)->str = newstr; \
176 #define MB_CONVERT_BUF_STORE(buf, _out, _limit) (buf)->out = _out; (buf)->limit = _limit argument
178 #define MB_CONVERT_BUF_LOAD(buf, _out, _limit) _out = (buf)->out; _limit = (buf)->limit argument
180 #define MB_CONVERT_ERROR(buf, out, limit, bad_cp, conv_fn) \ argument
181 MB_CONVERT_BUF_STORE(buf, out, limit); \
182 mb_illegal_output(bad_cp, conv_fn, buf); \
183 MB_CONVERT_BUF_LOAD(buf, out, limit)
231 static inline zend_string* mb_convert_buf_result_raw(mb_convert_buf *buf) in mb_convert_buf_result_raw() argument
233 ZEND_ASSERT(buf->out <= buf->limit); in mb_convert_buf_result_raw()
234 zend_string *ret = buf->str; in mb_convert_buf_result_raw()
239 ZSTR_LEN(ret) = buf->out - (unsigned char*)ZSTR_VAL(ret); in mb_convert_buf_result_raw()
240 *(buf->out) = '\0'; in mb_convert_buf_result_raw()
261 static inline zend_string* mb_convert_buf_result(mb_convert_buf *buf, const mbfl_encoding *enc) in mb_convert_buf_result() argument
263 zend_string *ret = mb_convert_buf_result_raw(buf); in mb_convert_buf_result()
264 if (enc == &mbfl_encoding_utf8 && buf->error_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_BADUTF8) { in mb_convert_buf_result()
272 static inline void mb_convert_buf_free(mb_convert_buf *buf) in mb_convert_buf_free() argument
274 efree(buf->str); in mb_convert_buf_free()
277 static inline size_t mb_convert_buf_len(mb_convert_buf *buf) in mb_convert_buf_len() argument
279 return buf->out - (unsigned char*)ZSTR_VAL(buf->str); in mb_convert_buf_len()
282 static inline void mb_convert_buf_reset(mb_convert_buf *buf, size_t len) in mb_convert_buf_reset() argument
284 buf->out = (unsigned char*)ZSTR_VAL(buf->str) + len; in mb_convert_buf_reset()
285 ZEND_ASSERT(buf->out <= buf->limit); in mb_convert_buf_reset()