Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: third_party/libphonenumber/cpp/src/utf/unilib.cc

Issue 6920006: Revert 84000 - Autofill phone number enhancements and integration of Phone Number Util Library: p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libphonenumber/cpp/src/utf/unilib.h ('k') | third_party/libphonenumber/cpp/src/utf/utf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libphonenumber/cpp/src/utf/unilib.cc
===================================================================
--- third_party/libphonenumber/cpp/src/utf/unilib.cc (revision 84008)
+++ third_party/libphonenumber/cpp/src/utf/unilib.cc (working copy)
@@ -1,64 +0,0 @@
-/**
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Author: Shawn Ligocki
-
-#include "utf/unilib.h"
-
-#include "base/basictypes.h"
-#include "utf/utf.h"
-
-namespace UniLib {
-
-namespace {
-
-// MOE: start_strip
-// MOE: end_strip
-// Codepoints not allowed for interchange are:
-// C0 (ASCII) controls: U+0000 to U+001F excluding Space (SP, U+0020),
-// Horizontal Tab (HT, U+0009), Line-Feed (LF, U+000A),
-// Form Feed (FF, U+000C) and Carriage-Return (CR, U+000D)
-// C1 controls: U+007F to U+009F
-// Surrogates: U+D800 to U+DFFF
-// Non-characters: U+FDD0 to U+FDEF and U+xxFFFE to U+xxFFFF for all xx
-inline bool IsInterchangeValidCodepoint(char32 c) {
- return !((c >= 0x00 && c <= 0x08) || c == 0x0B || (c >= 0x0E && c <= 0x1F) ||
- (c >= 0x7F && c <= 0x9F) ||
- (c >= 0xD800 && c <= 0xDFFF) ||
- (c >= 0xFDD0 && c <= 0xFDEF) || (c&0xFFFE) == 0xFFFE);
-}
-
-} // namespace
-
-int SpanInterchangeValid(const char* begin, int byte_length) {
- char32 rune;
- const char* p = begin;
- const char* end = begin + byte_length;
- while (p < end) {
- int bytes_consumed = charntorune(&rune, p, end - p);
- // We want to accept Runeerror == U+FFFD as a valid char, but it is used
- // by chartorune to indicate error. Luckily, the real codepoint is size 3
- // while errors return bytes_consumed == 1.
- if ((rune == Runeerror && bytes_consumed == 1) ||
- !IsInterchangeValidCodepoint(rune)) {
- break; // Found
- }
- p += bytes_consumed;
- }
- return p - begin;
-}
-
-} // namespace UniLib
« no previous file with comments | « third_party/libphonenumber/cpp/src/utf/unilib.h ('k') | third_party/libphonenumber/cpp/src/utf/utf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698