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. 4 5// Author: alekseys@google.com (Aleksey Shlyapnikov) 6 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. 9 10#include "cld/encodings/compact_lang_det/win/cld_htmlutils.h" 11 12#include "cld/third_party/utf/utf.h" // for runetochar 13#include "cld/webutil/html/htmlutils.h" // for ReadEntity 14 15// Copied from getonescriptspan.cc 16 17// Src points to '&' 18// Writes entity value to dst. Returns take(src), put(dst) byte counts 19void 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); 23 24 if (entval > 0) { 25 *plen = runetochar(dst, &entval); 26 } else { 27 // Illegal entity; ignore the '&' 28 *tlen = 1; 29 *plen = 0; 30 } 31 // fprintf(stderr,"t%d p%d]\n", *tlen, *plen); 32} 33