helper.cxx (c82f2877) | helper.cxx (4d742e16) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 236 unchanged lines hidden (view full) --- 245 fprintf( stderr, "initializing font path to \"%s\"\n", OUStringToOString( aPath, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); 246#endif 247 } 248 return aPath; 249} 250 251bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) 252{ | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 236 unchanged lines hidden (view full) --- 245 fprintf( stderr, "initializing font path to \"%s\"\n", OUStringToOString( aPath, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); 246#endif 247 } 248 return aPath; 249} 250 251bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) 252{ |
253 static unsigned char hexDigits[] = | 253 static const unsigned char hexDigits[] = |
254 { 255 '0', '1', '2', '3', '4', '5', '6', '7', 256 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 257 }; 258 259 bool bSuccess = true; 260 bool bEof = false; 261 unsigned char buffer[256]; 262 sal_uInt64 nRead; 263 sal_uInt64 nOrgPos = 0; 264 rInFile.getPos( nOrgPos ); 265 266 while( bSuccess && ! bEof ) 267 { 268 // read leading bytes | 254 { 255 '0', '1', '2', '3', '4', '5', '6', '7', 256 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 257 }; 258 259 bool bSuccess = true; 260 bool bEof = false; 261 unsigned char buffer[256]; 262 sal_uInt64 nRead; 263 sal_uInt64 nOrgPos = 0; 264 rInFile.getPos( nOrgPos ); 265 266 while( bSuccess && ! bEof ) 267 { 268 // read leading bytes |
269 bEof = ! rInFile.read( buffer, 6, nRead ) && nRead == 6 ? false : true; | 269 bEof = ((0 != rInFile.read( buffer, 6, nRead)) || (nRead != 6)); 270 if( bEof ) 271 break; |
270 unsigned int nType = buffer[ 1 ]; 271 unsigned int nBytesToRead = buffer[2] | buffer[3] << 8 | buffer[4] << 16 | buffer[5] << 24; | 272 unsigned int nType = buffer[ 1 ]; 273 unsigned int nBytesToRead = buffer[2] | buffer[3] << 8 | buffer[4] << 16 | buffer[5] << 24; |
272 if( buffer[0] != 0x80 ) // test for pfb m_agic number | 274 if( buffer[0] != 0x80 ) // test for pfb magic number |
273 { 274 // this migt be a pfa font already 275 sal_uInt64 nWrite = 0; 276 if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 && 277 ( ! std::strncmp( (char*)buffer, "%!FontType1-", 12 ) || 278 ! std::strncmp( (char*)buffer, "%!PS-AdobeFont-", 15 ) ) ) 279 { 280 if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 ) --- 120 unchanged lines hidden --- | 275 { 276 // this migt be a pfa font already 277 sal_uInt64 nWrite = 0; 278 if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 && 279 ( ! std::strncmp( (char*)buffer, "%!FontType1-", 12 ) || 280 ! std::strncmp( (char*)buffer, "%!PS-AdobeFont-", 15 ) ) ) 281 { 282 if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 ) --- 120 unchanged lines hidden --- |