Farid Zaripov wrote:
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, September 22, 2006 3:42 AM
To: [email protected]
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