Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix several compile warnings

  • Loading branch information...
commit 7bc470396463700a59d585bdbc34dd556d8b5068 1 parent a11eb98
@chobie authored
View
8 php_sundown.c
@@ -60,7 +60,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P
buffer_len = strlen(buffer);
memset(&input_buf, 0x0, sizeof(struct buf));
- input_buf.data = buffer;
+ input_buf.data = (uint8_t *)buffer;
input_buf.size = strlen(buffer);
output_buf = bufnew(128);
@@ -90,11 +90,11 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P
if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(),"enable_pants",sizeof("enable_pants")-1, 0 TSRMLS_CC))) {
struct buf *smart_buf = bufnew(128);
- sdhtml_smartypants(smart_buf, output_buf->data,output_buf->size);
- RETVAL_STRINGL(smart_buf->data, smart_buf->size,1);
+ sdhtml_smartypants(smart_buf, output_buf->data, output_buf->size);
+ RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1);
bufrelease(smart_buf);
} else {
- RETVAL_STRINGL(output_buf->data, output_buf->size,1);
+ RETVAL_STRINGL((char*)output_buf->data, output_buf->size, 1);
}
}
View
2  php_sundown.h
@@ -170,7 +170,7 @@ static inline zval* buf2str(const struct buf *text)
if (text == NULL || text->size == 0) {
ZVAL_NULL(str);
} else {
- ZVAL_STRINGL(str, text->data, text->size,1);
+ ZVAL_STRINGL(str, (char *)text->data, text->size, 1);
}
return str;
}
View
4 render_base.c
@@ -574,8 +574,8 @@ PHP_METHOD(sundown_render_base, postprocess)
if (Z_BVAL_P(zend_read_property(Z_OBJCE_P(getThis()), getThis(),"enable_pants",sizeof("enable_pants")-1, 1 TSRMLS_CC))) {
struct buf *smart_buf = bufnew(128);
- sdhtml_smartypants(smart_buf, text,text_len);
- RETVAL_STRINGL(smart_buf->data, smart_buf->size,1);
+ sdhtml_smartypants(smart_buf, (uint8_t *)text, text_len);
+ RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1);
bufrelease(smart_buf);
} else {
RETVAL_STRINGL(text,text_len, 1);
View
52 render_html.c
@@ -189,7 +189,7 @@ PHP_METHOD(sundown_render_html, blockCode)
html->cb.blockcode(output,lang,input, &base->html);
bufrelease(input);
bufrelease(lang);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -215,7 +215,7 @@ PHP_METHOD(sundown_render_html, blockQuote)
output = bufnew(128);
html->cb.blockquote(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -241,7 +241,7 @@ PHP_METHOD(sundown_render_html, blockHtml)
output = bufnew(128);
html->cb.blockhtml(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -268,7 +268,7 @@ PHP_METHOD(sundown_render_html, header)
output = bufnew(128);
html->cb.header(output,input,header_level, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -283,7 +283,7 @@ PHP_METHOD(sundown_render_html, hrule)
output = bufnew(128);
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
html->cb.hrule(output,&html->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
@@ -313,7 +313,7 @@ PHP_METHOD(sundown_render_html, listBox)
if (input != NULL) {
bufrelease(input);
}
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -343,7 +343,7 @@ PHP_METHOD(sundown_render_html, listItem)
bufrelease(input);
}
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -369,7 +369,7 @@ PHP_METHOD(sundown_render_html, paragraph)
output = bufnew(128);
html->cb.paragraph(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -395,7 +395,7 @@ PHP_METHOD(sundown_render_html, table)
b_body = str2buf(body,body_len);
output = bufnew(128);
html->cb.table(output,b_header,b_body,&base->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(b_header);
bufrelease(b_body);
bufrelease(output);
@@ -421,7 +421,7 @@ PHP_METHOD(sundown_render_html, tableRow)
input = str2buf(contents, contents_len);
output = bufnew(128);
html->cb.table_row(output,input,&base->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(input);
bufrelease(output);
}
@@ -448,7 +448,7 @@ PHP_METHOD(sundown_render_html, tableCell)
input = str2buf(content, content_len);
output = bufnew(128);
html->cb.table_cell(output,input,alignment,&base->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(input);
bufrelease(output);
}
@@ -474,7 +474,7 @@ PHP_METHOD(sundown_render_html, autolink)
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
html->cb.autolink(output,m_link,link_type, &html->html);
bufrelease(m_link);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
@@ -499,7 +499,7 @@ PHP_METHOD(sundown_render_html, codespan)
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
html->cb.codespan(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -525,7 +525,7 @@ PHP_METHOD(sundown_render_html, doubleEmphasis)
output = bufnew(128);
html->cb.double_emphasis(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -551,7 +551,7 @@ PHP_METHOD(sundown_render_html, emphasis)
output = bufnew(128);
html->cb.emphasis(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -581,7 +581,7 @@ PHP_METHOD(sundown_render_html, image)
bufrelease(b_link);
bufrelease(b_title);
bufrelease(b_alt_text);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -596,7 +596,7 @@ PHP_METHOD(sundown_render_html, linebreak)
output = bufnew(128);
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
html->cb.linebreak(output,&html->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -624,7 +624,7 @@ PHP_METHOD(sundown_render_html, link)
bufrelease(m_link);
bufrelease(m_title);
bufrelease(m_content);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -648,7 +648,7 @@ PHP_METHOD(sundown_render_html, rawHtml)
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
html->cb.raw_html_tag(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -672,7 +672,7 @@ PHP_METHOD(sundown_render_html, tripleEmphasis)
output = bufnew(128);
html->cb.triple_emphasis(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -696,7 +696,7 @@ PHP_METHOD(sundown_render_html, strikethrough)
output = bufnew(128);
html->cb.strikethrough(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -720,7 +720,7 @@ PHP_METHOD(sundown_render_html, superscript)
output = bufnew(128);
html->cb.superscript(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -743,12 +743,12 @@ PHP_METHOD(sundown_render_html, entity)
if (html->cb.entity) {
input = str2buf(text, text_len);
output = bufnew(128);
- html->cb.entity(output,input, &html->html);
+ html->cb.entity(output, input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
} else {
- RETVAL_STRINGL(text,text_len, 1);
+ RETVAL_STRINGL((char *)text, text_len, 1);
}
}
/* }}} */
@@ -772,7 +772,7 @@ PHP_METHOD(sundown_render_html, normalText)
output = bufnew(128);
html->cb.normal_text(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
View
32 render_html_toc.c
@@ -213,10 +213,10 @@ PHP_METHOD(sundown_render_html_toc, header)
html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
input = str2buf(htext, htext_len);
- output = bufnew(128);
- html->cb.header(output,input,header_level, &base->html);
+ output = bufnew(128);
+ html->cb.header(output, input, header_level, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -302,9 +302,9 @@ PHP_METHOD(sundown_render_html_toc, codespan)
input = str2buf(code, code_len);
output = bufnew(128);
html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
- html->cb.codespan(output,input, &html->html);
+ html->cb.codespan(output, input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -329,7 +329,7 @@ PHP_METHOD(sundown_render_html_toc, doubleEmphasis)
output = bufnew(128);
html->cb.double_emphasis(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -355,7 +355,7 @@ PHP_METHOD(sundown_render_html_toc, emphasis)
output = bufnew(128);
html->cb.emphasis(output,input, &base->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -399,7 +399,7 @@ PHP_METHOD(sundown_render_html_toc, link)
bufrelease(m_link);
bufrelease(m_title);
bufrelease(m_content);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -431,7 +431,7 @@ PHP_METHOD(sundown_render_html_toc, tripleEmphasis)
output = bufnew(128);
html->cb.triple_emphasis(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -453,9 +453,9 @@ PHP_METHOD(sundown_render_html_toc, strikethrough)
html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
input = str2buf(text, text_len);
output = bufnew(128);
- html->cb.strikethrough(output,input, &html->html);
+ html->cb.strikethrough(output, input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -479,7 +479,7 @@ PHP_METHOD(sundown_render_html_toc, superscript)
output = bufnew(128);
html->cb.superscript(output,input, &html->html);
bufrelease(input);
- RETVAL_STRINGL(output->data, output->size,1);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
@@ -500,11 +500,11 @@ PHP_METHOD(sundown_render_html_toc, normalText)
int text_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "s",&text, &text_len) == FAILURE) {
+ "s", &text, &text_len) == FAILURE) {
return;
}
- RETVAL_STRINGL(text,text_len,1);
+ RETVAL_STRINGL(text, text_len, 1);
}
/* }}} */
@@ -525,8 +525,8 @@ PHP_METHOD(sundown_render_html_toc, docFooter)
html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
output = bufnew(128);
- html->cb.doc_footer(output,&html->html);
- RETVAL_STRINGL(output->data, output->size,1);
+ html->cb.doc_footer(output, &html->html);
+ RETVAL_STRINGL((char *)output->data, output->size, 1);
bufrelease(output);
}
/* }}} */
View
50 sundown_markdown.c
@@ -387,7 +387,6 @@ PHP_METHOD(sundown_markdown, __destruct)
*/
PHP_METHOD(sundown_markdown, render)
{
- php_sundown_markdown_t *object = (php_sundown_markdown_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
php_sundown_render_base_t *render_base;
zval preprocess, postprocess, *params[1], *ret, *render, *m_retval;
struct buf input_buf, *output_buf;
@@ -411,23 +410,19 @@ PHP_METHOD(sundown_markdown, render)
output_buf = bufnew(128);
bufgrow(output_buf, buffer_len * 1.2f);
- if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render) == FAILURE) {
- return;
- }
-
- if (zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &m_retval)) {
- table = Z_ARRVAL_P(m_retval);
- php_sundown__get_render_flags(table, &render_flags);
- table = NULL;
- zval_ptr_dtor(&m_retval);
- }
-
- if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getextensions", &m_retval)) {
- table = Z_ARRVAL_P(m_retval);
- php_sundown__get_extensions(table, &enabled_extensions);
- table = NULL;
- zval_ptr_dtor(&m_retval);
- }
+ zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render);
+
+ zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &m_retval);
+ table = Z_ARRVAL_P(m_retval);
+ php_sundown__get_render_flags(table, &render_flags);
+ table = NULL;
+ zval_ptr_dtor(&m_retval);
+
+ zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getextensions", &m_retval);
+ table = Z_ARRVAL_P(m_retval);
+ php_sundown__get_extensions(table, &enabled_extensions);
+ table = NULL;
+ zval_ptr_dtor(&m_retval);
/* @todo: setup render */
switch (SUNDOWN_RENDER_HTML) {
@@ -465,10 +460,10 @@ PHP_METHOD(sundown_markdown, render)
memset(&input_buf, 0x0, sizeof(struct buf));
if (ret != NULL && Z_TYPE_P(ret) == IS_STRING) {
- input_buf.data = Z_STRVAL_P(ret);
+ input_buf.data = (uint8_t *)Z_STRVAL_P(ret);
input_buf.size = Z_STRLEN_P(ret);
} else {
- input_buf.data = buffer;
+ input_buf.data = (uint8_t *)buffer;
input_buf.size = strlen(buffer);
}
zval_ptr_dtor(&params[0]);
@@ -482,15 +477,15 @@ PHP_METHOD(sundown_markdown, render)
/* postprocess */
MAKE_STD_ZVAL(ret);
MAKE_STD_ZVAL(params[0]);
- ZVAL_STRINGL(params[0], output_buf->data,output_buf->size, 1);
+ ZVAL_STRINGL(params[0], (char *)output_buf->data, output_buf->size, 1);
ZVAL_STRING(&postprocess,"postprocess",1);
if (call_user_function(NULL, &render, &postprocess, ret, 1, params TSRMLS_CC) == FAILURE) {
}
if (ret != NULL && Z_TYPE_P(ret) == IS_STRING) {
- RETVAL_STRINGL(Z_STRVAL_P(ret), Z_STRLEN_P(ret),1);
+ RETVAL_STRINGL(Z_STRVAL_P(ret), Z_STRLEN_P(ret), 1);
} else {
- RETVAL_STRINGL(output_buf->data,output_buf->size,1);
+ RETVAL_STRINGL((char *)output_buf->data, output_buf->size, 1);
}
zval_ptr_dtor(&ret);
zval_ptr_dtor(&params[0]);
@@ -536,13 +531,8 @@ PHP_METHOD(sundown_markdown, hasRenderFlag)
return;
}
- if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render) == FAILURE) {
- return;
- }
-
- if (zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &render_flags) == FAILURE) {
- return;
- }
+ zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render);
+ zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &render_flags);
table = Z_ARRVAL_P(render_flags);
RETVAL_BOOL(php_sundown_has_ext(table, name));
Please sign in to comment.
Something went wrong with that request. Please try again.