diff options
Diffstat (limited to 'vcl/unx/source/printer/ppdparser.cxx')
-rw-r--r-- | vcl/unx/source/printer/ppdparser.cxx | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index 22e17aa774d9..30d4598568d2 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -340,7 +340,7 @@ void PPDDecompressStream::Open( const rtl::OUString& i_rFile ) mpFileStream->Seek( 0 ); // check for compress'ed or gzip'ed file - ULONG nCompressMethod = 0; + sal_uLong nCompressMethod = 0; if( aLine.Len() > 1 && static_cast<unsigned char>(aLine.GetChar( 0 )) == 0x1f ) { if( static_cast<unsigned char>(aLine.GetChar( 1 )) == 0x8b ) // check for gzip @@ -436,51 +436,53 @@ void PPDParser::scanPPDDir( const String& rDir ) PPDCache &rPPDCache = thePPDCache::get(); osl::Directory aDir( rDir ); - aDir.open(); - osl::DirectoryItem aItem; - - INetURLObject aPPDDir(rDir); - while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) + if ( aDir.open() == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName ); - if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + osl::DirectoryItem aItem; + + INetURLObject aPPDDir(rDir); + while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) { - rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); - aURLBuf.append( rDir ); - aURLBuf.append( sal_Unicode( '/' ) ); - aURLBuf.append( aStatus.getFileName() ); + osl::FileStatus aStatus( FileStatusMask_FileName ); + if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + { + rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); + aURLBuf.append( rDir ); + aURLBuf.append( sal_Unicode( '/' ) ); + aURLBuf.append( aStatus.getFileName() ); - rtl::OUString aFileURL, aFileName; - osl::FileStatus::Type eType = osl::FileStatus::Unknown; + rtl::OUString aFileURL, aFileName; + osl::FileStatus::Type eType = osl::FileStatus::Unknown; - if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) - { - if( eType == osl::FileStatus::Regular ) + if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) { - INetURLObject aPPDFile = aPPDDir; - aPPDFile.Append( aFileName ); - - // match extension - for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) + if( eType == osl::FileStatus::Regular ) { - if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) + INetURLObject aPPDFile = aPPDDir; + aPPDFile.Append( aFileName ); + + // match extension + for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) { - if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) { + if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + { (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); - break; + break; + } } } } - } - else if( eType == osl::FileStatus::Directory ) - { - scanPPDDir( aFileURL ); + else if( eType == osl::FileStatus::Directory ) + { + scanPPDDir( aFileURL ); + } } } } + aDir.close(); } - aDir.close(); } void PPDParser::initPPDFiles() @@ -1130,7 +1132,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) m_pTranslator->insertValue( aUniKey, aOption, aValue, aValueTranslation, aTransLocale ); // eventually update query and remove from option list - if( bQuery && pKey->m_bQueryValue == FALSE ) + if( bQuery && pKey->m_bQueryValue == sal_False ) { pKey->m_aQueryValue = *pValue; pKey->m_bQueryValue = true; @@ -1145,7 +1147,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) if( aLine.CompareTo( "*Default", 8 ) == COMPARE_EQUAL ) { String aKey( aLine.Copy( 8 ), RTL_TEXTENCODING_MS_1252 ); - USHORT nPos = aKey.Search( ':' ); + sal_uInt16 nPos = aKey.Search( ':' ); if( nPos != STRING_NOTFOUND ) { aKey.Erase( nPos ); @@ -1433,7 +1435,7 @@ String PPDParser::getSlot( int nSlot ) const if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aOption; else if( m_pInputSlots->countValues() > 0 ) - return m_pInputSlots->getValue( (ULONG)0 )->m_aOption; + return m_pInputSlots->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1446,7 +1448,7 @@ String PPDParser::getSlotCommand( int nSlot ) const if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aValue; else if( m_pInputSlots->countValues() > 0 ) - return m_pInputSlots->getValue( (ULONG)0 )->m_aValue; + return m_pInputSlots->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -1473,7 +1475,7 @@ String PPDParser::getPaperDimension( int nPaperDimension ) const if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption; else if( m_pPaperDimensions->countValues() > 0 ) - return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption; + return m_pPaperDimensions->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1486,7 +1488,7 @@ String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue; else if( m_pPaperDimensions->countValues() > 0 ) - return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue; + return m_pPaperDimensions->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -1595,7 +1597,7 @@ String PPDParser::getDuplex( int nDuplex ) const if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aOption; else if( m_pDuplexTypes->countValues() > 0 ) - return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption; + return m_pDuplexTypes->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1608,7 +1610,7 @@ String PPDParser::getDuplexCommand( int nDuplex ) const if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aValue; else if( m_pDuplexTypes->countValues() > 0 ) - return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue; + return m_pDuplexTypes->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -2050,7 +2052,7 @@ void PPDContext::getUnconstrainedValues( const PPDKey* pKey, ::std::list< const // ------------------------------------------------------------------- -void* PPDContext::getStreamableBuffer( ULONG& rBytes ) const +void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const { rBytes = 0; if( ! m_aCurrentValues.size() ) @@ -2096,7 +2098,7 @@ void* PPDContext::getStreamableBuffer( ULONG& rBytes ) const // ------------------------------------------------------------------- -void PPDContext::rebuildFromStreamBuffer( void* pBuffer, ULONG nBytes ) +void PPDContext::rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ) { if( ! m_pParser ) return; |