Opened 12 years ago

Closed 11 years ago

#3965 closed defect (fixed)

String comparison problem in ogr_srs_esri.cpp

Reported by: rprinceley Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: OGR_SRS Version: 1.8.0
Severity: normal Keywords:
Cc: gaopeng, esrixz, Xiuguang


In RemapNameBasedOnKeyName():

  for( i = 0; mappingTable[i] != NULL; i += 2 )
    n = strlen(pszName);
    if( EQUALN(pszName, mappingTable[i],n) )
      iIndex = i;

We have a "Sphere_of_Radius_XXX" entry in one of our tables, which is incorrectly returned as a match for user defined spheroid named "Sphere". Ideally, this comparison should include entire string.

Change History (3)

comment:1 by warmerdam, 11 years ago

Cc: esrixz added
Status: newassigned


That code was contributed by Xiaguang Zhou and I am not sure why he chose to check for prefixes. I am hesitant to remove this without knowing the reason, but I think I could safely add a first pass loop that would look for exact matches if that would help.

comment:2 by rprinceley, 11 years ago

Cc: Xiuguang added


In 1.6-esri source this is an EQUAL check but EQUALN in 1.8. As such, it should be safe to change this in 1.8.

comment:3 by warmerdam, 11 years ago

Component: GDAL_RasterOGR_SRS
Milestone: 1.9.0
Resolution: fixed
Status: assignedclosed

OK, good enough for me. I do wish I knew why the partial comparison was put in place.

Updated in trunk (r21828). I see 1.8-esri already has this. I don't think it is critical in 1.8 branch. Let me know if you think otherwise.

Note: See TracTickets for help on using tickets.