[mapserver-commits] r10260 - trunk/mapserver/mapscript/php
svn at osgeo.org
svn at osgeo.org
Mon Jun 28 12:01:30 EDT 2010
Author: aboudreault
Date: 2010-06-28 16:01:30 +0000 (Mon, 28 Jun 2010)
New Revision: 10260
Modified:
trunk/mapserver/mapscript/php/grid.c
trunk/mapserver/mapscript/php/layer.c
trunk/mapserver/mapscript/php/map.c
trunk/mapserver/mapscript/php/php_mapscript.c
Log:
MapScript/PHP Fixed a few bugs related to lazy init
Modified: trunk/mapserver/mapscript/php/grid.c
===================================================================
--- trunk/mapserver/mapscript/php/grid.c 2010-06-28 13:56:58 UTC (rev 10259)
+++ trunk/mapserver/mapscript/php/grid.c 2010-06-28 16:01:30 UTC (rev 10260)
@@ -77,7 +77,7 @@
php_grid->grid = (graticuleObj *)php_layer->layer->layerinfo;
- if (Z_TYPE_P(php_layer->grid) == IS_OBJECT) {
+ if (php_layer->grid && (Z_TYPE_P(php_layer->grid) == IS_OBJECT)) {
php_old_grid = (php_grid_object *) zend_object_store_get_object(php_layer->grid TSRMLS_CC);
php_old_grid->parent.child_ptr = NULL;
zend_objects_store_del_ref(php_layer->grid TSRMLS_CC);
Modified: trunk/mapserver/mapscript/php/layer.c
===================================================================
--- trunk/mapserver/mapscript/php/layer.c 2010-06-28 13:56:58 UTC (rev 10259)
+++ trunk/mapserver/mapscript/php/layer.c 2010-06-28 16:01:30 UTC (rev 10260)
@@ -830,7 +830,8 @@
PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
php_layer = (php_layer_object *) zend_object_store_get_object(zobj TSRMLS_CC);
- php_projection = (php_projection_object *) zend_object_store_get_object(php_layer->projection TSRMLS_CC);
+ if (php_layer->projection)
+ php_projection = (php_projection_object *) zend_object_store_get_object(php_layer->projection TSRMLS_CC);
if ((status = layerObj_setProjection(php_layer->layer, projection)) != MS_SUCCESS)
{
@@ -838,7 +839,8 @@
RETURN_LONG(status);
}
- php_projection->projection = &(php_layer->layer->projection);
+ if (php_layer->projection)
+ php_projection->projection = &(php_layer->layer->projection);
RETURN_LONG(status);
}
@@ -892,7 +894,8 @@
PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
php_layer = (php_layer_object *) zend_object_store_get_object(zobj TSRMLS_CC);
- php_projection = (php_projection_object *) zend_object_store_get_object(php_layer->projection TSRMLS_CC);
+ if (php_layer->projection)
+ php_projection = (php_projection_object *) zend_object_store_get_object(php_layer->projection TSRMLS_CC);
if ((status = layerObj_setWKTProjection(php_layer->layer, projection)) != MS_SUCCESS)
{
@@ -900,7 +903,8 @@
return;
}
- php_projection->projection = &(php_layer->layer->projection);
+ if (php_layer->projection)
+ php_projection->projection = &(php_layer->layer->projection);
RETURN_LONG(status);
}
Modified: trunk/mapserver/mapscript/php/map.c
===================================================================
--- trunk/mapserver/mapscript/php/map.c 2010-06-28 13:56:58 UTC (rev 10259)
+++ trunk/mapserver/mapscript/php/map.c 2010-06-28 16:01:30 UTC (rev 10260)
@@ -2106,7 +2106,6 @@
int status = MS_FAILURE;
long setUnitsAndExtents = MS_FALSE;
php_map_object *php_map;
- php_projection_object *php_projection;
PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
@@ -2117,7 +2116,6 @@
PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
php_map = (php_map_object *) zend_object_store_get_object(zobj TSRMLS_CC);
- php_projection = (php_projection_object *) zend_object_store_get_object(php_map->projection TSRMLS_CC);
status = mapscript_map_setProjection(MS_FALSE, php_map,
projection, setUnitsAndExtents TSRMLS_CC);
@@ -2865,10 +2863,11 @@
return;
}
PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);
-
+
php_map = (php_map_object *) zend_object_store_get_object(zobj TSRMLS_CC);
- php_outputformat = (php_outputformat_object *) zend_object_store_get_object(php_map->outputformat TSRMLS_CC);
-
+ if (php_map->outputformat)
+ php_outputformat = (php_outputformat_object *) zend_object_store_get_object(php_map->outputformat TSRMLS_CC);
+
if ((status = mapObj_selectOutputFormat(php_map->map,
type)) != MS_SUCCESS)
@@ -2876,7 +2875,7 @@
mapscript_report_php_error(E_WARNING, "Unable to set output format to '%s'" TSRMLS_CC,
type);
}
- else
+ else if (php_map->outputformat)
{
php_outputformat->outputformat = php_map->map->outputformat;
}
@@ -3450,8 +3449,10 @@
php_projection_object *php_projection;
php_rect_object *php_extent;
- php_projection = (php_projection_object *) zend_object_store_get_object(php_map->projection TSRMLS_CC);
- php_extent = (php_rect_object *) zend_object_store_get_object(php_map->extent TSRMLS_CC);
+ if (php_map->projection)
+ php_projection = (php_projection_object *) zend_object_store_get_object(php_map->projection TSRMLS_CC);
+ if (php_map->extent)
+ php_extent = (php_rect_object *) zend_object_store_get_object(php_map->extent TSRMLS_CC);
in = php_map->map->projection;
msInitProjection(&out);
@@ -3482,7 +3483,7 @@
mapscript_report_php_error(E_WARNING, "setProjection failed" TSRMLS_CC);
return MS_FAILURE;
}
- else
+ else if (php_map->projection)
{
php_projection->projection = &(php_map->map->projection);
}
@@ -3504,7 +3505,8 @@
msCalculateScale(php_map->map->extent, php_map->map->units, php_map->map->width, php_map->map->height,
php_map->map->resolution, &(php_map->map->scaledenom));
- php_extent->rect = &(php_map->map->extent);
+ if (php_map->extent)
+ php_extent->rect = &(php_map->map->extent);
}
}
Modified: trunk/mapserver/mapscript/php/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php/php_mapscript.c 2010-06-28 13:56:58 UTC (rev 10259)
+++ trunk/mapserver/mapscript/php/php_mapscript.c 2010-06-28 16:01:30 UTC (rev 10260)
@@ -557,7 +557,7 @@
php_layer->layer->layerinfo = (graticuleObj *)malloc( sizeof( graticuleObj ) );
initGrid((graticuleObj *)php_layer->layer->layerinfo);
- if (Z_TYPE_P(php_layer->grid) == IS_OBJECT) {
+ if (php_layer->grid && (Z_TYPE_P(php_layer->grid) == IS_OBJECT)) {
php_grid = (php_grid_object *) zend_object_store_get_object(php_layer->grid TSRMLS_CC);
php_grid->parent.child_ptr = NULL;
zend_objects_store_del_ref(php_layer->grid TSRMLS_CC);
More information about the mapserver-commits
mailing list