1261{
1262 const uint32_t set_count = 2;
1264 int pgrastpos[2] = {-1, -1};
1266
1267 uint32_t i;
1268 uint32_t j;
1269 uint32_t k;
1270 int rtn;
1271 int aligned = 0;
1272 char *reason = NULL;
1274
1275 for (i = 0, j = 0; i < set_count; i++) {
1276
1277 if (PG_ARGISNULL(j)) {
1278 for (k = 0; k < i; k++) {
1280 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1281 }
1282 PG_RETURN_NULL();
1283 }
1285 pgrastpos[i] = j;
1286 j++;
1287
1288
1290 if (!rast[i]) {
1291 for (k = 0; k <= i; k++) {
1292 if (k < i)
1294 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1295 }
1296 elog(ERROR, "RASTER_notSameAlignmentReason: Could not deserialize the %s raster", i < 1 ? "first" : "second");
1297 PG_RETURN_NULL();
1298 }
1299 }
1300
1302 rast[0],
1303 rast[1],
1304 &aligned,
1305 &reason
1306 );
1307 for (k = 0; k < set_count; k++) {
1309 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1310 }
1311
1313 elog(ERROR, "RASTER_notSameAlignmentReason: Could not test for alignment on the two rasters");
1314 PG_RETURN_NULL();
1315 }
1316
1317 result = cstring_to_text(reason);
1318 PG_RETURN_TEXT_P(
result);
1319}
char result[OUT_DOUBLE_BUFFER_SIZE]
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.