[Libreoffice-commits] core.git: vcl/unx

Khaled Hosny khaledhosny at eglug.org
Wed Nov 23 19:59:25 UTC 2016


 vcl/unx/generic/print/genprnpsp.cxx      |   17 +++--------------
 vcl/unx/generic/print/genpspgraphics.cxx |   28 ----------------------------
 vcl/unx/generic/print/glyphset.cxx       |    6 ------
 3 files changed, 3 insertions(+), 48 deletions(-)

New commits:
commit b49611a7cde3607446ad224ff2824c722b17e204
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Nov 23 21:15:36 2016 +0200

    This code is only ever compiled on Unix
    
    Remove what seems like incomplete attempt to make it cross platform.
    
    Change-Id: I551fa091a3143925a15fced1de44f7f45929b21e
    Reviewed-on: https://gerrit.libreoffice.org/31131
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index d0cedec..73ac666 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -30,11 +30,9 @@
  */
 
 // For spawning PDF and FAX generation
-#if defined( UNX )
-#  include <unistd.h>
-#  include <sys/wait.h>
-#  include <sys/stat.h>
-#endif
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
 
 #include <comphelper/fileurl.hxx>
 #include "rtl/ustring.hxx"
@@ -253,7 +251,6 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
 }
 
 // Needs a cleaner abstraction ...
-#if defined( UNX )
 static bool passFileToCommandLine( const OUString& rFilename, const OUString& rCommandLine )
 {
     bool bSuccess = false;
@@ -337,7 +334,6 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
 
     return bSuccess;
 }
-#endif
 
 static std::vector<OUString> getFaxNumbers()
 {
@@ -360,15 +356,10 @@ static std::vector<OUString> getFaxNumbers()
 
 static bool createPdf( const OUString& rToFile, const OUString& rFromFile, const OUString& rCommandLine )
 {
-#if defined( UNX )
     OUString aCommandLine(
         rCommandLine.replaceAll("(OUTFILE)", rToFile));
 
     return passFileToCommandLine( rFromFile, aCommandLine );
-#else
-    (void)rToFile; (void)rFromFile; (void)rCommandLine;
-    return false;
-#endif
 }
 
 /*
@@ -904,7 +895,6 @@ bool PspSalPrinter::StartJob(
     }
 
     int nMode = 0;
-#if defined( UNX )
     // check whether this printer is configured as fax
     sal_Int32 nIndex = 0;
     const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
@@ -928,7 +918,6 @@ bool PspSalPrinter::StartJob(
             break;
         }
     }
-#endif
     m_aPrinterGfx.Init( m_aJobData );
 
     return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect );
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 0a7c849..8c73ec14 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -23,14 +23,11 @@
 
 #include <sal/types.h>
 
-// for mmap etc.
-#if defined( UNX )
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#endif
 
 #include <comphelper/string.hxx>
 #include <i18nlangtag/mslangid.hxx>
@@ -1267,13 +1264,8 @@ bool GenPspGraphics::supportsOperation( OutDevSupportType ) const
 
 void GenPspGraphics::DoFreeEmbedFontData( const void* pData, long nLen )
 {
-#if defined( UNX )
     if( pData )
         munmap( const_cast<void *>(pData), nLen );
-#else
-    (void)nLen;
-    rtl_freeMemory( (void *)pData );
-#endif
 }
 
 const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
@@ -1306,7 +1298,6 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
 
     OString aSysPath = rMgr.getFontFileSysPath( aFont );
 
-#if defined( UNX )
     int fd = open( aSysPath.getStr(), O_RDONLY );
     if( fd < 0 )
         return nullptr;
@@ -1321,25 +1312,6 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
     if( pFile == MAP_FAILED )
         return nullptr;
     *pDataLen = aStat.st_size;
-#else
-    // FIXME: test me ! ...
-    OUString aURL;
-    if( osl::File::getFileURLFromSystemPath( OStringToOUString( aSysPath, osl_getThreadTextEncoding() ), aURL ) != osl::File::E_None )
-        return NULL;
-    osl::File aFile( aURL );
-    if( aFile.open( osl_File_OpenFlag_Read | osl_File_OpenFlag_NoLock ) != osl::File::E_None )
-        return NULL;
-
-    osl::DirectoryItem aItem;
-    osl::DirectoryItem::get( aURL, aItem );
-    osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
-    aItem.getFileStatus( aFileStatus );
-
-    void *pFile = rtl_allocateMemory( aFileStatus.getFileSize() );
-    sal_uInt64 nRead = 0;
-    aFile.read( pFile, aFileStatus.getFileSize(), nRead );
-    *pDataLen = (long) nRead;
-#endif
 
     rInfo.m_aFontBBox   = Rectangle( Point( xMin, yMin ), Size( xMax-xMin, yMax-yMin ) );
     rInfo.m_nCapHeight  = yMax; // Well ...
diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx
index 65079bf..56decb7 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -726,7 +726,6 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
     if (meBaseType != fonttype::TrueType)
         return;
 
-#if defined( UNX )
     TrueTypeFont *pTTFont;
     OString aTTFileName (rGfx.GetFontMgr().getFontFileSysPath(mnFontID));
     int nFace = rGfx.GetFontMgr().getFontFaceNumber(mnFontID);
@@ -827,11 +826,6 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
     // cleanup
     CloseTTFont (pTTFont);
     fclose (pTmpFile);
-
-#else
-    (void)rOutFile; (void)rGfx; (void)bAllowType42; (void)rSuppliedFonts;
-#  warning FIXME: Missing OpenTTFontFile outside of Unix ...
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list