stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Far...@kyiv.vdiweb.com>
Subject RE: svn commit: r448754 [2/6] - /incubator/stdcxx/trunk/util/
Date Fri, 22 Sep 2006 13:07:36 GMT
> -----Original Message-----
> From: sebor@apache.org [mailto:sebor@apache.org] 
> Sent: Friday, September 22, 2006 3:42 AM
> To: stdcxx-commits@incubator.apache.org
> Subject: svn commit: r448754 [2/6] - /incubator/stdcxx/trunk/util/
> 
> Modified: incubator/stdcxx/trunk/util/codecvt.cpp
> URL: 
> http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/codec
> vt.cpp?view=diff&rev=448754&r1=448753&r2=448754

[...]

>  write_codecvt (std::string dir_name)
>  {

[...]

> //////////////////////////////////////////////////////////////////
> +    // write out the multibyte to wchar_t tables
> +    issue_diag (I_WRITE, false, 0,
> +                "writing %lu multibyte tables (%lu characters)\n",
> +                mbchar_offs.size (), n_mbchars);
> +
> +    for (off_iter_t it = mbchar_offs.begin (); it != 
> mbchar_offs.end (); ++it) {
> +        for (unsigned i = 0; i <= UCHAR_MAX; ++i) {
> +
> +            const unsigned off = it->second->off [i];
> +
> +            out.write ((const char*)&off, sizeof off);
>          }
> +
> +        delete it->second->off;
  I think here should be "delete it->second;".

  At this line the MSVC 7.1 gives warnings:
codecvt.cpp(548) : warning C4156: deletion of an array expression
without using the array form of 'delete'; array form substituted
codecvt.cpp(548) : warning C4154: deletion of an array expression;
conversion to pointer supplied

>      }
>  
> -    issue_diag (I_WRITE, false, 0, "writing wchar_t to char 
> table\n");
> +    // not needed beyond this point, clear it out
> +    mbchar_offs.clear ();
> +
> +    
> //////////////////////////////////////////////////////////////////
> +    // write out the wchar_t to multibyte conversion tables
> +    issue_diag (I_WRITE, false, 0,
> +                "writing %lu wchar_t tables (%lu characters)\n",
> +                wchar_offs.size (), n_wchars);
> +
> +    for (off_iter_t it = wchar_offs.begin (); it != 
> wchar_offs.end (); ++it) {
> +        for (unsigned i = 0; i <= UCHAR_MAX; ++i) {
> +
> +            // adjust offsets to multibyte characters (but not those
> +            // to other tables or invalid encodings)
> +            unsigned off = it->second->off [i];
> +
> +            if (!(off & 0x80000000))
> +                off += mb_offset;
>  
> -    // now write the wide_to_narrow tables
> -    for (wchar_offs_it = wchar_offs_.begin(); 
> -         wchar_offs_it != wchar_offs_.end(); wchar_offs_it++) {
> -        for (unsigned int c = 0; c <= UCHAR_MAX; c++) {
> -            out.write ((const char*)&wchar_offs_it->second.off[c],
> -                       sizeof (wchar_offs_it->second.off[c]));
> +            out.write ((const char*)&off, sizeof off);
>          }
> +
> +        delete it->second->off;
  The same here, 

>      }
>              
> -    issue_diag (I_WRITE, false, 0, "writing UTF-8 to char table\n");
> +    // not needed beyond this point, clear it out
> +    wchar_offs.clear ();
> +
> +    
> //////////////////////////////////////////////////////////////////
> +    // write out the UTF-8 to (libc) multibyte tables
> +    issue_diag (I_WRITE, false, 0,
> +                "writing %lu UTF-8 tables (%lu characters)\n",
> +                uchar_offs.size (), n_uchars);
> +
> +    for (off_iter_t it = uchar_offs.begin (); it != 
> uchar_offs.end (); ++it) {
> +        for (unsigned i = 0; i <= UCHAR_MAX; ++i) {
> +
> +            // adjust offsets to multibyte characters (but not those
> +            // to other tables or invalid encodings)
> +            unsigned off = it->second->off [i];
>  
> -    // write the utf8_to_external tables
> -    for (utf8_offs_it = utf8_offs_it = utf8_offs_.begin(); 
> -         utf8_offs_it != utf8_offs_.end(); utf8_offs_it++) {
> -        for (unsigned int c = 0; c <= UCHAR_MAX; c++) {
> -            out.write ((const char*)&utf8_offs_it->second.off[c],
> -                       sizeof (utf8_offs_it->second.off[c]));
> +            if (!(off & 0x80000000))
> +                off += mb_offset;
> +
> +            out.write ((const char*)&off, sizeof off);
>          }
> +
> +        delete it->second->off;
  ... and here.


Farid.

Mime
View raw message