Roll src/third_party/WebKit 06cb9e9:a978ee5 (svn 202558:202559)
[chromium-blink-merge.git] / third_party / cld / encodings / compact_lang_det / win / cld_htmlutils_google3.cc
blob44889f9e38eec0eaf044621eaa8e66942ab28c33
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Author: alekseys@google.com (Aleksey Shlyapnikov)
7 // This code is not actually used, it was copied here for the reference only.
8 // See cld_htmlutils_windows.cc for Windows version of this code.
10 #include "cld/encodings/compact_lang_det/win/cld_htmlutils.h"
12 #include "cld/third_party/utf/utf.h" // for runetochar
13 #include "cld/webutil/html/htmlutils.h" // for ReadEntity
15 // Copied from getonescriptspan.cc
17 // Src points to '&'
18 // Writes entity value to dst. Returns take(src), put(dst) byte counts
19 void EntityToBuffer(const char* src, int len, char* dst,
20 int* tlen, int* plen) {
21 char32 entval = HtmlUtils::ReadEntity(src, len, tlen);
22 // ReadEntity does this already: entval = FixUnicodeValue(entval);
24 if (entval > 0) {
25 *plen = runetochar(dst, &entval);
26 } else {
27 // Illegal entity; ignore the '&'
28 *tlen = 1;
29 *plen = 0;
31 // fprintf(stderr,"t%d p%d]\n", *tlen, *plen);