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

Side by Side Diff: core/fxcrt/fx_arabic.cpp

Issue 1882043004: Remove implicit cast from CFX_WideString to (const wchar_t*) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: win error #2 Created 4 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 unified diff | Download patch
« no previous file with comments | « core/fxcrt/extension.h ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcrt/include/fx_arabic.h" 7 #include "core/fxcrt/include/fx_arabic.h"
8 #include "core/fxcrt/include/fx_ucd.h" 8 #include "core/fxcrt/include/fx_ucd.h"
9 9
10 namespace { 10 namespace {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 eType = FX_CHARTYPE_Unknown; 214 eType = FX_CHARTYPE_Unknown;
215 } 215 }
216 return pFT; 216 return pFT;
217 } 217 }
218 void FX_BidiReverseString(CFX_WideString& wsText, 218 void FX_BidiReverseString(CFX_WideString& wsText,
219 int32_t iStart, 219 int32_t iStart,
220 int32_t iCount) { 220 int32_t iCount) {
221 FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); 221 FXSYS_assert(iStart > -1 && iStart < wsText.GetLength());
222 FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); 222 FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength());
223 FX_WCHAR wch; 223 FX_WCHAR wch;
224 FX_WCHAR* pStart = (FX_WCHAR*)(const FX_WCHAR*)wsText; 224 FX_WCHAR* pStart = const_cast<FX_WCHAR*>(wsText.c_str());
225 pStart += iStart; 225 pStart += iStart;
226 FX_WCHAR* pEnd = pStart + iCount - 1; 226 FX_WCHAR* pEnd = pStart + iCount - 1;
227 while (pStart < pEnd) { 227 while (pStart < pEnd) {
228 wch = *pStart; 228 wch = *pStart;
229 *pStart++ = *pEnd; 229 *pStart++ = *pEnd;
230 *pEnd-- = wch; 230 *pEnd-- = wch;
231 } 231 }
232 } 232 }
233 void FX_BidiSetDeferredRun(CFX_Int32Array& values, 233 void FX_BidiSetDeferredRun(CFX_Int32Array& values,
234 int32_t iStart, 234 int32_t iStart,
(...skipping 10 matching lines...) Expand all
245 FX_BIDICLASS_EN, FX_BIDICLASS_AL, FX_BIDICLASS_NSM, FX_BIDICLASS_CS, 245 FX_BIDICLASS_EN, FX_BIDICLASS_AL, FX_BIDICLASS_NSM, FX_BIDICLASS_CS,
246 FX_BIDICLASS_ES, FX_BIDICLASS_ET, FX_BIDICLASS_BN, FX_BIDICLASS_BN, 246 FX_BIDICLASS_ES, FX_BIDICLASS_ET, FX_BIDICLASS_BN, FX_BIDICLASS_BN,
247 FX_BIDICLASS_N, FX_BIDICLASS_B, FX_BIDICLASS_RLO, FX_BIDICLASS_RLE, 247 FX_BIDICLASS_N, FX_BIDICLASS_B, FX_BIDICLASS_RLO, FX_BIDICLASS_RLE,
248 FX_BIDICLASS_LRO, FX_BIDICLASS_LRE, FX_BIDICLASS_PDF, FX_BIDICLASS_ON, 248 FX_BIDICLASS_LRO, FX_BIDICLASS_LRE, FX_BIDICLASS_PDF, FX_BIDICLASS_ON,
249 }; 249 };
250 void FX_BidiClassify(const CFX_WideString& wsText, 250 void FX_BidiClassify(const CFX_WideString& wsText,
251 CFX_Int32Array& classes, 251 CFX_Int32Array& classes,
252 FX_BOOL bWS) { 252 FX_BOOL bWS) {
253 FXSYS_assert(wsText.GetLength() == classes.GetSize()); 253 FXSYS_assert(wsText.GetLength() == classes.GetSize());
254 int32_t iCount = wsText.GetLength(); 254 int32_t iCount = wsText.GetLength();
255 const FX_WCHAR* pwsStart = (const FX_WCHAR*)wsText; 255 const FX_WCHAR* pwsStart = wsText.c_str();
256 FX_WCHAR wch; 256 FX_WCHAR wch;
257 int32_t iCls; 257 int32_t iCls;
258 if (bWS) { 258 if (bWS) {
259 for (int32_t i = 0; i < iCount; i++) { 259 for (int32_t i = 0; i < iCount; i++) {
260 wch = *pwsStart++; 260 wch = *pwsStart++;
261 iCls = 261 iCls =
262 ((kTextLayoutCodeProperties[(uint16_t)wch] & FX_BIDICLASSBITSMASK) >> 262 ((kTextLayoutCodeProperties[(uint16_t)wch] & FX_BIDICLASSBITSMASK) >>
263 FX_BIDICLASSBITS); 263 FX_BIDICLASSBITS);
264 classes.SetAt(i, iCls); 264 classes.SetAt(i, iCls);
265 } 265 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 958 }
959 }; 959 };
960 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { 960 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) {
961 CFX_BidiLineTemplate<CFX_TxtChar> blt; 961 CFX_BidiLineTemplate<CFX_TxtChar> blt;
962 blt.FX_BidiLine(chars, iCount, iBaseLevel); 962 blt.FX_BidiLine(chars, iCount, iBaseLevel);
963 } 963 }
964 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { 964 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) {
965 CFX_BidiLineTemplate<CFX_RTFChar> blt; 965 CFX_BidiLineTemplate<CFX_RTFChar> blt;
966 blt.FX_BidiLine(chars, iCount, iBaseLevel); 966 blt.FX_BidiLine(chars, iCount, iBaseLevel);
967 } 967 }
OLDNEW
« no previous file with comments | « core/fxcrt/extension.h ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698