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

Unified Diff: core/fpdfapi/parser/cpdf_stream.h

Issue 2420743002: Make CPDF_Image() constructors saner. (Closed)
Patch Set: Fix leak 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 side-by-side diff with in-line comments
Download patch
« core/fpdfapi/parser/cpdf_dictionary.h ('K') | « core/fpdfapi/parser/cpdf_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_stream.h
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 575a9ebe0b2ac40c58e2a06a44bbe1f7a3dab185..756eccfba1cfbb0d8253604b2cbdbefc184b6eb5 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -58,7 +58,7 @@ class CPDF_Stream : public CPDF_Object {
IFX_FileRead* m_pFile = nullptr;
};
-using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Stream>>;
+using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>;
inline CPDF_Stream* ToStream(CPDF_Object* obj) {
return obj ? obj->AsStream() : nullptr;
@@ -68,4 +68,12 @@ inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
return obj ? obj->AsStream() : nullptr;
}
+inline UniqueStream ToStream(UniqueObject obj) {
+ CPDF_Stream* pStream = ToStream(obj.get());
+ if (!pStream)
+ return nullptr;
+ obj.release();
+ return UniqueStream(pStream);
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
« core/fpdfapi/parser/cpdf_dictionary.h ('K') | « core/fpdfapi/parser/cpdf_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698