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

Side by Side Diff: xfa/fde/css/fde_cssdatatable.cpp

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 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 | « xfa/fde/css/fde_cssdatatable.h ('k') | xfa/fde/css/fde_cssstyleselector.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 "xfa/fde/css/fde_cssdatatable.h" 7 #include "xfa/fde/css/fde_cssdatatable.h"
8 8
9 #include "core/include/fxcrt/fx_ext.h" 9 #include "core/include/fxcrt/fx_ext.h"
10 #include "xfa/fgas/crt/fgas_algorithm.h" 10 #include "xfa/fgas/crt/fgas_algorithm.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 return NULL; 602 return NULL;
603 } 603 }
604 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByEnum( 604 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByEnum(
605 FDE_CSSPROPERTYVALUE eName) { 605 FDE_CSSPROPERTYVALUE eName) {
606 return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName) 606 return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName)
607 : NULL; 607 : NULL;
608 } 608 }
609 FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(const FX_WCHAR* pszName, 609 FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(const FX_WCHAR* pszName,
610 int32_t iLength) { 610 int32_t iLength) {
611 FXSYS_assert(pszName != NULL && iLength > 0); 611 FXSYS_assert(pszName != NULL && iLength > 0);
612 FX_WORD wHash = (FX_WORD)FX_HashCode_String_GetW(pszName, iLength, TRUE); 612 uint16_t wHash = (uint16_t)FX_HashCode_String_GetW(pszName, iLength, TRUE);
613 int32_t iEnd = 613 int32_t iEnd =
614 sizeof(g_FDE_CSSMediaTypes) / sizeof(FDE_CSSMEDIATYPETABLE) - 1; 614 sizeof(g_FDE_CSSMediaTypes) / sizeof(FDE_CSSMEDIATYPETABLE) - 1;
615 int32_t iMid, iStart = 0; 615 int32_t iMid, iStart = 0;
616 FX_WORD uMid; 616 uint16_t uMid;
617 do { 617 do {
618 iMid = (iStart + iEnd) / 2; 618 iMid = (iStart + iEnd) / 2;
619 uMid = g_FDE_CSSMediaTypes[iMid].wHash; 619 uMid = g_FDE_CSSMediaTypes[iMid].wHash;
620 if (wHash == uMid) { 620 if (wHash == uMid) {
621 return g_FDE_CSSMediaTypes + iMid; 621 return g_FDE_CSSMediaTypes + iMid;
622 } else if (wHash > uMid) { 622 } else if (wHash > uMid) {
623 iStart = iMid + 1; 623 iStart = iMid + 1;
624 } else { 624 } else {
625 iEnd = iMid - 1; 625 iEnd = iMid - 1;
626 } 626 }
627 } while (iStart <= iEnd); 627 } while (iStart <= iEnd);
628 return NULL; 628 return NULL;
629 } 629 }
630 FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(const FX_WCHAR* pszName, 630 FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(const FX_WCHAR* pszName,
631 int32_t iLength) { 631 int32_t iLength) {
632 FXSYS_assert(pszName != NULL && iLength > 0); 632 FXSYS_assert(pszName != NULL && iLength > 0);
633 FX_WORD wHash = (FX_WORD)FX_HashCode_String_GetW(pszName, iLength, TRUE); 633 uint16_t wHash = (uint16_t)FX_HashCode_String_GetW(pszName, iLength, TRUE);
634 int32_t iEnd = 634 int32_t iEnd =
635 sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLENGTHUNITTABLE) - 1; 635 sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLENGTHUNITTABLE) - 1;
636 int32_t iMid, iStart = 0; 636 int32_t iMid, iStart = 0;
637 FX_WORD wMid; 637 uint16_t wMid;
638 do { 638 do {
639 iMid = (iStart + iEnd) / 2; 639 iMid = (iStart + iEnd) / 2;
640 wMid = g_FDE_CSSLengthUnits[iMid].wHash; 640 wMid = g_FDE_CSSLengthUnits[iMid].wHash;
641 if (wHash == wMid) { 641 if (wHash == wMid) {
642 return g_FDE_CSSLengthUnits + iMid; 642 return g_FDE_CSSLengthUnits + iMid;
643 } else if (wHash > wMid) { 643 } else if (wHash > wMid) {
644 iStart = iMid + 1; 644 iStart = iMid + 1;
645 } else { 645 } else {
646 iEnd = iMid - 1; 646 iEnd = iMid - 1;
647 } 647 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 } 880 }
881 while (iBracketCount > 0 && m_pCur < m_pEnd) { 881 while (iBracketCount > 0 && m_pCur < m_pEnd) {
882 if (*m_pCur == ')') { 882 if (*m_pCur == ')') {
883 iBracketCount--; 883 iBracketCount--;
884 } 884 }
885 m_pCur++; 885 m_pCur++;
886 } 886 }
887 } 887 }
888 return m_pCur - pStart; 888 return m_pCur - pStart;
889 } 889 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssdatatable.h ('k') | xfa/fde/css/fde_cssstyleselector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698