vcl/inc/ppdparser.hxx                 |    2 +-
 vcl/unx/generic/printer/ppdparser.cxx |    8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 3805a4090dbbffa54bb1a9d7fe63e723fc6d029b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 22 14:08:44 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 22 19:39:44 2022 +0200

    pass in bDontSwap rather than use a local static
    
    Change-Id: I8758802064476199f34d57e0937ee56cef6e0363
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140429
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx
index 7999957b7e68..5d4195783a68 100644
--- a/vcl/inc/ppdparser.hxx
+++ b/vcl/inc/ppdparser.hxx
@@ -201,7 +201,7 @@ public:
     // returns false if paper not found
 
     // match the best paper for width and height
-    OUString        matchPaper( int nWidth, int nHeight ) const;
+    OUString        matchPaper( int nWidth, int nHeight, bool bDontSwap = 
false ) const;
 
     bool getMargins( std::u16string_view rPaperName,
                      int &rLeft, int& rRight,
diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index 061cd5bc727d..6e980776e73e 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1466,7 +1466,7 @@ bool PPDParser::getPaperDimension(
     return true;
 }
 
-OUString PPDParser::matchPaper( int nWidth, int nHeight ) const
+OUString PPDParser::matchPaper(int nWidth, int nHeight, bool bDontSwap) const
 {
     if( ! m_pPaperDimensions )
         return OUString();
@@ -1497,14 +1497,10 @@ OUString PPDParser::matchPaper( int nWidth, int nHeight 
) const
         }
     }
 
-    static bool bDontSwap = false;
     if( nPDim == -1 && ! bDontSwap )
     {
         // swap portrait/landscape and try again
-        bDontSwap = true;
-        OUString rRet = matchPaper( nHeight, nWidth );
-        bDontSwap = false;
-        return rRet;
+        return matchPaper( nHeight, nWidth, true );
     }
 
     return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : 
OUString();

Reply via email to