| 4216 | #define MAX_FORMATOPTIONS 100 |
| 4217 | |
| 4218 | static int loadOutputFormat(mapObj *map) |
| 4219 | { |
| 4220 | char *name = NULL; |
| 4221 | char *mimetype = NULL; |
| 4222 | char *driver = NULL; |
| 4223 | char *extension = NULL; |
| 4224 | int imagemode = MS_NOOVERRIDE; |
| 4225 | int transparent = MS_NOOVERRIDE; |
| 4226 | char *formatoptions[MAX_FORMATOPTIONS]; |
| 4227 | int numformatoptions = 0; |
| 4228 | char *value = NULL; |
| 4229 | |
| 4230 | for(;;) { |
| 4231 | switch(msyylex()) { |
| 4232 | case(EOF): |
| 4233 | msSetError(MS_EOFERR, NULL, "loadOutputFormat()"); |
| 4234 | return(-1); |
| 4235 | |
| 4236 | case(END): |
| 4237 | { |
| 4238 | outputFormatObj *format; |
| 4239 | |
| 4240 | if( driver == NULL ) |
| 4241 | { |
| 4242 | msSetError(MS_MISCERR, |
| 4243 | "OUTPUTFORMAT clause lacks DRIVER keyword near (%s):(%d)", |
| 4244 | "loadOutputFormat()", |
| 4245 | msyystring_buffer, msyylineno ); |
| 4246 | return -1; |
| 4247 | } |
| 4248 | |
| 4249 | format = msCreateDefaultOutputFormat( map, driver, name ); |
| 4250 | msFree( name ); |
| 4251 | name = NULL; |
| 4252 | if( format == NULL ) |
| 4253 | { |
| 4254 | msSetError(MS_MISCERR, |
| 4255 | "OUTPUTFORMAT clause references driver %s, but this driver isn't configured.", |
| 4256 | "loadOutputFormat()", driver ); |
| 4257 | return -1; |
| 4258 | } |
| 4259 | msFree( driver ); |
| 4260 | |
| 4261 | if( transparent != MS_NOOVERRIDE ) |
| 4262 | format->transparent = transparent; |
| 4263 | if( extension != NULL ) |
| 4264 | { |
| 4265 | msFree( format->extension ); |
| 4266 | format->extension = extension; |
| 4267 | } |
| 4268 | if( mimetype != NULL ) |
| 4269 | { |
| 4270 | msFree( format->mimetype ); |
| 4271 | format->mimetype = mimetype; |
| 4272 | } |
| 4273 | if( imagemode != MS_NOOVERRIDE ) |
| 4274 | { |
| 4275 | format->imagemode = imagemode; |
no test coverage detected