PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int copy_rastinfo ( RASTERINFO dst,
RASTERINFO src 
)
static

Definition at line 535 of file raster2pgsql.c.

References _, rasterinfo_t::bandtype, rasterinfo_t::dim, rasterinfo_t::gdalbandtype, rasterinfo_t::gt, rasterinfo_t::hasnodata, rasterinfo_t::nband, rasterinfo_t::nband_count, rasterinfo_t::nodataval, rtalloc(), rterror(), rasterinfo_t::srs, and rasterinfo_t::tile_size.

Referenced by process_rasters().

535  {
536  if (src->srs != NULL) {
537  dst->srs = rtalloc(sizeof(char) * (strlen(src->srs) + 1));
538  if (dst->srs == NULL) {
539  rterror(_("copy_rastinfo: Not enough memory"));
540  return 0;
541  }
542  strcpy(dst->srs, src->srs);
543  }
544  memcpy(dst->dim, src->dim, sizeof(uint32_t) * 2);
545  dst->nband_count = src->nband_count;
546  if (src->nband_count && src->nband != NULL) {
547  dst->nband = rtalloc(sizeof(int) * src->nband_count);
548  if (dst->nband == NULL) {
549  rterror(_("copy_rastinfo: Not enough memory"));
550  return 0;
551  }
552  memcpy(dst->nband, src->nband, sizeof(int) * src->nband_count);
553  }
554  if (src->gdalbandtype != NULL) {
555  dst->gdalbandtype = rtalloc(sizeof(GDALDataType) * src->nband_count);
556  if (dst->gdalbandtype == NULL) {
557  rterror(_("copy_rastinfo: Not enough memory"));
558  return 0;
559  }
560  memcpy(dst->gdalbandtype, src->gdalbandtype, sizeof(GDALDataType) * src->nband_count);
561  }
562  if (src->bandtype != NULL) {
563  dst->bandtype = rtalloc(sizeof(rt_pixtype) * src->nband_count);
564  if (dst->bandtype == NULL) {
565  rterror(_("copy_rastinfo: Not enough memory"));
566  return 0;
567  }
568  memcpy(dst->bandtype, src->bandtype, sizeof(rt_pixtype) * src->nband_count);
569  }
570  if (src->hasnodata != NULL) {
571  dst->hasnodata = rtalloc(sizeof(int) * src->nband_count);
572  if (dst->hasnodata == NULL) {
573  rterror(_("copy_rastinfo: Not enough memory"));
574  return 0;
575  }
576  memcpy(dst->hasnodata, src->hasnodata, sizeof(int) * src->nband_count);
577  }
578  if (src->nodataval != NULL) {
579  dst->nodataval = rtalloc(sizeof(double) * src->nband_count);
580  if (dst->nodataval == NULL) {
581  rterror(_("copy_rastinfo: Not enough memory"));
582  return 0;
583  }
584  memcpy(dst->nodataval, src->nodataval, sizeof(double) * src->nband_count);
585  }
586  memcpy(dst->gt, src->gt, sizeof(double) * 6);
587  memcpy(dst->tile_size, src->tile_size, sizeof(int) * 2);
588 
589  return 1;
590 }
GDALDataType * gdalbandtype
Definition: raster2pgsql.h:174
rt_pixtype * bandtype
Definition: raster2pgsql.h:175
#define _(String)
Definition: shpcommon.h:23
int tile_size[2]
Definition: raster2pgsql.h:186
rt_pixtype
Definition: rt_api.h:172
uint32_t dim[2]
Definition: raster2pgsql.h:167
void * rtalloc(size_t size)
Raster core memory management functions.
Definition: rt_api.c:867
void rterror(const char *fmt,...)
Raster core error and info handlers.
Definition: rt_api.c:895
double * nodataval
Definition: raster2pgsql.h:180
double gt[6]
Definition: raster2pgsql.h:183

Here is the call graph for this function:

Here is the caller graph for this function: