Compresses a string into BZip2 encoded data */
static PHP_FUNCTION(bzcompress)
{
- char *source; /* String to compress */
+ zstr source; /* String to compress */
int source_len;
zend_uchar source_type;
long block_size = 4, /* Block size for compression algorithm */
dest = emalloc(dest_len + 1);
if (source_type == IS_UNICODE) {
- source = zend_unicode_to_ascii((UChar*)source, source_len TSRMLS_CC);
- if (!source) {
+ source.s = zend_unicode_to_ascii(source.u, source_len TSRMLS_CC);
+ if (!source.s) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received");
RETURN_FALSE;
}
}
- error = BZ2_bzBuffToBuffCompress(dest, &dest_len, source, source_len, block_size, 0, work_factor);
+ error = BZ2_bzBuffToBuffCompress(dest, &dest_len, source.s, source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
efree(dest);
RETVAL_LONG(error);
}
if (source_type == IS_UNICODE) {
- efree(source);
+ efree(source.s);
}
}
/* }}} */
zval *IM;
long size, x, y, col;
zend_uchar str_type;
- char *str;
+ zstr str;
int str_len, i;
gdImagePtr im;
gdFontPtr font;
}
if (str_type == IS_UNICODE) {
- str = zend_unicode_to_ascii((UChar*)str, str_len TSRMLS_CC);
- if (!str) {
+ str.s = zend_unicode_to_ascii(str.u, str_len TSRMLS_CC);
+ if (!str.s) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Consider using the TTF functions for Unicode output");
RETURN_FALSE;
}
switch (mode) {
case 0:
- gdImageChar(im, font, x, y, (int) ((unsigned char)str[0]), col);
+ gdImageChar(im, font, x, y, (int) ((unsigned char)str.s[0]), col);
break;
case 1:
- php_gdimagecharup(im, font, x, y, (int) ((unsigned char)str[0]), col);
+ php_gdimagecharup(im, font, x, y, (int) ((unsigned char)str.s[0]), col);
break;
case 2:
for (i = 0; (i < str_len); i++) {
- gdImageChar(im, font, x, y, (int) ((unsigned char)str[i]), col);
+ gdImageChar(im, font, x, y, (int) ((unsigned char)str.s[i]), col);
x += font->w;
}
break;
case 3: {
for (i = 0; (i < str_len); i++) {
/* php_gdimagecharup(im, font, x, y, (int) str[i], col); */
- gdImageCharUp(im, font, x, y, (int) ((unsigned char)str[i]), col);
+ gdImageCharUp(im, font, x, y, (int) ((unsigned char)str.s[i]), col);
y -= font->w;
}
break;
}
if (str_type == IS_UNICODE) {
- efree(str);
+ efree(str.s);
}
RETURN_TRUE;