incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r448754 [2/6] - /incubator/stdcxx/trunk/util/
Date Fri, 22 Sep 2006 21:21:56 GMT
Farid Zaripov wrote:
>>-----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;".

You're right. Thanks for the heads up and sorry for the breakage!
I should have tested it with more compilers before committing it
(gcc doesn't issue a warning for it and neither does EDG eccp --
I opened http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29185).

Fixed thus: http://svn.apache.org/viewvc?view=rev&rev=449092

> 
>   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

The warning is justified, even though the construct is actually
safe (although only because the value of second->off happens to
be the same as second).

Martin

Mime
View raw message