Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #1169

Merged
merged 13 commits into from Aug 29, 2013
Prev Previous commit
Next Next commit
Work around ZE code
  • Loading branch information
sjinks committed Aug 28, 2013
commit 4acbba48882e5e236b02cd4f4b4b2e108223244d
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: php
language:
- php
- c

php:
- 5.3
Expand All @@ -19,7 +21,7 @@ before_script:
- (cd php-tests/library/Mustache; git checkout master)
- (cd php-tests/library/Twig; git checkout master)
- (cd unit-tests/engines/; git clone -q git://github.com/bobthecow/mustache.php.git & git clone -q git://github.com/fabpot/Twig.git & wait)
- (cd ext; export CFLAGS="-g3 -O1 -std=gnu90 -Wall -Werror"; phpize && ./configure --enable-phalcon && make --silent -j4 && sudo make --silent install && phpenv config-add ../unit-tests/ci/phalcon.ini)
- (cd ext; export CFLAGS="-g3 -O1 -std=gnu90 -Wall -Werror -Wno-error=uninitialized"; phpize && ./configure --enable-phalcon && make --silent -j4 && sudo make --silent install && phpenv config-add ../unit-tests/ci/phalcon.ini)
- ulimit -c unlimited || true

script:
Expand Down
27 changes: 12 additions & 15 deletions ext/kernel/operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,29 +248,26 @@ void phalcon_cast(zval *result, zval *var, zend_uint type){
*/
long phalcon_get_intval(const zval *op) {

int type;
long long_value = 0;
double double_value = 0;

switch (Z_TYPE_P(op)) {
case IS_LONG:
return Z_LVAL_P(op);
case IS_BOOL:
return Z_BVAL_P(op);
case IS_DOUBLE:
return (long) Z_DVAL_P(op);
case IS_STRING:
if ((type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &long_value, &double_value, 0))) {
if (type == IS_LONG) {
return long_value;
} else {
if (type == IS_DOUBLE) {
return double_value;
} else {
return 0;
}
}
case IS_STRING: {
long long_value;
double double_value;
ASSUME(Z_STRVAL_P(op) != NULL);
zend_uchar type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &long_value, &double_value, 0);
if (type == IS_LONG) {
return long_value;
}
if (type == IS_DOUBLE) {
return (long)double_value;
}
return 0;
}
}

return 0;
Expand Down