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

Side by Side Diff: core/include/fxcrt/fx_basic.h

Issue 1360103002: Get rid of gotos in CPDF_SyntaxParser and FlateUncompress(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 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
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('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 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_
9 9
10 #include "fx_memory.h" 10 #include "fx_memory.h"
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 }; 929 };
930 class IFX_Pause { 930 class IFX_Pause {
931 public: 931 public:
932 virtual ~IFX_Pause() {} 932 virtual ~IFX_Pause() {}
933 virtual FX_BOOL NeedToPauseNow() = 0; 933 virtual FX_BOOL NeedToPauseNow() = 0;
934 }; 934 };
935 935
936 template <typename T> 936 template <typename T>
937 class CFX_AutoRestorer { 937 class CFX_AutoRestorer {
938 public: 938 public:
939 explicit CFX_AutoRestorer(T* location) { 939 explicit CFX_AutoRestorer(T* location)
940 m_Location = location; 940 : m_Location(location), m_OldValue(*location) {}
941 m_OldValue = *location;
942 }
943 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } 941 ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
944 942
945 private: 943 private:
946 T* m_Location; 944 T* const m_Location;
947 T m_OldValue; 945 const T m_OldValue;
948 }; 946 };
949 947
950 struct FxFreeDeleter { 948 struct FxFreeDeleter {
951 inline void operator()(void* ptr) const { FX_Free(ptr); } 949 inline void operator()(void* ptr) const { FX_Free(ptr); }
952 }; 950 };
953 951
954 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. 952 // Used with nonstd::unique_ptr to Release() objects that can't be deleted.
955 template <class T> 953 template <class T>
956 struct ReleaseDeleter { 954 struct ReleaseDeleter {
957 inline void operator()(T* ptr) const { ptr->Release(); } 955 inline void operator()(T* ptr) const { ptr->Release(); }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 FX_FLOAT c; 1149 FX_FLOAT c;
1152 FX_FLOAT d; 1150 FX_FLOAT d;
1153 FX_FLOAT e; 1151 FX_FLOAT e;
1154 FX_FLOAT f; 1152 FX_FLOAT f;
1155 FX_FLOAT g; 1153 FX_FLOAT g;
1156 FX_FLOAT h; 1154 FX_FLOAT h;
1157 FX_FLOAT i; 1155 FX_FLOAT i;
1158 }; 1156 };
1159 1157
1160 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ 1158 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698