Небольшой патчинг php_templates-1.7.2
Не компилится с ошибками:
Патчик:
vadim.flightmedia.ru/blog/2011/06/16/небольшой-патчинг-php_templates-1-7-2/
Читать дальше
/home/vadim/build/templates/tmpl_lib.c: In function 'php_tmpl_pre_parse':
/home/vadim/build/templates/tmpl_lib.c:217: error: lvalue required as left operand of assignment
/home/vadim/build/templates/tmpl_lib.c: In function 'php_tmpl_set':
/home/vadim/build/templates/tmpl_lib.c:446: warning: comparison of distinct pointer types lacks a cast
/home/vadim/build/templates/tmpl_lib.c:447: warning: comparison of distinct pointer types lacks a cast
/home/vadim/build/templates/tmpl_lib.c: In function 'php_tmpl_parse':
/home/vadim/build/templates/tmpl_lib.c:700: error: lvalue required as left operand of assignment
/home/vadim/build/templates/tmpl_lib.c: In function 'php_tmpl_load_structure':
/home/vadim/build/templates/tmpl_lib.c:880: error: lvalue required as left operand of assignment
Патчик:
--- ./templates.orig/tmpl_lib.c 2011-06-17 00:39:42.312591830 +0400
+++ ./templates/tmpl_lib.c 2011-06-17 00:40:32.342594981 +0400
@@ -214,7 +214,7 @@
buf_alloc = TMPL_MAX_TAG_LEN+4;
buf = (uchar*)emalloc(buf_alloc);
/* Searching algorythm will require larger buffer */
- ZV(tmpl->original) = (char*)erealloc(ZV(tmpl->original),
+ Z_STRVAL_P(tmpl->original) = (char*)erealloc(ZV(tmpl->original),
ZL(tmpl->original) + MAX(
ZL(tmpl->tag_left), MAX(
ZL(tmpl->tag_right), MAX(
@@ -697,7 +697,7 @@
/* Make a recursive call */
if(buf_alloc <= (unsigned)(ZL(path)+1+ZL(tag->name)+1)) {
while(buf_alloc <= (unsigned)(ZL(path)+1+ZL(tag->name)+1)) buf_alloc <<= 1;
- ZV(new_path) = (char*)erealloc(ZV(new_path), buf_alloc);
+ Z_STRVAL_P(new_path) = (char*)erealloc(ZV(new_path), buf_alloc);
}
sprintf(ZV(new_path), (1 == ZL(path) && '/' == ZV(path)[0]) ? "%s%s" : "%s/%s", ZV(path), ZV(tag->name));
ZL(new_path) = ZL(path) + ZL(tag->name) + ((1 == ZL(path) && '/' == ZV(path)[0]) ? 0 : 1);
@@ -877,7 +877,10 @@
} else p = key;
ZVAL_STRINGL(new_value, p, (TMPL_LONG == mod) ? key_len-1 : key_len-1-(p-key), 1);
if((TMPL_TAG | TMPL_CONTEXT) == mask && TMPL_CONTEXT == tag->typ) {
- ZV(new_value) = (char*)erealloc(ZV(new_value), ZL(new_value)+2);
+ Z_STRVAL_P(new_value) = (char*)erealloc(ZV(new_value), ZL(new_value)+2);
+
+
+
memcpy(ZV(new_value)+ZL(new_value), "/", 2);
ZL(new_value) += 1;
}
vadim.flightmedia.ru/blog/2011/06/16/небольшой-патчинг-php_templates-1-7-2/