1257{
1258 const uint32_t set_count = 2;
1260 int pgrastpos[2] = {-1, -1};
1262
1263 uint32_t i;
1264 uint32_t j;
1265 uint32_t k;
1266 int rtn;
1267 int aligned = 0;
1268 char *reason = NULL;
1269 text *result = NULL;
1270
1271 for (i = 0, j = 0; i < set_count; i++) {
1272
1273 if (PG_ARGISNULL(j)) {
1274 for (k = 0; k < i; k++) {
1276 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1277 }
1278 PG_RETURN_NULL();
1279 }
1281 pgrastpos[i] = j;
1282 j++;
1283
1284
1286 if (!rast[i]) {
1287 for (k = 0; k <= i; k++) {
1288 if (k < i)
1290 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1291 }
1292 elog(ERROR, "RASTER_notSameAlignmentReason: Could not deserialize the %s raster", i < 1 ? "first" : "second");
1293 PG_RETURN_NULL();
1294 }
1295 }
1296
1298 rast[0],
1299 rast[1],
1300 &aligned,
1301 &reason
1302 );
1303 for (k = 0; k < set_count; k++) {
1305 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1306 }
1307
1309 elog(ERROR, "RASTER_notSameAlignmentReason: Could not test for alignment on the two rasters");
1310 PG_RETURN_NULL();
1311 }
1312
1313 result = cstring_to_text(reason);
1314 PG_RETURN_TEXT_P(result);
1315}
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_errorstate rt_raster_same_alignment(rt_raster rast1, rt_raster rast2, int *aligned, char **reason)
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.