[poppler] poppler/Annot.cc poppler/Array.cc poppler/CairoFontEngine.cc poppler/Catalog.cc poppler/Dict.cc poppler/GlobalParams.cc poppler/GlobalParamsWin.cc poppler/Page.cc poppler/PDFDoc.cc poppler/XRef.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 10 12:05:50 UTC 2022


 poppler/Annot.cc           |    2 +-
 poppler/Array.cc           |    4 ++--
 poppler/CairoFontEngine.cc |    4 ++--
 poppler/Catalog.cc         |    2 +-
 poppler/Dict.cc            |    4 ++--
 poppler/GlobalParams.cc    |   12 ++++++------
 poppler/GlobalParamsWin.cc |    4 ++--
 poppler/PDFDoc.cc          |    2 +-
 poppler/Page.cc            |    4 ++--
 poppler/XRef.cc            |    4 ++--
 10 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 4d145b54616a247a80d8a85c4df98851628cfcfc
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Feb 10 12:52:45 2022 +0100

    Use the "superior" C++17 std::scoped_lock

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index bf7bb3bb..7e595607 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1250,7 +1250,7 @@ double AnnotAppearanceBBox::getPageYMax() const
 // Annot
 //------------------------------------------------------------------------
 
-#define annotLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define annotLocker() const std::scoped_lock locker(mutex)
 
 Annot::Annot(PDFDoc *docA, PDFRectangle *rectA)
 {
diff --git a/poppler/Array.cc b/poppler/Array.cc
index 2f9de6cd..6f32b3c4 100644
--- a/poppler/Array.cc
+++ b/poppler/Array.cc
@@ -16,7 +16,7 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2013, 2017, 2019 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2013, 2017, 2019, 2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2018, 2019 Adam Reichold <adam.reichold at t-online.de>
 //
@@ -36,7 +36,7 @@
 // Array
 //------------------------------------------------------------------------
 
-#define arrayLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define arrayLocker() const std::scoped_lock locker(mutex)
 
 Array::Array(XRef *xrefA)
 {
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 4d98d0f2..976f6622 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -17,7 +17,7 @@
 // Copyright (C) 2005-2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
-// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017-2019, 2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017-2019, 2021, 2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2008, 2009 Chris Wilson <chris at chris-wilson.co.uk>
@@ -712,7 +712,7 @@ bool CairoType3Font::matches(Ref &other, bool printingA)
 // CairoFontEngine
 //------------------------------------------------------------------------
 
-#define fontEngineLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define fontEngineLocker() const std::scoped_lock locker(mutex)
 
 CairoFontEngine::CairoFontEngine(FT_Library libA)
 {
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 0d2c038e..20b7a66d 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -71,7 +71,7 @@
 // Catalog
 //------------------------------------------------------------------------
 
-#define catalogLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define catalogLocker() const std::scoped_lock locker(mutex)
 
 Catalog::Catalog(PDFDoc *docA)
 {
diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 6fc70bc4..b0dc9a79 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -16,7 +16,7 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright (C) 2008, 2010, 2013, 2014, 2017, 2019, 2020 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2013, 2014, 2017, 2019, 2020, 2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha at gmail.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -40,7 +40,7 @@
 // Dict
 //------------------------------------------------------------------------
 
-#define dictLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define dictLocker() const std::scoped_lock locker(mutex)
 
 constexpr int SORT_LENGTH_LOWER_LIMIT = 32;
 
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index e054bc43..916f8375 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -390,9 +390,9 @@ const SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, boo
     return fi;
 }
 
-#define globalParamsLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
-#define unicodeMapCacheLocker() std::unique_lock<std::recursive_mutex> locker(unicodeMapCacheMutex)
-#define cMapCacheLocker() std::unique_lock<std::recursive_mutex> locker(cMapCacheMutex)
+#define globalParamsLocker() const std::scoped_lock locker(mutex)
+#define unicodeMapCacheLocker() const std::scoped_lock locker(unicodeMapCacheMutex)
+#define cMapCacheLocker() const std::scoped_lock locker(cMapCacheMutex)
 
 //------------------------------------------------------------------------
 // parsing
@@ -1258,7 +1258,7 @@ void GlobalParams::setErrQuiet(bool errQuietA)
 
 GlobalParamsIniter::GlobalParamsIniter(ErrorCallback errorCallback)
 {
-    std::lock_guard<std::mutex> lock { mutex };
+    const std::scoped_lock lock { mutex };
 
     if (count == 0) {
         globalParams = std::make_unique<GlobalParams>(!customDataDir.empty() ? customDataDir.c_str() : nullptr);
@@ -1271,7 +1271,7 @@ GlobalParamsIniter::GlobalParamsIniter(ErrorCallback errorCallback)
 
 GlobalParamsIniter::~GlobalParamsIniter()
 {
-    std::lock_guard<std::mutex> lock { mutex };
+    const std::scoped_lock lock { mutex };
 
     --count;
 
@@ -1282,7 +1282,7 @@ GlobalParamsIniter::~GlobalParamsIniter()
 
 bool GlobalParamsIniter::setCustomDataDir(const std::string &dir)
 {
-    std::lock_guard<std::mutex> lock { mutex };
+    const std::scoped_lock lock { mutex };
 
     if (count == 0) {
         customDataDir = dir;
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index e1379531..6e06ad18 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -9,7 +9,7 @@
    // Copyright (C) 2013, 2018, 2019 Adam Reichold <adamreichold at myopera.com>
    // Copyright (C) 2013 Dmytro Morgun <lztoad at gmail.com>
    // Copyright (C) 2017 Christoph Cullmann <cullmann at kde.org>
-   // Copyright (C) 2017, 2018, 2020, 2021 Albert Astals Cid <aacid at kde.org>
+   // Copyright (C) 2017, 2018, 2020-2022 Albert Astals Cid <aacid at kde.org>
    // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
    // Copyright (C) 2019 Christian Persch <chpe at src.gnome.org>
    // Copyright (C) 2019 Oliver Sander <oliver.sander at tu-dresden.de>
@@ -505,7 +505,7 @@ GooString *GlobalParams::findSystemFontFile(const GfxFont *font, SysFontType *ty
     const GooString *fontName = font->getName();
     if (!fontName)
         return nullptr;
-    std::unique_lock<std::recursive_mutex> locker(mutex);
+    const std::scoped_lock locker(mutex);
     setupBaseFonts(POPPLER_FONTSDIR);
 
     // TODO: base14Name should be changed?
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 71068c31..3b382a5c 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -117,7 +117,7 @@
 // PDFDoc
 //------------------------------------------------------------------------
 
-#define pdfdocLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define pdfdocLocker() const std::scoped_lock locker(mutex)
 
 PDFDoc::PDFDoc() { }
 
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 33da9049..e50abc7f 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2005-2013, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2016-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006-2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2006 Nickolay V. Shmyrev <nshmyrev at yandex.ru>
 // Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
@@ -248,7 +248,7 @@ bool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box)
 // Page
 //------------------------------------------------------------------------
 
-#define pageLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define pageLocker() const std::scoped_lock locker(mutex)
 
 Page::Page(PDFDoc *docA, int numA, Object &&pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form)
 {
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 58ca7d27..a66aa1c5 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Dan Sheridan <dan.sheridan at postman.org.uk>
 // Copyright (C) 2005 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2006, 2008, 2010, 2012-2014, 2016-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2008, 2010, 2012-2014, 2016-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2010 Ilya Gorenbein <igorenbein at finjan.com>
@@ -230,7 +230,7 @@ Object ObjectStream::getObject(int objIdx, int objNum)
 // XRef
 //------------------------------------------------------------------------
 
-#define xrefLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
+#define xrefLocker() const std::scoped_lock locker(mutex)
 
 XRef::XRef() : objStrs { 5 }
 {


More information about the poppler mailing list