| 438 | /************************************************************************/ |
| 439 | |
| 440 | static outputFormatObj *msAllocOutputFormat( mapObj *map, const char *name, |
| 441 | const char *driver ) |
| 442 | |
| 443 | { |
| 444 | outputFormatObj *format; |
| 445 | |
| 446 | /* -------------------------------------------------------------------- */ |
| 447 | /* Allocate the format object. */ |
| 448 | /* -------------------------------------------------------------------- */ |
| 449 | format = (outputFormatObj *) calloc(1,sizeof(outputFormatObj)); |
| 450 | if( format == NULL ) |
| 451 | { |
| 452 | msSetError( MS_MEMERR, NULL, "msAllocOutputFormat()" ); |
| 453 | return NULL; |
| 454 | } |
| 455 | |
| 456 | /* -------------------------------------------------------------------- */ |
| 457 | /* Initialize various fields. */ |
| 458 | /* -------------------------------------------------------------------- */ |
| 459 | format->bands = 1; |
| 460 | format->name = msStrdup(name); |
| 461 | format->driver = msStrdup(driver); |
| 462 | format->refcount = 0; |
| 463 | format->vtable = NULL; |
| 464 | format->device = NULL; |
| 465 | format->imagemode = MS_IMAGEMODE_PC256; |
| 466 | |
| 467 | /* -------------------------------------------------------------------- */ |
| 468 | /* Attach to map. */ |
| 469 | /* -------------------------------------------------------------------- */ |
| 470 | if( map != NULL ) |
| 471 | { |
| 472 | map->numoutputformats++; |
| 473 | if( map->outputformatlist == NULL ) |
| 474 | map->outputformatlist = (outputFormatObj **) malloc(sizeof(void*)); |
| 475 | else |
| 476 | map->outputformatlist = (outputFormatObj **) |
| 477 | realloc(map->outputformatlist, |
| 478 | sizeof(void*) * map->numoutputformats ); |
| 479 | |
| 480 | map->outputformatlist[map->numoutputformats-1] = format; |
| 481 | format->refcount++; |
| 482 | } |
| 483 | |
| 484 | return format; |
| 485 | } |
| 486 | |
| 487 | /************************************************************************/ |
| 488 | /* msAppendOutputFormat() */ |
no test coverage detected