Opened 14 years ago

Closed 12 years ago

#1413 closed defect (fixed)

Whitespace no longer accepted by style string parser

Reported by: dev@… Owned by: warmerdam
Priority: low Milestone:
Component: OGR_SF Version: 1.4.0
Severity: minor Keywords:


I've just moved from GDAL 1.3.2 to the latest 1.4 beta and the previously acceptable:
"BRUSH(fc:#000000, bc:#000000)" now fails to parse (note the space).
"BRUSH(fc:#000000,bc:#000000)" is fine. 

No explicit error was raised, but (for the first case above) the BrushStyle returned :

pszColor = poStyleBrush->ForeColor(bDefault); // returns a color ok
pszColor = poStyleBrush->BackColor(bDefault); // returns null

Change History (1)

comment:1 Changed 12 years ago by dron

Resolution: fixed
Status: newclosed

Well, the error is not reported, but bDefault flag clearly shows that there is a problem. E.g., the following test program

#include <ogr_featurestyle.h>

int main()
    OGRStyleBrush oBrush1, oBrush2;
    GBool bDefault1, bDefault2;
    const char *pszFore, *pszBack;

    oBrush1.SetStyleString("BRUSH(fc:#123456, bc:#654321)");

    pszFore = oBrush1.ForeColor(bDefault1);
    pszBack = oBrush1.BackColor(bDefault2);
    printf("%s: ForeColor=%s (%d), BackColor=%s (%d)\n", oBrush1.GetStyleString(),
           pszFore, bDefault1, pszBack, bDefault2);
    pszFore = oBrush2.ForeColor(bDefault1);
    pszBack = oBrush2.BackColor(bDefault2);
    printf("%s: ForeColor=%s (%d), BackColor=%s (%d)\n", oBrush2.GetStyleString(),
           pszFore, bDefault1, pszBack, bDefault2);

    return 0;


BRUSH(fc:#123456): ForeColor=#123456 (0), BackColor=(null) (1)
BRUSH(fc:#123456,bc:#654321): ForeColor=#123456 (0), BackColor=#654321 (0)

bDefault should be always checked for possible failure.

Anyhow, I have fixed this issue with the r14175 in trunk.

Note: See TracTickets for help on using tickets.