[Libreoffice-commits] core.git: vcl/unx
Khaled Hosny
khaledhosny at eglug.org
Fri Dec 2 03:02:55 UTC 2016
vcl/unx/generic/fontmanager/helper.cxx | 114 ---------------------------------
1 file changed, 114 deletions(-)
New commits:
commit 01dcaa31f44aaf684cdfaff8af73aeafbbbd0aa3
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Fri Dec 2 03:08:15 2016 +0200
Unused code
Change-Id: I975f118f4bcfaed338509966240c553c51a9184e
Reviewed-on: https://gerrit.libreoffice.org/31518
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx
index 17d74d2..84f87e7 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -235,120 +235,6 @@ OUString const & psp::getFontPath()
return aPath;
}
-bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile )
-{
- static const unsigned char hexDigits[] =
- {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
- };
-
- bool bSuccess = true;
- bool bEof = false;
- unsigned char buffer[256];
- sal_uInt64 nSize(0);
- rInFile.getSize(nSize);
-
- while( bSuccess && ! bEof )
- {
- sal_uInt64 nRead;
- // read leading bytes
- bEof = ((0 != rInFile.read( buffer, 6, nRead)) || (nRead != 6));
- if( bEof )
- break;
- unsigned int nType = buffer[ 1 ];
- unsigned int nBytesToRead = buffer[2] | buffer[3] << 8 | buffer[4] << 16 | buffer[5] << 24;
- if( buffer[0] != 0x80 ) // test for pfb magic number
- {
- // this might be a pfa font already
- if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 &&
- ( ! std::strncmp( reinterpret_cast<char*>(buffer), "%!FontType1-", 12 ) ||
- ! std::strncmp( reinterpret_cast<char*>(buffer), "%!PS-AdobeFont-", 15 ) ) )
- {
- sal_uInt64 nWrite = 0;
- if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 )
- bSuccess = false;
- while( bSuccess &&
- ! rInFile.read( buffer, sizeof( buffer ), nRead ) &&
- nRead != 0 )
- {
- if( rOutFile.write( buffer, nRead, nWrite ) ||
- nWrite != nRead )
- bSuccess = false;
- }
- bEof = true;
- }
- else
- bSuccess = false;
- }
- else if( nType == 1 || nType == 2 )
- {
- sal_uInt64 nOrgPos(0);
- rInFile.getPos(nOrgPos);
- nBytesToRead = std::min<sal_uInt64>(nBytesToRead, nSize - nOrgPos);
-
- std::unique_ptr<unsigned char[]> pBuffer(new unsigned char[nBytesToRead+1]);
- pBuffer[nBytesToRead] = 0;
-
- if( ! rInFile.read( pBuffer.get(), nBytesToRead, nRead ) && nRead == nBytesToRead )
- {
- if( nType == 1 )
- {
- // ascii data, convert dos lineends( \r\n ) and
- // m_ac lineends( \r ) to \n
- std::unique_ptr<unsigned char[]> pWriteBuffer(new unsigned char[ nBytesToRead ]);
- unsigned int nBytesToWrite = 0;
- for( unsigned int i = 0; i < nBytesToRead; i++ )
- {
- if( pBuffer[i] != '\r' )
- pWriteBuffer[ nBytesToWrite++ ] = pBuffer[i];
- else if( pBuffer[ i+1 ] == '\n' )
- {
- i++;
- pWriteBuffer[ nBytesToWrite++ ] = '\n';
- }
- else
- pWriteBuffer[ nBytesToWrite++ ] = '\n';
- }
- if( rOutFile.write( pWriteBuffer.get(), nBytesToWrite, nRead ) || nRead != nBytesToWrite )
- bSuccess = false;
- }
- else
- {
- // binary data
- unsigned int nBuffer = 0;
- for( unsigned int i = 0; i < nBytesToRead && bSuccess; i++ )
- {
- buffer[ nBuffer++ ] = hexDigits[ pBuffer[ i ] >> 4 ];
- buffer[ nBuffer++ ] = hexDigits[ pBuffer[ i ] & 15 ];
- if( nBuffer >= 80 )
- {
- buffer[ nBuffer++ ] = '\n';
- if( rOutFile.write( buffer, nBuffer, nRead ) || nRead != nBuffer )
- bSuccess = false;
- nBuffer = 0;
- }
- }
- if( nBuffer > 0 && bSuccess )
- {
- buffer[ nBuffer++ ] = '\n';
- if( rOutFile.write( buffer, nBuffer, nRead ) || nRead != nBuffer )
- bSuccess = false;
- }
- }
- }
- else
- bSuccess = false;
- }
- else if( nType == 3 )
- bEof = true;
- else
- bSuccess = false;
- }
-
- return bSuccess;
-}
-
void psp::normPath( OString& rPath )
{
char buf[PATH_MAX];
More information about the Libreoffice-commits
mailing list