| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "encodings/compact_lang_det/win/cld_htmlutils.h" | 5 #include "encodings/compact_lang_det/win/cld_htmlutils.h" |
| 6 | 6 |
| 7 // Src points to '&' | 7 // Src points to '&' |
| 8 // Writes entity value to dst. Returns take(src), put(dst) byte counts | 8 // Writes entity value to dst. Returns take(src), put(dst) byte counts |
| 9 void EntityToBuffer(const char* src, int len, char* dst, | 9 void EntityToBuffer(const char* src, int len, char* dst, |
| 10 int* tlen, int* plen) { | 10 int* tlen, int* plen) { |
| 11 // On Windows we do not have to do anything, browser expands HTML entities | 11 // On Windows we do not have to do anything, browser expands HTML entities |
| 12 // for us, so text we're retrieving from it is ready for translation as it is. | 12 // for us, so text we're retrieving from it is ready for translation as it is. |
| 13 // But: | 13 // But: |
| 14 | 14 |
| 15 // This is a temporary solution to let us continue the development without | 15 // This is a temporary solution to let us continue the development without |
| 16 // having a real DOM text scraping in place. For now the full HTML is fed | 16 // having a real DOM text scraping in place. For now the full HTML is fed |
| 17 // to CLD for language detection and just ignoring entities is good enough | 17 // to CLD for language detection and just ignoring entities is good enough |
| 18 // for testing. Later entities will be expanded by browser itself. | 18 // for testing. Later entities will be expanded by browser itself. |
| 19 | 19 |
| 20 // Skip entity in the source. | 20 // Skip entity in the source. |
| 21 *tlen = 1; | 21 *tlen = 1; |
| 22 do { | 22 do { |
| 23 ++src; | 23 ++src; |
| 24 ++*tlen; | 24 ++*tlen; |
| 25 } while (*src && *src != ';'); | 25 } while (*src && *src != ';'); |
| 26 // Report a bogus entity (space). | 26 // Report a bogus entity (space). |
| 27 *dst = ' '; | 27 *dst = ' '; |
| 28 *plen = 1; | 28 *plen = 1; |
| 29 } | 29 } |
| OLD | NEW |