Mailing list archives: July 2005

Site index · List index
Message listThread · Author · Date
[No Subject]
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
va...@yahoo.ca>   [No Subject] Tue, 22 Feb, 04:55
<bur...@aci.on.ca>   [No Subject] Mon, 23 May, 11:36
&gt;+ if ( buf ) &lt;/span&gt;&lt;span class="cx"&gt; { *buf++ = ((char*)psz)[1]; *buf++ = ((char*)psz)[0]; } &lt;/span&gt;&lt;span class="rem"&gt;- len += sizeof(wxUint16); &lt;/span&gt;&lt;span class="add"&gt;+ len += 2; &lt;/span&gt;&lt;span class="cx"&gt; psz++; } &lt;/span&gt;&lt;span class="rem"&gt;- if (buf &amp;amp;&amp;amp; len&amp;lt;=n-sizeof(wxUint16)) *(wxUint16*)buf=0; &lt;/span&gt;&lt;span class="cx"&gt; &lt;/span&gt;&lt;span class="add"&gt;+ if ( buf &amp;amp;&amp;amp; len &amp;lt; n ) + *buf = '\0'; + &lt;/span&gt;&lt;span class="cx"&gt; return len; } &lt;/span&gt;&lt;span class="lines"&gt;@@ -1336,6 +1352,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; #endif private: &lt;/span&gt;&lt;span class="add"&gt;+ virtual const char *GetMBNul(size_t *nulLen) const; + &lt;/span&gt;&lt;span class="cx"&gt; // the name (for iconv_open()) of a wide char charset -- if none is // available on this machine, it will remain NULL static wxString ms_wcCharsetName; &lt;/span&gt;&lt;span class="lines"&gt;@@ -1343,6 +1361,10 @@ &lt;/span&gt;&lt;span class="cx"&gt; // true if the wide char encoding we use (i.e. ms_wcCharsetName) has // different endian-ness than the native one static bool ms_wcNeedsSwap; &lt;/span&gt;&lt;span class="add"&gt;+ + // NUL representation + size_t m_nulLen; + char m_nulBuf[8]; &lt;/span&gt;&lt;span class="cx"&gt; }; // make the constructor available for unit testing &lt;/span&gt;&lt;span class="lines"&gt;@@ -1362,6 +1384,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_iconv::wxMBConv_iconv(const wxChar *name) { &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; + &lt;/span&gt;&lt;span class="cx"&gt; // iconv operates with chars, not wxChars, but luckily it uses only ASCII // names for the charsets const wxCharBuffer cname(wxString(name).ToAscii()); &lt;/span&gt;&lt;span class="lines"&gt;@@ -1618,6 +1642,36 @@ &lt;/span&gt;&lt;span class="cx"&gt; return res; } &lt;/span&gt;&lt;span class="add"&gt;+const char *wxMBConv_iconv::GetMBNul(size_t *nulLen) const +{ + if ( m_nulLen == (size_t)-2 ) + { + wxMBConv_iconv * const self = wxConstCast(this, wxMBConv_iconv); + +#if wxUSE_THREADS + // NB: explained in MB2WC + wxMutexLocker lock(self-&amp;gt;m_iconvMutex); +#endif + + wchar_t *wnul = L&amp;quot;&amp;quot;; + size_t inLen = sizeof(wchar_t), + outLen = WXSIZEOF(m_nulBuf); + const char *in = (char *)wnul; + char *out = self-&amp;gt;m_nulBuf; + if ( iconv(w2m, &amp;amp;in, &amp;amp;inLen, &amp;amp;out, &amp;amp;outLen) == (size_t)-1 ) + { + self-&amp;gt;m_nulLen = (size_t)-1; + } + else // ok + { + self-&amp;gt;m_nulLen = out - m_nulBuf; + } + } + + *nulLen = m_nulLen; + return m_nulBuf; +} + &lt;/span&gt;&lt;span class="cx"&gt; #endif // HAVE_ICONV &lt;/span&gt;&lt;span class="lines"&gt;@@ -1639,19 +1693,22 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_win32() { m_CodePage = CP_ACP; &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; &lt;/span&gt;&lt;span class="cx"&gt; } #if wxUSE_FONTMAP wxMBConv_win32(const wxChar* name) { m_CodePage = wxCharsetToCodepage(name); &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)- we can compute the input size if we were not given it: notice that + // in this case the string must be properly NUL-terminated, of course, as + // otherwise we have no way of knowing how long it is + if ( inLen == (size_t)-1 ) &lt;/span&gt;&lt;span class="cx"&gt; { &lt;/span&gt;&lt;span class="rem"&gt;- wxASSERT(szPos &amp;lt; szEnd); //something is _really_ screwed up if this rings true &lt;/span&gt;&lt;span class="add"&gt;+ // not the most efficient algorithm but it shouldn't matter as normally + // there are not many NULs in the string and so normally memcmp() + // should stop on the first character + const char *p = in; + while ( memcmp(p, nul, nulLen) != 0 ) + p++; &lt;/span&gt;&lt;spate(); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ wxString srcMid = m_WParser-&amp;amp;gt;GetInnerSource(tag); + ParseInnerSource(HtmlizeWhitespaces(srcMid)); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; m_WParser-&amp;amp;gt;CloseContainer(); m_WParser-&amp;amp;gt;CloseContainer(); &amp;lt;/span&amp;gt; &amp;lt;/pre&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;
va...@yahoo.ca>   &gt;+ if ( buf ) &lt;/span&gt;&lt;span class="cx"&gt; { *buf++ = ((char*)psz)[1]; *buf++ = ((char*)psz)[0]; } &lt;/span&gt;&lt;span class="rem"&gt;- len += sizeof(wxUint16); &lt;/span&gt;&lt;span class="add"&gt;+ len += 2; &lt;/span&gt;&lt;span class="cx"&gt; psz++; } &lt;/span&gt;&lt;span class="rem"&gt;- if (buf &amp;amp;&amp;amp; len&amp;lt;=n-sizeof(wxUint16)) *(wxUint16*)buf=0; &lt;/span&gt;&lt;span class="cx"&gt; &lt;/span&gt;&lt;span class="add"&gt;+ if ( buf &amp;amp;&amp;amp; len &amp;lt; n ) + *buf = '\0'; + &lt;/span&gt;&lt;span class="cx"&gt; return len; } &lt;/span&gt;&lt;span class="lines"&gt;@@ -1336,6 +1352,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; #endif private: &lt;/span&gt;&lt;span class="add"&gt;+ virtual const char *GetMBNul(size_t *nulLen) const; + &lt;/span&gt;&lt;span class="cx"&gt; // the name (for iconv_open()) of a wide char charset -- if none is // available on this machine, it will remain NULL static wxString ms_wcCharsetName; &lt;/span&gt;&lt;span class="lines"&gt;@@ -1343,6 +1361,10 @@ &lt;/span&gt;&lt;span class="cx"&gt; // true if the wide char encoding we use (i.e. ms_wcCharsetName) has // different endian-ness than the native one static bool ms_wcNeedsSwap; &lt;/span&gt;&lt;span class="add"&gt;+ + // NUL representation + size_t m_nulLen; + char m_nulBuf[8]; &lt;/span&gt;&lt;span class="cx"&gt; }; // make the constructor available for unit testing &lt;/span&gt;&lt;span class="lines"&gt;@@ -1362,6 +1384,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_iconv::wxMBConv_iconv(const wxChar *name) { &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; + &lt;/span&gt;&lt;span class="cx"&gt; // iconv operates with chars, not wxChars, but luckily it uses only ASCII // names for the charsets const wxCharBuffer cname(wxString(name).ToAscii()); &lt;/span&gt;&lt;span class="lines"&gt;@@ -1618,6 +1642,36 @@ &lt;/span&gt;&lt;span class="cx"&gt; return res; } &lt;/span&gt;&lt;span class="add"&gt;+const char *wxMBConv_iconv::GetMBNul(size_t *nulLen) const +{ + if ( m_nulLen == (size_t)-2 ) + { + wxMBConv_iconv * const self = wxConstCast(this, wxMBConv_iconv); + +#if wxUSE_THREADS + // NB: explained in MB2WC + wxMutexLocker lock(self-&amp;gt;m_iconvMutex); +#endif + + wchar_t *wnul = L&amp;quot;&amp;quot;; + size_t inLen = sizeof(wchar_t), + outLen = WXSIZEOF(m_nulBuf); + const char *in = (char *)wnul; + char *out = self-&amp;gt;m_nulBuf; + if ( iconv(w2m, &amp;amp;in, &amp;amp;inLen, &amp;amp;out, &amp;amp;outLen) == (size_t)-1 ) + { + self-&amp;gt;m_nulLen = (size_t)-1; + } + else // ok + { + self-&amp;gt;m_nulLen = out - m_nulBuf; + } + } + + *nulLen = m_nulLen; + return m_nulBuf; +} + &lt;/span&gt;&lt;span class="cx"&gt; #endif // HAVE_ICONV &lt;/span&gt;&lt;span class="lines"&gt;@@ -1639,19 +1693,22 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_win32() { m_CodePage = CP_ACP; &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; &lt;/span&gt;&lt;span class="cx"&gt; } #if wxUSE_FONTMAP wxMBConv_win32(const wxChar* name) { m_CodePage = wxCharsetToCodepage(name); &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)- we can compute the input size if we were not given it: notice that + // in this case the string must be properly NUL-terminated, of course, as + // otherwise we have no way of knowing how long it is + if ( inLen == (size_t)-1 ) &lt;/span&gt;&lt;span class="cx"&gt; { &lt;/span&gt;&lt;span class="rem"&gt;- wxASSERT(szPos &amp;lt; szEnd); //something is _really_ screwed up if this rings true &lt;/span&gt;&lt;span class="add"&gt;+ // not the most efficient algorithm but it shouldn't matter as normally + // there are not many NULs in the string and so normally memcmp() + // should stop on the first character + const char *p = in; + while ( memcmp(p, nul, nulLen) != 0 ) + p++; &lt;/span&gt;&lt;spate(); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ wxString srcMid = m_WParser-&amp;amp;gt;GetInnerSource(tag); + ParseInnerSource(HtmlizeWhitespaces(srcMid)); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; m_WParser-&amp;amp;gt;CloseContainer(); m_WParser-&amp;amp;gt;CloseContainer(); &amp;lt;/span&amp;gt; &amp;lt;/pre&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt; Tue, 22 Feb, 04:55
va...@yahoo.ca>   &gt;+ if ( buf ) &lt;/span&gt;&lt;span class="cx"&gt; { *buf++ = ((char*)psz)[1]; *buf++ = ((char*)psz)[0]; } &lt;/span&gt;&lt;span class="rem"&gt;- len += sizeof(wxUint16); &lt;/span&gt;&lt;span class="add"&gt;+ len += 2; &lt;/span&gt;&lt;span class="cx"&gt; psz++; } &lt;/span&gt;&lt;span class="rem"&gt;- if (buf &amp;amp;&amp;amp; len&amp;lt;=n-sizeof(wxUint16)) *(wxUint16*)buf=0; &lt;/span&gt;&lt;span class="cx"&gt; &lt;/span&gt;&lt;span class="add"&gt;+ if ( buf &amp;amp;&amp;amp; len &amp;lt; n ) + *buf = '\0'; + &lt;/span&gt;&lt;span class="cx"&gt; return len; } &lt;/span&gt;&lt;span class="lines"&gt;@@ -1336,6 +1352,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; #endif private: &lt;/span&gt;&lt;span class="add"&gt;+ virtual const char *GetMBNul(size_t *nulLen) const; + &lt;/span&gt;&lt;span class="cx"&gt; // the name (for iconv_open()) of a wide char charset -- if none is // available on this machine, it will remain NULL static wxString ms_wcCharsetName; &lt;/span&gt;&lt;span class="lines"&gt;@@ -1343,6 +1361,10 @@ &lt;/span&gt;&lt;span class="cx"&gt; // true if the wide char encoding we use (i.e. ms_wcCharsetName) has // different endian-ness than the native one static bool ms_wcNeedsSwap; &lt;/span&gt;&lt;span class="add"&gt;+ + // NUL representation + size_t m_nulLen; + char m_nulBuf[8]; &lt;/span&gt;&lt;span class="cx"&gt; }; // make the constructor available for unit testing &lt;/span&gt;&lt;span class="lines"&gt;@@ -1362,6 +1384,8 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_iconv::wxMBConv_iconv(const wxChar *name) { &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; + &lt;/span&gt;&lt;span class="cx"&gt; // iconv operates with chars, not wxChars, but luckily it uses only ASCII // names for the charsets const wxCharBuffer cname(wxString(name).ToAscii()); &lt;/span&gt;&lt;span class="lines"&gt;@@ -1618,6 +1642,36 @@ &lt;/span&gt;&lt;span class="cx"&gt; return res; } &lt;/span&gt;&lt;span class="add"&gt;+const char *wxMBConv_iconv::GetMBNul(size_t *nulLen) const +{ + if ( m_nulLen == (size_t)-2 ) + { + wxMBConv_iconv * const self = wxConstCast(this, wxMBConv_iconv); + +#if wxUSE_THREADS + // NB: explained in MB2WC + wxMutexLocker lock(self-&amp;gt;m_iconvMutex); +#endif + + wchar_t *wnul = L&amp;quot;&amp;quot;; + size_t inLen = sizeof(wchar_t), + outLen = WXSIZEOF(m_nulBuf); + const char *in = (char *)wnul; + char *out = self-&amp;gt;m_nulBuf; + if ( iconv(w2m, &amp;amp;in, &amp;amp;inLen, &amp;amp;out, &amp;amp;outLen) == (size_t)-1 ) + { + self-&amp;gt;m_nulLen = (size_t)-1; + } + else // ok + { + self-&amp;gt;m_nulLen = out - m_nulBuf; + } + } + + *nulLen = m_nulLen; + return m_nulBuf; +} + &lt;/span&gt;&lt;span class="cx"&gt; #endif // HAVE_ICONV &lt;/span&gt;&lt;span class="lines"&gt;@@ -1639,19 +1693,22 @@ &lt;/span&gt;&lt;span class="cx"&gt; wxMBConv_win32() { m_CodePage = CP_ACP; &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)-2; &lt;/span&gt;&lt;span class="cx"&gt; } #if wxUSE_FONTMAP wxMBConv_win32(const wxChar* name) { m_CodePage = wxCharsetToCodepage(name); &lt;/span&gt;&lt;span class="add"&gt;+ m_nulLen = (size_t)- we can compute the input size if we were not given it: notice that + // in this case the string must be properly NUL-terminated, of course, as + // otherwise we have no way of knowing how long it is + if ( inLen == (size_t)-1 ) &lt;/span&gt;&lt;span class="cx"&gt; { &lt;/span&gt;&lt;span class="rem"&gt;- wxASSERT(szPos &amp;lt; szEnd); //something is _really_ screwed up if this rings true &lt;/span&gt;&lt;span class="add"&gt;+ // not the most efficient algorithm but it shouldn't matter as normally + // there are not many NULs in the string and so normally memcmp() + // should stop on the first character + const char *p = in; + while ( memcmp(p, nul, nulLen) != 0 ) + p++; &lt;/span&gt;&lt;spate(); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ wxString srcMid = m_WParser-&amp;amp;gt;GetInnerSource(tag); + ParseInnerSource(HtmlizeWhitespaces(srcMid)); &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; m_WParser-&amp;amp;gt;CloseContainer(); m_WParser-&amp;amp;gt;CloseContainer(); &amp;lt;/span&amp;gt; &amp;lt;/pre&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt; Tue, 22 Feb, 04:55
m.@osafoundation.org>  Mon, 03 May, 09:42
Message listThread · Author · Date
Box list
Jan 200827
Dec 2007224
Nov 2007217
Oct 2007105
Sep 200793
Aug 200727
Jul 2007105
Jun 2007108
May 2007292
Apr 2007276
Mar 2007275
Feb 2007303
Jan 2007183
Dec 2006232
Nov 2006183
Oct 200697
Sep 2006163
Aug 2006162
Jul 2006265
Jun 2006136
May 2006105
Apr 2006208
Mar 2006229
Feb 2006230
Jan 2006260
Dec 2005128
Nov 2005246
Oct 2005123
Sep 200572
Aug 200524
Jul 200517
Jun 20054
May 200520
Apr 20059
Mar 200519
Feb 200514
Jan 200548
Dec 200448
Nov 200410
Oct 20043
Aug 200411
Jul 20045
Jun 200412
May 20041
Apr 200421
Mar 200419
Feb 20047
Jan 200463
Dec 200344
Nov 200335
Oct 200343
Sep 200338
Aug 200354
Jul 200314
Jun 200360
May 2003125
Apr 2003117
Mar 2003166
Feb 2003220
Jan 2003408
Dec 2002297
Nov 2002728
Oct 2002479