<html>
  <head>
    <meta content="text/html; charset=KOI8-R" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Frank,<br>
      <br>
      You quite right, what <br>
      <br>
      <blockquote>It is not clear to me why this should be necessary.
        šosAcronym is a long lived std::string (well CPLString derived
        from std::string) living in the registrars attribute list. šI
        assume the following method is used to convert the CPLString to
        "const char *" which should amount to the same thing you did. <br>
        <br>
      </blockquote>
      but this is not helps, as c_str() method of std::string not return
      pointer, but construct new zero ended const char* managed by
      std::string (maybe this is specific to VS2010-VS2013). This const
      char* cleared after some call to std::string or CPLString and we
      got empty (cleared) const char *pszAcronym. I think the
      VS2010-VS2013 compiler do this in getter by index, operator const
      char* or the whole GetAttrInfo(i) == NULL ? NULL :
      aoAttrInfos[i]->osAcronym (maybe MS change the order parameter
      calculation or optimization). Maybe const (operator const char*
      (void) const) in non const (const char *GetAttrAcronym( int i ))š
      function VS2010-VS2013 specific behaviour.<br>
      <br>
      OK, I fire the ticket. As I have committer rights, my I add
      changes, corresponding to the ticket?<br>
      <pre class="moz-signature" cols="72">Best regards,
    Dmitry</pre>
      05.12.2013 0:19, Frank Warmerdam ÐÉÛÅÔ:<br>
    </div>
    <blockquote
cite="mid:CA+YzLBcJk1UVX4mSz91waTRJDGu89yHXXsL1NOrGvnK_WCGq9Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Dmitriy,
        <div><br>
        </div>
        <div>It is not clear to me why this should be necessary.
          šosAcronym is a long lived std::string (well CPLString derived
          from std::string) living in the registrars attribute list. šI
          assume the following method is used to convert the CPLString
          to "const char *" which should amount to the same thing you
          did.š</div>
        <div><br>
        </div>
        <div>
          <div>š š operator const char* (void) const { return c_str(); }</div>
          <div><br>
          </div>
          <div>Perhaps there is some subtle reason I don't see that the
            compiler is creating a temporary std::string in between?š</div>
          <div><br>
          </div>
          <div>In any event, if you file a ticket I can apply this
            change upstream. šThere are other accessors on the same
            class that look like they could have similar issues.š</div>
          <div><br>
          </div>
          <div>Best regards,</div>
          <div>Frank</div>
          <div class="gmail_extra"><br>
            <br>
            <div class="gmail_quote">On Wed, Dec 4, 2013 at 12:11 PM,
              Dmitriy Baryshnikov <span dir="ltr"><<a
                  moz-do-not-send="true"
                  href="mailto:bishop.dev@gmail.com" target="_blank">bishop.dev@gmail.com</a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                <div text="#000000" bgcolor="#FFFFFF">
                  <div>Hi,<br>
                    <br>
                    I have such error: the GDAL compiled with
                    VS2010-VS2013 in s57 driver loose all additional
                    fields values. But the same code compiled with gcc
                    or previous VS works fine.<br>
                    I found the root of problems here
                    (ogr\ogrsf_frmts\s57\s57reader.cpp:932):<br>
                    <blockquote>const char *pszAcronym =
                      poRegistrar->GetAttrAcronym(nAttrId);<br>
                      iField =
                      poFeature->GetDefnRef()->GetFieldIndex(pszAcronym);<br>
                      <br>
                    </blockquote>
                    The pszAcronym always empty.<br>
                    <br>
                    The problem comes from this function
                    (ogr\ogrsf_frmts\s57\s57.h:140):<br>
                    <blockquote>const char *GetAttrAcronym( int i )<br>
                      ššš { return GetAttrInfo(i) == NULL ? NULL :
                      aoAttrInfos[i]->osAcronym; }<br>
                    </blockquote>
                    It seems to me that during execution this function I
                    have <code>situation when</code><code>c_str()</code><span
                      style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:left;font-style:normal;font-weight:normal;float:none;line-height:18px;text-transform:none;font-size:14px;white-space:normal;font-family:Arial,'Liberation
                      Sans','DejaVu
                      Sans',sans-serif;word-spacing:0px;display:inline!important"><span>š</span>result

                      becomes invalid (the<span>š</span></span><code>std::string</code><span><span>š</span>is
                      destroyed or a non-const member function of the
                      string is called).<span> </span></span><br>
                    <br>
                    If I change function <br>
                    <blockquote>const char *GetAttrAcronym( int i )<br>
                      ššš { return GetAttrInfo(i) == NULL ? NULL :
                      aoAttrInfos[i]->osAcronym.c_str(); }<br>
                    </blockquote>
                    the problem gone.<br>
                    <br>
                    So I need some confirmation/verification my ideas.<br>
                    If I'm right, I can make changes to s57 driver. <br>
                    <pre cols="72">Best regards,
    Dmitry
</pre>
                  </div>
                  <br>
                  <br>
                  <hr
style="border:none;color:rgb(144,144,144);background-color:rgb(176,176,176);min-height:1px;width:99%">
                  <table style="border-collapse:collapse;border:none">
                    <tbody>
                      <tr>
                        <td style="border:none;padding:0px 15px 0px 8px">
                          <a moz-do-not-send="true"
                            href="http://www.avast.com/" target="_blank">
                            <img moz-do-not-send="true" border="0"> </a>
                        </td>
                        <td>
                          <p
style="color:rgb(61,77,90);font-family:Calibri,Verdana,Arial,Helvetica;font-size:12pt">
                            üÔÏ ÓÏÏÂÝÅÎÉÅ Ó×ÏÂÏÄÎÏ ÏÔ ×ÉÒÕÓÏ× É
                            ×ÒÅÄÏÎÏÓÎÏÇÏ ðï ÂÌÁÇÏÄÁÒÑ <a
                              moz-do-not-send="true"
                              href="http://www.avast.com/"
                              target="_blank">avast! Antivirus</a>
                            ÚÁÝÉÔÁ ÁËÔÉ×ÎÁ. </p>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                  <br>
                </div>
                <br>
                _______________________________________________<br>
                gdal-dev mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
                <a moz-do-not-send="true"
                  href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
                  target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
              </blockquote>
            </div>
            <br>
            <br clear="all">
            <div><br>
            </div>
            -- <br>
---------------------------------------+--------------------------------------<br>
            I set the clouds in motion - turn upšš | Frank Warmerdam, <a
              moz-do-not-send="true" href="mailto:warmerdam@pobox.com"
              target="_blank">warmerdam@pobox.com</a><br>
            light and sound - activate the windows | <a
              moz-do-not-send="true"
              href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
            and watch the world go round - Rushš š | Geospatial Software
            Developer<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                üÔÏ ÓÏÏÂÝÅÎÉÅ Ó×ÏÂÏÄÎÏ ÏÔ ×ÉÒÕÓÏ× É ×ÒÅÄÏÎÏÓÎÏÇÏ ðï ÂÌÁÇÏÄÁÒÑ <a href="http://www.avast.com/">avast! Antivirus</a> ÚÁÝÉÔÁ ÁËÔÉ×ÎÁ.
                        </p>
                </td>
        </tr>
</table>
<br />
</body>
</html>