Revision: 7371
http://mahogany.svn.sourceforge.net/mahogany/?rev=7371&view=rev
Author: vadz
Date: 2007-09-09 11:07:18 -0700 (Sun, 09 Sep 2007)
Log Message:
-----------
use iterators in loops over strings as c_str() may return NULL for arbitrary
data in Unicode build
Modified Paths:
--------------
trunk/M/src/modules/spam/HeadersFilter.cpp
Modified: trunk/M/src/modules/spam/HeadersFilter.cpp
===================================================================
--- trunk/M/src/modules/spam/HeadersFilter.cpp 2007-09-09 18:04:47 UTC (rev
7370)
+++ trunk/M/src/modules/spam/HeadersFilter.cpp 2007-09-09 18:07:18 UTC (rev
7371)
@@ -505,11 +505,9 @@
size_t num8bit = 0,
max8bit = subject.length() / 2;
- for ( const unsigned char *pc = (const unsigned char *)subject.c_str();
- *pc;
- pc++ )
+ for ( String::const_iterator i = subject.begin(); i != subject.end(); ++i )
{
- if ( *pc > 127 || *pc == '?' || *pc == '!' )
+ if ( (unsigned)*i > 127 )
{
if ( num8bit++ == max8bit )
{
@@ -525,17 +523,17 @@
static bool CheckSubjectForCapitals(const String& subject)
{
bool hasSpace = false;
- for ( const unsigned char *pc = (const unsigned char *)subject.c_str();
- *pc;
- pc++ )
+ for ( String::const_iterator i = subject.begin(); i != subject.end(); ++i )
{
- if ( (*pc > 127) || islower(*pc) )
+ const wxUChar ch = *i;
+
+ if ( (ch > 127) || islower(ch) )
{
// not only caps
return false;
}
- if ( isspace(*pc) )
+ if ( isspace(ch) )
{
// remember that we have more than one word
hasSpace = true;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates