Skip to content
Permalink
Browse files

Ignore eventual leading UTF8 BOM (#5194)

  • Loading branch information
tbonfort committed Feb 24, 2016
1 parent 9b93019 commit e50c067a1577efc93a01f285e550b4d70e5f0af5
Showing with 2,021 additions and 2,000 deletions.
  1. +7 −0 mapfile.c
  2. +5 −1 mapfile.h
  3. +2,008 −1,999 maplexer.c
  4. +1 −0 maplexer.l
@@ -6235,12 +6235,19 @@ int msSaveMap(mapObj *map, char *filename)
static int loadMapInternal(mapObj *map)
{
int foundMapToken=MS_FALSE;
int foundBomToken = MS_FALSE;
int token;

for(;;) {

token = msyylex();

if(!foundBomToken && token == BOM) {
foundBomToken = MS_TRUE;
if(!foundMapToken) {
continue; /*skip a leading bom*/
}
}
if(!foundMapToken && token != MAP) {
msSetError(MS_IDENTERR, "First token must be MAP, this doesn't look like a mapfile.", "msLoadMap()");
return(MS_FAILURE);
@@ -312,6 +312,8 @@ enum MS_TOKEN_SOURCES {MS_FILE_TOKENS=0, MS_STRING_TOKENS, MS_URL_TOKENS};
#define SCALETOKEN 1270
#define VALUES 1271

#define TILESRS 1272

/* rfc 93 support for utfgrid */
#define UTFDATA 1280
#define UTFITEM 1281
@@ -321,9 +323,11 @@ enum MS_TOKEN_SOURCES {MS_FILE_TOKENS=0, MS_STRING_TOKENS, MS_URL_TOKENS};
#define COMPOP 1291
#define COMPFILTER 1292


#define BOM 1300

/* rfc59 bindvals objects */
#define BINDVALS 2000

#define TILESRS 1272

#endif /* MAPFILE_H */

0 comments on commit e50c067

Please sign in to comment.
You can’t perform that action at this time.