r38836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38835‎ | r38836 | r38837 >
Date:03:57, 8 August 2008
Author:river
Status:old
Tags:
Comment:
- use ICU u_isalnum instead of std::isalnum, which doesn't work with Unicode
Modified paths:
  • /trunk/extensions/AbuseFilter/parser_native/affunctions.cpp (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/parser_native/affunctions.cpp
@@ -1,14 +1,15 @@
2 -#include "affunctions.h"
3 -#include <algorithm>
4 -#include <fstream>
5 -#include <sstream>
6 -#include <ios>
7 -#include <iostream>
8 -#include <ctype.h>
 2+#include <algorithm>
 3+#include <fstream>
 4+#include <sstream>
 5+#include <ios>
 6+#include <iostream>
97
10 -#include "utf8.h"
11 -#include "equiv.h"
 8+#include "utf8.h"
 9+#include "equiv.h"
 10+#include "affunctions.h"
1211
 12+#include <unicode/uchar.h>
 13+
1314 namespace afp {
1415
1516 datum
@@ -60,7 +61,7 @@
6162 for (; it != end; ++it) {
6263 int chr = equivs.get(*it);
6364
64 - if (chr != lastchr && isalnum(chr))
 65+ if (chr != lastchr && u_isalnum(chr))
6566 result.append(utf8::codepoint_to_utf8(chr));
6667
6768 lastchr = chr;
@@ -97,7 +98,7 @@
9899 utf8::utf8_iterator<std::string::const_iterator> it(orig.begin(), orig.end()), end;
99100 for (; it != end; ++it) {
100101 len++;
101 - if (!isalnum(*it))
 102+ if (!u_isalnum(*it))
102103 specialcount++;
103104 }
104105
@@ -121,7 +122,7 @@
122123
123124 utf8::utf8_iterator<std::string::const_iterator> it(orig.begin(), orig.end()), end;
124125 for (; it != end; ++it) {
125 - if (isalnum(*it))
 126+ if (u_isalnum(*it))
126127 result.append(utf8::codepoint_to_utf8(*it));
127128 }
128129

Status & tagging log