MCPcopy Index your code
hub / github.com/MapServer/MapServer / msSetOutputFormatOption

Function msSetOutputFormatOption

mapoutput.c:794–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792/************************************************************************/
793
794void msSetOutputFormatOption( outputFormatObj *format,
795 const char *key, const char *value )
796
797{
798 char *newline;
799 int i, len;
800
801/* -------------------------------------------------------------------- */
802/* Format the name=value pair into a newly allocated string. */
803/* -------------------------------------------------------------------- */
804 newline = (char *) malloc(strlen(key)+strlen(value)+2);
805 if( newline == NULL )
806 {
807 assert( newline != NULL );
808 return;
809 }
810
811 sprintf( newline, "%s=%s", key, value );
812
813/* -------------------------------------------------------------------- */
814/* Does this key already occur? If so replace it. */
815/* -------------------------------------------------------------------- */
816 len = strlen(key);
817
818 for( i = 0; i < format->numformatoptions; i++ )
819 {
820 if( strncasecmp(format->formatoptions[i],key,len) == 0
821 && format->formatoptions[i][len] == '=' )
822 {
823 free( format->formatoptions[i] );
824 format->formatoptions[i] = newline;
825 return;
826 }
827 }
828
829/* -------------------------------------------------------------------- */
830/* otherwise, we need to grow the list. */
831/* -------------------------------------------------------------------- */
832 format->numformatoptions++;
833 format->formatoptions = (char **)
834 realloc( format->formatoptions,
835 sizeof(char*) * format->numformatoptions );
836
837 format->formatoptions[format->numformatoptions-1] = newline;
838
839/* -------------------------------------------------------------------- */
840/* Capture generic value(s) we are interested in. */
841/* -------------------------------------------------------------------- */
842 if( strcasecmp(key,"BAND_COUNT") == 0 )
843 format->bands = atoi(value);
844}
845
846/************************************************************************/
847/* msGetOutputFormatMimeList() */

Callers 6

msApplyOutputFormatFunction · 0.85
msWCSGetCoverageFunction · 0.85
msWCSGetCoverage20Function · 0.85
processLayerMethod · 0.85
outputformat.cFile · 0.85

Calls 2

strncasecmpFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected