<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:green'>* Revision 1.55 2007/11/21
22:39:56 fwarmerdam<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:green'> * close shx file in readonly mode (GDAL #1956)<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Frank,<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Food for thought on this bug,
closing access to the shape index file in read only mode or any other mode makes
little sense since that will remove random access capability for the driver and
all record fetches will have to operate in a sequential fashion. Not sure
if it was just a mistake or was there some other thought behind closing the shx
file in read only mode?<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Also, what are SAHooks?<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Best regards,<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal><span style='color:#1F497D'>Martin Chapman<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Chief Software Architect<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Fortified Datacom Inc.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>http://www.fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>mchapman@fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>303-324-1065<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Martin Chapman
[mailto:mchapman@texelinc.com] <br>
<b>Sent:</b> Sunday, December 16, 2007 5:50 PM<br>
<b>To:</b> 'Martin Chapman'; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> I found the culprit! -- Possible SyncToDisk() bug in 1.5<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='color:#1F497D'>I found the culprit!
It’s in file \gdal\ogr\ogrsf_frmts\shape\shpopen.c on line 686.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Looks like:<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:green'>/* In read-only mode, we can close the
SHX now */<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>if</span>
(strcmp(pszAccess, <span style='color:#A31515'>"rb"</span>) == 0)<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> {<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
psSHP->sHooks.FClose( psSHP->fpSHX );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> </span><b><span
style='font-size:12.0pt;font-family:"Courier New";color:red'>psSHP->fpSHX =
NULL; ?</span></b><b><span style='font-size:10.0pt;font-family:"Courier New";
color:red'><o:p></o:p></span></b></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>This
code closes the shx in read only mode but is used in the OGR shape code in
areas that don’t block readonly access…like creating the quad
indexes. I made the fix in my local copy but I changed jobs and lost my
username/password to SVN comitter access so someone else will have to make the
fix for me.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>Best
regards,</span><span style='color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal><span style='color:#1F497D'>Martin Chapman<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Chief Software Architect<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Fortified Datacom Inc.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>http://www.fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>mchapman@fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>303-324-1065<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Martin Chapman
[mailto:mchapman@texelinc.com] <br>
<b>Sent:</b> Sunday, December 16, 2007 5:21 PM<br>
<b>To:</b> 'Martin Chapman'; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> RE: [gdal-dev] Possible SyncToDisk() bug in 1.5<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='color:#1F497D'>Also, because SHX is not picked
up rendering or looping through geometries in a shape file is now very
slow. I will look into the bug further and see if I can find the
problem. Is anyone else seeing this issue in 1.5 or noticed shape files
being slow?<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal><span style='color:#1F497D'>Martin Chapman<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Chief Software Architect<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Fortified Datacom Inc.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>http://www.fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>mchapman@fortifieddatacom.com<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>303-324-1065<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
gdal-dev-bounces@lists.osgeo.org [mailto:gdal-dev-bounces@lists.osgeo.org] <b>On
Behalf Of </b>Martin Chapman<br>
<b>Sent:</b> Sunday, December 16, 2007 5:16 PM<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> [gdal-dev] Possible SyncToDisk() bug in 1.5<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>This code:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>--<o:p></o:p></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>string sLayerName = (string)
m_pDataSource->GetLayer(0)->GetLayerDefn()->GetName();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>string sSQL = <span style='color:#A31515'>"CREATE
SPATIAL INDEX ON "</span> + sLayerName;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>m_pDataSource->ExecuteSQL((<span
style='color:blue'>const</span> <span style='color:blue'>char</span>*)
sSQL.c_str(), NULL, <span style='color:#A31515'>""</span>);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>--<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>throws
an error in the file/function below on the line - hSHP->sHooks.FFlush(
hSHP->fpSHX );</span><o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>because
hSHP->fpSHX is NULL. The question is why is hSHP->fpSHX NULL when
it used to pickup the shape index file. Anyone else have this problem
with 1.5? </span><o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>\gdal\ogr\ogrsf_frmts\shape\ogrshapelayer.cpp<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>OGRErr OGRShapeLayer::SyncToDisk()<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>if</span>(
bHeaderDirty )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> {<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span
style='color:blue'>if</span>( hSHP != NULL )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
SHPWriteHeader( hSHP );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span
style='color:blue'>if</span>( hDBF != NULL )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
DBFUpdateHeader( hDBF );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
bHeaderDirty = FALSE;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>if</span>(
hSHP != NULL )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> {<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
hSHP->sHooks.FFlush( hSHP->fpSHP );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> </span><b><span
style='font-size:12.0pt;font-family:"Courier New";color:red'>hSHP->sHooks.FFlush(
hSHP->fpSHX ); ka-boom!</span></b><b><span style='font-size:10.0pt;
font-family:"Courier New";color:red'><o:p></o:p></span></b></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>if</span>(
hDBF != NULL )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>
hDBF->sHooks.FFlush( hDBF->fp );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>return</span>
OGRERR_NONE;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>Best
regards,<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Martin Chapman<o:p></o:p></p>
<p class=MsoNormal>Chief Software Architect<o:p></o:p></p>
<p class=MsoNormal>Fortified Datacom Inc.<o:p></o:p></p>
<p class=MsoNormal><a href="http://www.fortifieddatacom.com">http://www.fortifieddatacom.com</a><o:p></o:p></p>
<p class=MsoNormal><a href="mailto:mchapman@fortifieddatacom.com">mchapman@fortifieddatacom.com</a><o:p></o:p></p>
<p class=MsoNormal>303-324-1065<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>