Fix #1569587 for PHP. Don't use sizeof() except with string literals. Change
some "//" comments to "/* */" for portability. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9404 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5c3a3b0e28
commit
adf46e4378
2 changed files with 18 additions and 12 deletions
|
|
@ -1,6 +1,13 @@
|
||||||
Version 1.3.30 (in progress)
|
Version 1.3.30 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
10/04/2006: olly
|
||||||
|
[php] Fix #1569587 for PHP. Don't use sizeof() except with string
|
||||||
|
literals. Change some "//" comments to "/* */" for portability.
|
||||||
|
|
||||||
|
10/04/2006: mgossage
|
||||||
|
[Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct.
|
||||||
|
|
||||||
10/03/2006: wsfulton
|
10/03/2006: wsfulton
|
||||||
[Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced
|
[Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced
|
||||||
uncompileable code when used with the director:except feature.
|
uncompileable code when used with the director:except feature.
|
||||||
|
|
@ -9,9 +16,6 @@ Version 1.3.30 (in progress)
|
||||||
Directors: Directors are output in the order in which they are declared in
|
Directors: Directors are output in the order in which they are declared in
|
||||||
the C++ class rather than in some pseudo-random order.
|
the C++ class rather than in some pseudo-random order.
|
||||||
|
|
||||||
10/04/2006: mgossage
|
|
||||||
[Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct.
|
|
||||||
|
|
||||||
10/03/2006: mmatus
|
10/03/2006: mmatus
|
||||||
Fix #1486281 and #1471039.
|
Fix #1486281 and #1471039.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,35 +17,37 @@
|
||||||
signed char,
|
signed char,
|
||||||
bool,
|
bool,
|
||||||
enum SWIGTYPE
|
enum SWIGTYPE
|
||||||
"REGISTER_LONG_CONSTANT( \"$symname\", $value, CONST_CS | CONST_PERSISTENT);";
|
"REGISTER_LONG_CONSTANT(\"$symname\", $value, CONST_CS | CONST_PERSISTENT);";
|
||||||
|
|
||||||
%typemap(consttab) float,
|
%typemap(consttab) float,
|
||||||
double
|
double
|
||||||
"REGISTER_DOUBLE_CONSTANT(\"$symname\", $value, CONST_CS | CONST_PERSISTENT);";
|
"REGISTER_DOUBLE_CONSTANT(\"$symname\", $value, CONST_CS | CONST_PERSISTENT);";
|
||||||
|
|
||||||
%typemap(consttab) char
|
%typemap(consttab) char {
|
||||||
"REGISTER_STRING_CONSTANT(\"$symname\", \"$value\", CONST_CS | CONST_PERSISTENT );";
|
char swig_char = $value;
|
||||||
|
REGISTER_STRINGL_CONSTANT("$symname", &swig_char, 1, CONST_CS | CONST_PERSISTENT);
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(consttab) char *,
|
%typemap(consttab) char *,
|
||||||
const char *,
|
const char *,
|
||||||
char [],
|
char [],
|
||||||
const char []
|
const char []
|
||||||
"REGISTER_STRINGL_CONSTANT(\"$symname\", \"$value\", sizeof(\"$value\") - 1, CONST_CS | CONST_PERSISTENT);";
|
"REGISTER_STRINGL_CONSTANT(\"$symname\", $value, strlen($value), CONST_CS | CONST_PERSISTENT);";
|
||||||
|
|
||||||
%typemap(consttab) SWIGTYPE *,
|
%typemap(consttab) SWIGTYPE *,
|
||||||
SWIGTYPE &,
|
SWIGTYPE &,
|
||||||
SWIGTYPE [] {
|
SWIGTYPE [] {
|
||||||
// This actually registers it as a global variable and constant. I don't like it, but I can't figure out
|
/* This actually registers it as a global variable and constant. I don't
|
||||||
// the zend_constant code...
|
* like it, but I can't figure out the zend_constant code... */
|
||||||
zval *z_var;
|
zval *z_var;
|
||||||
MAKE_STD_ZVAL(z_var);
|
MAKE_STD_ZVAL(z_var);
|
||||||
SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0);
|
SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0);
|
||||||
//zend_hash_add(&EG(symbol_table), "$1", strlen("$1")+1, (void *)&z_var,sizeof(zval *), NULL);
|
/* zend_hash_add(&EG(symbol_table), "$1", sizeof("$1"), (void *)&z_var,sizeof(zval *), NULL); */
|
||||||
zend_constant c;
|
zend_constant c;
|
||||||
c.value = *z_var;
|
c.value = *z_var;
|
||||||
zval_copy_ctor(&c.value);
|
zval_copy_ctor(&c.value);
|
||||||
size_t len = strlen("$1");
|
size_t len = sizeof("$1") - 1;
|
||||||
c.name = zend_strndup( "$1", len );
|
c.name = zend_strndup("$1", len);
|
||||||
c.name_len = len+1;
|
c.name_len = len+1;
|
||||||
c.flags = CONST_CS | CONST_PERSISTENT;
|
c.flags = CONST_CS | CONST_PERSISTENT;
|
||||||
c.module_number = module_number;
|
c.module_number = module_number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue