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

Side by Side Diff: xfa/fgas/font/fgas_stdfontmgr.cpp

Issue 2419433004: Clean up fx_basic_util a little (Closed)
Patch Set: Another method deletion Created 4 years, 2 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
« core/fxcrt/fx_stream.h ('K') | « core/fxge/ge/cfx_folderfontinfo.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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 "xfa/fgas/font/fgas_stdfontmgr.h" 7 #include "xfa/fgas/font/fgas_stdfontmgr.h"
8 8
9 #include "core/fxcrt/fx_stream.h" 9 #include "core/fxcrt/fx_stream.h"
10 #include "core/fxge/cfx_fontmapper.h" 10 #include "core/fxge/cfx_fontmapper.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 CFX_FontDescriptor::~CFX_FontDescriptor() {} 479 CFX_FontDescriptor::~CFX_FontDescriptor() {}
480 480
481 CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { 481 CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() {
482 for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i) 482 for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i)
483 m_FolderPaths.Add(g_FontFolders[i]); 483 m_FolderPaths.Add(g_FontFolders[i]);
484 } 484 }
485 485
486 CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} 486 CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {}
487 487
488 CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { 488 CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
489 Restart:
490 void* pCurHandle = 489 void* pCurHandle =
491 m_FolderQueue.GetSize() != 0 490 m_FolderQueue.GetSize() != 0
492 ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle 491 ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle
493 : nullptr; 492 : nullptr;
494 if (!pCurHandle) { 493 if (!pCurHandle) {
495 if (m_FolderPaths.GetSize() < 1) { 494 if (m_FolderPaths.GetSize() < 1)
496 return ""; 495 return "";
497 }
498 pCurHandle = 496 pCurHandle =
499 FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str()); 497 FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str());
500 FX_HandleParentPath hpp; 498 FX_HandleParentPath hpp;
501 hpp.pFileHandle = pCurHandle; 499 hpp.pFileHandle = pCurHandle;
502 hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1]; 500 hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1];
503 m_FolderQueue.Add(hpp); 501 m_FolderQueue.Add(hpp);
504 } 502 }
505 CFX_ByteString bsName; 503 CFX_ByteString bsName;
506 FX_BOOL bFolder; 504 bool bFolder;
507 CFX_ByteString bsFolderSpearator = 505 CFX_ByteString bsFolderSpearator =
508 CFX_ByteString::FromUnicode(CFX_WideString(FX_GetFolderSeparator())); 506 CFX_ByteString::FromUnicode(CFX_WideString(FX_GetFolderSeparator()));
509 while (TRUE) { 507 while (true) {
510 if (!FX_GetNextFile(pCurHandle, bsName, bFolder)) { 508 if (!FX_GetNextFile(pCurHandle, bsName, bFolder)) {
511 FX_CloseFolder(pCurHandle); 509 FX_CloseFolder(pCurHandle);
512 m_FolderQueue.RemoveAt(m_FolderQueue.GetSize() - 1); 510 m_FolderQueue.RemoveAt(m_FolderQueue.GetSize() - 1);
513 if (m_FolderQueue.GetSize() == 0) { 511 if (m_FolderQueue.GetSize() == 0) {
514 m_FolderPaths.RemoveAt(m_FolderPaths.GetSize() - 1); 512 m_FolderPaths.RemoveAt(m_FolderPaths.GetSize() - 1);
515 if (m_FolderPaths.GetSize() == 0) { 513 if (m_FolderPaths.GetSize() == 0)
516 return ""; 514 return "";
517 } else { 515 else
518 goto Restart; 516 return GetNextFile();
dsinclair 2016/10/12 20:43:23 return m_FolderPaths.GetSize() != 0 ? GetNextFile(
npm 2016/10/12 22:13:19 Done.
519 }
520 } 517 }
521 pCurHandle = 518 pCurHandle =
522 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle; 519 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle;
523 continue; 520 continue;
524 } 521 }
525 if (bsName == "." || bsName == "..") { 522 if (bsName == "." || bsName == "..")
526 continue; 523 continue;
527 }
528 if (bFolder) { 524 if (bFolder) {
529 FX_HandleParentPath hpp; 525 FX_HandleParentPath hpp;
530 hpp.bsParentPath = 526 hpp.bsParentPath =
531 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + 527 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
532 bsFolderSpearator + bsName; 528 bsFolderSpearator + bsName;
533 hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); 529 hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
534 if (!hpp.pFileHandle) { 530 if (!hpp.pFileHandle)
535 continue; 531 continue;
536 }
537 m_FolderQueue.Add(hpp); 532 m_FolderQueue.Add(hpp);
538 pCurHandle = hpp.pFileHandle; 533 pCurHandle = hpp.pFileHandle;
539 continue; 534 continue;
540 } 535 }
541 bsName = 536 bsName =
542 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + 537 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
543 bsFolderSpearator + bsName; 538 bsFolderSpearator + bsName;
544 break; 539 break;
545 } 540 }
546 return bsName; 541 return bsName;
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 1377
1383 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, 1378 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1,
1384 const CFX_WideString& Name2) { 1379 const CFX_WideString& Name2) {
1385 if (Name1.Find(Name2.c_str()) != -1) { 1380 if (Name1.Find(Name2.c_str()) != -1) {
1386 return 1; 1381 return 1;
1387 } 1382 }
1388 return 0; 1383 return 0;
1389 } 1384 }
1390 1385
1391 #endif 1386 #endif
OLDNEW
« core/fxcrt/fx_stream.h ('K') | « core/fxge/ge/cfx_folderfontinfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698