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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #include <string.h> 25 #include <limits.h> 26 27 #define INCL_PM 28 #define INCL_DOS 29 #define INCL_DOSERRORS 30 #include <svpm.h> 31 32 #include <tools/debug.hxx> 33 #include <tools/fsys.hxx> 34 #include <tools/stream.hxx> 35 36 // class FileBase 37 #include <osl/file.hxx> 38 39 using namespace osl; 40 41 // class FileBase 42 #ifndef _OSL_FILE_HXX_ 43 #include <osl/file.hxx> 44 #endif 45 46 using namespace osl; 47 48 // ----------------------------------------------------------------------- 49 50 // -------------- 51 // - StreamData - 52 // -------------- 53 54 class StreamData 55 { 56 public: 57 HFILE hFile; 58 sal_Bool bIsEof; 59 60 StreamData() 61 { 62 hFile = 0; 63 bIsEof = sal_True; 64 } 65 }; 66 67 // ----------------------------------------------------------------------- 68 69 sal_uIntPtr GetSvError( APIRET nPMError ) 70 { 71 static struct { APIRET pm; sal_uIntPtr sv; } errArr[] = 72 { 73 { ERROR_FILE_NOT_FOUND, SVSTREAM_FILE_NOT_FOUND }, 74 { ERROR_PATH_NOT_FOUND, SVSTREAM_PATH_NOT_FOUND }, 75 { ERROR_TOO_MANY_OPEN_FILES, SVSTREAM_TOO_MANY_OPEN_FILES }, 76 { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED }, 77 { ERROR_INVALID_ACCESS, SVSTREAM_INVALID_ACCESS }, 78 { ERROR_SHARING_VIOLATION, SVSTREAM_SHARING_VIOLATION }, 79 { ERROR_SHARING_BUFFER_EXCEEDED,SVSTREAM_SHARE_BUFF_EXCEEDED }, 80 { ERROR_CANNOT_MAKE, SVSTREAM_CANNOT_MAKE }, 81 { ERROR_INVALID_PARAMETER, SVSTREAM_INVALID_PARAMETER }, 82 { ERROR_DRIVE_LOCKED, SVSTREAM_LOCKING_VIOLATION }, 83 { ERROR_LOCK_VIOLATION, SVSTREAM_LOCKING_VIOLATION }, 84 { ERROR_FILENAME_EXCED_RANGE, SVSTREAM_INVALID_PARAMETER }, 85 { ERROR_ATOMIC_LOCK_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, 86 { ERROR_READ_LOCKS_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, 87 88 89 { 0xFFFF, SVSTREAM_GENERALERROR } 90 }; 91 92 sal_uIntPtr nRetVal = SVSTREAM_GENERALERROR; // Standardfehler 93 int i=0; 94 do 95 { 96 if( errArr[i].pm == nPMError ) 97 { 98 nRetVal = errArr[i].sv; 99 break; 100 } 101 i++; 102 } 103 while( errArr[i].pm != 0xFFFF ); 104 return nRetVal; 105 } 106 107 /************************************************************************* 108 |* 109 |* SvFileStream::SvFileStream() 110 |* 111 |* Beschreibung STREAM.SDW 112 |* Ersterstellung OV 15.06.94 113 |* Letzte Aenderung OV 15.06.94 114 |* 115 *************************************************************************/ 116 117 SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) 118 { 119 bIsOpen = sal_False; 120 nLockCounter = 0; 121 bIsWritable = sal_False; 122 pInstanceData = new StreamData; 123 124 SetBufferSize( 8192 ); 125 // convert URL to SystemPath, if necessary 126 ::rtl::OUString aFileName, aNormPath; 127 128 if ( FileBase::getSystemPathFromFileURL( rFileName, aFileName ) != FileBase::E_None ) 129 aFileName = rFileName; 130 Open( aFileName, nOpenMode ); 131 } 132 133 /************************************************************************* 134 |* 135 |* SvFileStream::SvFileStream() 136 |* 137 |* Beschreibung STREAM.SDW 138 |* Ersterstellung OV 22.11.94 139 |* Letzte Aenderung OV 22.11.94 140 |* 141 *************************************************************************/ 142 143 SvFileStream::SvFileStream() 144 { 145 bIsOpen = sal_False; 146 nLockCounter = 0; 147 bIsWritable = sal_False; 148 pInstanceData = new StreamData; 149 SetBufferSize( 8192 ); 150 } 151 152 /************************************************************************* 153 |* 154 |* SvFileStream::~SvFileStream() 155 |* 156 |* Beschreibung STREAM.SDW 157 |* Ersterstellung OV 14.06.94 158 |* Letzte Aenderung OV 14.06.94 159 |* 160 *************************************************************************/ 161 162 SvFileStream::~SvFileStream() 163 { 164 Close(); 165 if( pInstanceData ) 166 delete pInstanceData; 167 } 168 169 /************************************************************************* 170 |* 171 |* SvFileStream::GetFileHandle() 172 |* 173 |* Beschreibung STREAM.SDW 174 |* Ersterstellung OV 14.06.94 175 |* Letzte Aenderung OV 14.06.94 176 |* 177 *************************************************************************/ 178 179 sal_uIntPtr SvFileStream::GetFileHandle() const 180 { 181 return (sal_uIntPtr)pInstanceData->hFile; 182 } 183 184 /************************************************************************* 185 |* 186 |* SvFileStream::IsA() 187 |* 188 |* Beschreibung STREAM.SDW 189 |* Ersterstellung OV 14.06.94 190 |* Letzte Aenderung OV 14.06.94 191 |* 192 *************************************************************************/ 193 194 sal_uInt16 SvFileStream::IsA() const 195 { 196 return ID_FILESTREAM; 197 } 198 199 /************************************************************************* 200 |* 201 |* SvFileStream::GetData() 202 |* 203 |* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar 204 |* Ersterstellung OV 15.06.94 205 |* Letzte Aenderung OV 15.06.94 206 |* 207 *************************************************************************/ 208 209 sal_uIntPtr SvFileStream::GetData( void* pData, sal_uIntPtr nSize ) 210 { 211 #ifdef DBG_UTIL 212 ByteString aTraceStr( "SvFileStream::GetData(): " ); 213 aTraceStr += ByteString::CreateFromInt64(nSize); 214 aTraceStr += " Bytes from "; 215 aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); 216 DBG_TRACE( aTraceStr.GetBuffer() ); 217 #endif 218 219 sal_uIntPtr nCount = 0L; 220 if( IsOpen() ) 221 { 222 APIRET nResult; 223 nResult = DosRead( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); 224 if( nResult ) 225 SetError(::GetSvError(nResult) ); 226 } 227 return nCount; 228 } 229 230 /************************************************************************* 231 |* 232 |* SvFileStream::PutData() 233 |* 234 |* Beschreibung STREAM.SDW 235 |* Ersterstellung OV 15.06.94 236 |* Letzte Aenderung OV 15.06.94 237 |* 238 *************************************************************************/ 239 240 sal_uIntPtr SvFileStream::PutData( const void* pData, sal_uIntPtr nSize ) 241 { 242 #ifdef DBG_UTIL 243 ByteString aTraceStr( "SvFileStrean::PutData: " ); 244 aTraceStr += ByteString::CreateFromInt64(nSize); 245 aTraceStr += " Bytes to "; 246 aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); 247 DBG_TRACE( aTraceStr.GetBuffer() ); 248 #endif 249 250 sal_uIntPtr nCount = 0L; 251 if( IsOpen() ) 252 { 253 APIRET nResult; 254 nResult = DosWrite( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); 255 if( nResult ) 256 SetError(::GetSvError(nResult) ); 257 else if( !nCount ) 258 SetError( SVSTREAM_DISK_FULL ); 259 } 260 return nCount; 261 } 262 263 /************************************************************************* 264 |* 265 |* SvFileStream::SeekPos() 266 |* 267 |* Beschreibung STREAM.SDW 268 |* Ersterstellung OV 15.06.94 269 |* Letzte Aenderung OV 15.06.94 270 |* 271 *************************************************************************/ 272 273 sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos ) 274 { 275 sal_uIntPtr nNewPos = 0L; 276 if( IsOpen() ) 277 { 278 APIRET nResult; 279 280 if( nPos != STREAM_SEEK_TO_END ) 281 nResult = DosSetFilePtr( pInstanceData->hFile,(long)nPos, 282 FILE_BEGIN, &nNewPos ); 283 else 284 nResult = DosSetFilePtr( pInstanceData->hFile,0L, 285 FILE_END, &nNewPos ); 286 287 if( nResult ) 288 SetError(::GetSvError(nResult) ); 289 } 290 else 291 SetError( SVSTREAM_GENERALERROR ); 292 return nNewPos; 293 } 294 295 /************************************************************************* 296 |* 297 |* SvFileStream::Tell() 298 |* 299 |* Beschreibung STREAM.SDW 300 |* Ersterstellung OV 15.06.94 301 |* Letzte Aenderung OV 15.06.94 302 |* 303 *************************************************************************/ 304 /* 305 sal_uIntPtr SvFileStream::Tell() 306 { 307 sal_uIntPtr nPos = 0L; 308 309 if( IsOpen() ) 310 { 311 APIRET nResult; 312 nResult = DosSetFilePtr(pInstanceData->hFile,0L,FILE_CURRENT,&nPos); 313 if( nResult ) 314 SetError(::GetSvError(nResult) ); 315 } 316 return nPos; 317 } 318 */ 319 320 /************************************************************************* 321 |* 322 |* SvFileStream::FlushData() 323 |* 324 |* Beschreibung STREAM.SDW 325 |* Ersterstellung OV 15.06.94 326 |* Letzte Aenderung OV 15.06.94 327 |* 328 *************************************************************************/ 329 330 void SvFileStream::FlushData() 331 { 332 if( IsOpen() ) 333 { 334 APIRET nResult; 335 nResult = DosResetBuffer(pInstanceData->hFile ); 336 if( nResult ) 337 SetError(::GetSvError(nResult) ); 338 } 339 } 340 341 /************************************************************************* 342 |* 343 |* SvFileStream::LockRange() 344 |* 345 |* Beschreibung STREAM.SDW 346 |* Ersterstellung OV 15.06.94 347 |* Letzte Aenderung OV 15.06.94 348 |* 349 *************************************************************************/ 350 351 sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) 352 { 353 sal_Bool bRetVal = sal_False; 354 if( IsOpen() ) 355 { 356 APIRET nResult; 357 FILELOCK aLockArea, aUnlockArea; 358 aUnlockArea.lOffset = 0L; 359 aUnlockArea.lRange = 0L; 360 aLockArea.lOffset = (long)nByteOffset; 361 aLockArea.lRange = (long)nBytes; 362 363 nResult = DosSetFileLocks(pInstanceData->hFile, 364 &aUnlockArea, &aLockArea, 365 1000UL, // Zeit in ms bis Abbruch 366 0L // kein Atomic-Lock 367 ); 368 369 if( nResult ) 370 SetError(::GetSvError(nResult) ); 371 else 372 bRetVal = sal_True; 373 } 374 return bRetVal; 375 } 376 377 /************************************************************************* 378 |* 379 |* SvFileStream::UnlockRange() 380 |* 381 |* Beschreibung STREAM.SDW 382 |* Ersterstellung OV 15.06.94 383 |* Letzte Aenderung OV 15.06.94 384 |* 385 *************************************************************************/ 386 387 sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) 388 { 389 sal_Bool bRetVal = sal_False; 390 if( IsOpen() ) 391 { 392 APIRET nResult; 393 FILELOCK aLockArea, aUnlockArea; 394 aLockArea.lOffset = 0L; 395 aLockArea.lRange = 0L; 396 aUnlockArea.lOffset = (long)nByteOffset; 397 aUnlockArea.lRange = (long)nBytes; 398 399 nResult = DosSetFileLocks(pInstanceData->hFile, 400 &aUnlockArea, &aLockArea, 401 1000UL, // Zeit in ms bis Abbruch 402 0L // kein Atomic-Lock 403 ); 404 405 if( nResult ) 406 SetError(::GetSvError(nResult) ); 407 else 408 bRetVal = sal_True; 409 } 410 return bRetVal; 411 } 412 413 /************************************************************************* 414 |* 415 |* SvFileStream::LockFile() 416 |* 417 |* Beschreibung STREAM.SDW 418 |* Ersterstellung OV 15.06.94 419 |* Letzte Aenderung OV 15.06.94 420 |* 421 *************************************************************************/ 422 423 sal_Bool SvFileStream::LockFile() 424 { 425 sal_Bool bRetVal = sal_False; 426 if( !nLockCounter ) 427 { 428 if( LockRange( 0L, LONG_MAX ) ) 429 { 430 nLockCounter = 1; 431 bRetVal = sal_True; 432 } 433 } 434 else 435 { 436 nLockCounter++; 437 bRetVal = sal_True; 438 } 439 return bRetVal; 440 } 441 442 /************************************************************************* 443 |* 444 |* SvFileStream::UnlockFile() 445 |* 446 |* Beschreibung STREAM.SDW 447 |* Ersterstellung OV 15.06.94 448 |* Letzte Aenderung OV 15.06.94 449 |* 450 *************************************************************************/ 451 452 sal_Bool SvFileStream::UnlockFile() 453 { 454 sal_Bool bRetVal = sal_False; 455 if( nLockCounter > 0) 456 { 457 if( nLockCounter == 1) 458 { 459 if( UnlockRange( 0L, LONG_MAX ) ) 460 { 461 nLockCounter = 0; 462 bRetVal = sal_True; 463 } 464 } 465 else 466 { 467 nLockCounter--; 468 bRetVal = sal_True; 469 } 470 } 471 return bRetVal; 472 } 473 474 /************************************************************************* 475 |* 476 |* SvFileStream::Open() 477 |* 478 |* Beschreibung STREAM.SDW 479 |* Ersterstellung OV 15.06.94 480 |* Letzte Aenderung OV 15.06.94 481 |* 482 *************************************************************************/ 483 484 #if 0 485 sal_Bool createLongNameEA ( const PCSZ pszPath, sal_uIntPtr ulAttributes, const String& aLongName ); 486 #endif 487 488 void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) 489 { 490 String aParsedFilename; 491 492 #if 0 493 if ( Folder::IsAvailable() && (rFilename.Search('{') < 9) ) 494 { 495 String aVirtualPart; 496 String aRealPart; 497 String aVirtualPath; 498 ItemIDPath aVirtualURL; 499 sal_uIntPtr nDivider = 0; 500 501 String aVirtualString(rFilename); 502 503 for (int x=aVirtualString.Len(); x>0; x--) 504 { 505 if (aVirtualString.Copy(x,1).Compare("}")==COMPARE_EQUAL) 506 { 507 nDivider = x; 508 break; 509 } 510 } 511 512 aVirtualPart = aVirtualString.Copy(0,nDivider+1); 513 aRealPart = aVirtualString.Copy(nDivider+2); 514 515 aVirtualURL = aVirtualPart; 516 aVirtualPath = aVirtualURL.GetHostNotationPath(); 517 518 DirEntry aTempDirEntry(aVirtualPath); 519 520 aTempDirEntry += aRealPart; 521 522 aParsedFilename = aTempDirEntry.GetFull(); 523 } 524 else 525 #endif // 0 526 { 527 aParsedFilename = rFilename; 528 } 529 530 Close(); 531 SvStream::ClearBuffer(); 532 533 sal_uIntPtr nActionTaken; 534 sal_uIntPtr nOpenAction = 0L; 535 sal_uIntPtr nShareBits = 0L; 536 sal_uIntPtr nReadWriteBits = 0L; 537 538 eStreamMode = nOpenMode; 539 eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten 540 541 nOpenMode |= STREAM_SHARE_DENYNONE; // definierten Zustand garantieren 542 543 // ********* Zugriffsflags *********** 544 if( nOpenMode & STREAM_SHARE_DENYNONE) 545 nShareBits = OPEN_SHARE_DENYNONE; 546 547 if( nOpenMode & STREAM_SHARE_DENYREAD) 548 nShareBits = OPEN_SHARE_DENYREAD; 549 550 if( nOpenMode & STREAM_SHARE_DENYWRITE) 551 nShareBits = OPEN_SHARE_DENYWRITE; 552 553 if( nOpenMode & STREAM_SHARE_DENYALL) 554 nShareBits = OPEN_SHARE_DENYREADWRITE; 555 556 if( (nOpenMode & STREAM_READ) ) 557 { 558 if( nOpenMode & STREAM_WRITE ) 559 nReadWriteBits |= OPEN_ACCESS_READWRITE; 560 else 561 { 562 nReadWriteBits |= OPEN_ACCESS_READONLY; 563 nOpenMode |= STREAM_NOCREATE; 564 } 565 } 566 else 567 nReadWriteBits |= OPEN_ACCESS_WRITEONLY; 568 569 570 if( nOpenMode & STREAM_NOCREATE ) 571 { 572 // Datei nicht erzeugen 573 nOpenAction = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; 574 } 575 else 576 { 577 // Datei erzeugen, wenn nicht vorhanden 578 nOpenAction = OPEN_ACTION_CREATE_IF_NEW; 579 if( nOpenMode & STREAM_TRUNC ) 580 // Auf Nullaenge kuerzen, wenn existiert 581 nOpenAction |= OPEN_ACTION_REPLACE_IF_EXISTS; 582 else 583 // Inhalt der Datei nicht wegwerfen 584 nOpenAction |= OPEN_ACTION_OPEN_IF_EXISTS; 585 } 586 587 #if 0 // YD 588 // 589 // resolves long FAT names used by OS2 590 // 591 sal_Bool bIsLongOS2=sal_False; 592 if (Folder::IsAvailable()) 593 { 594 DirEntry aDirEntry(rFilename); 595 if (aDirEntry.IsLongNameOnFAT()) 596 { 597 // in kurzen Pfad wandeln 598 ItemIDPath aItemIDPath(rFilename); 599 aParsedFilename = aItemIDPath.GetHostNotationPath(); 600 bIsLongOS2 = sal_True; 601 } 602 } 603 #endif 604 605 aFilename = aParsedFilename; 606 ByteString aFileNameA( aFilename, gsl_getSystemTextEncoding()); 607 FSysRedirector::DoRedirect( aFilename ); 608 609 #ifdef DBG_UTIL 610 ByteString aTraceStr( "SvFileStream::Open(): " ); 611 aTraceStr += aFileNameA; 612 DBG_TRACE( aTraceStr.GetBuffer() ); 613 #endif 614 615 APIRET nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, 616 &nActionTaken, 0L, FILE_NORMAL, nOpenAction, 617 nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); 618 619 if( nRet == ERROR_TOO_MANY_OPEN_FILES ) 620 { 621 long nToAdd = 10; 622 sal_uIntPtr nCurMaxFH; 623 nRet = DosSetRelMaxFH( &nToAdd, &nCurMaxFH ); 624 nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, 625 &nActionTaken, 0L, FILE_NORMAL, nOpenAction, 626 nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); 627 } 628 629 // Bei Fehler pruefen, ob wir lesen duerfen 630 if( nRet==ERROR_ACCESS_DENIED || nRet==ERROR_SHARING_VIOLATION ) 631 { 632 nReadWriteBits = OPEN_ACCESS_READONLY; 633 nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, 634 &nActionTaken, 0L, FILE_NORMAL, nOpenAction, 635 nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); 636 } 637 638 if( nRet ) 639 { 640 bIsOpen = sal_False; 641 SetError(::GetSvError(nRet) ); 642 } 643 else 644 { 645 bIsOpen = sal_True; 646 pInstanceData->bIsEof = sal_False; 647 if( nReadWriteBits != OPEN_ACCESS_READONLY ) 648 bIsWritable = sal_True; 649 } 650 651 #if 0 652 if (bIsOpen && bIsLongOS2) 653 { 654 //file schlie�en, da sonst createLongName u.U. nicht m�glich 655 Close(); 656 657 // erzeugtem File langen Namen geben 658 DirEntry aDirEntry(rFilename); 659 createLongNameEA(aFileNameA.GetBuffer(), FILE_NORMAL, aDirEntry.GetName()); 660 661 // und wieder oeffnen 662 ReOpen(); 663 } 664 #endif 665 666 } 667 668 /************************************************************************* 669 |* 670 |* SvFileStream::ReOpen() 671 |* 672 |* Beschreibung STREAM.SDW 673 |* Ersterstellung OV 15.06.94 674 |* Letzte Aenderung OV 15.06.94 675 |* 676 *************************************************************************/ 677 678 void SvFileStream::ReOpen() 679 { 680 if( !bIsOpen && aFilename.Len() ) 681 Open( aFilename, eStreamMode ); 682 } 683 684 /************************************************************************* 685 |* 686 |* SvFileStream::Close() 687 |* 688 |* Beschreibung STREAM.SDW 689 |* Ersterstellung OV 15.06.94 690 |* Letzte Aenderung OV 15.06.94 691 |* 692 *************************************************************************/ 693 694 void SvFileStream::Close() 695 { 696 if( IsOpen() ) 697 { 698 #ifdef DBG_UTIL 699 ByteString aTraceStr( "SvFileStream::Close(): " ); 700 aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); 701 DBG_TRACE( aTraceStr.GetBuffer() ); 702 #endif 703 704 if( nLockCounter ) 705 { 706 nLockCounter = 1; 707 UnlockFile(); 708 } 709 Flush(); 710 DosClose( pInstanceData->hFile ); 711 } 712 713 bIsOpen = sal_False; 714 nLockCounter= 0; 715 bIsWritable = sal_False; 716 pInstanceData->bIsEof = sal_True; 717 SvStream::ClearBuffer(); 718 SvStream::ClearError(); 719 } 720 721 /************************************************************************* 722 |* 723 |* SvFileStream::ResetError() 724 |* 725 |* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang 726 |* Ersterstellung OV 15.06.94 727 |* Letzte Aenderung OV 15.06.94 728 |* 729 *************************************************************************/ 730 731 void SvFileStream::ResetError() 732 { 733 SvStream::ClearError(); 734 } 735 736 /************************************************************************* 737 |* 738 |* SvFileStream::SetSize() 739 |* 740 |* Beschreibung 741 |* Ersterstellung OV 19.10.95 742 |* Letzte Aenderung OV 19.10.95 743 |* 744 *************************************************************************/ 745 746 void SvFileStream::SetSize( sal_uIntPtr nSize ) 747 { 748 if( IsOpen() ) 749 { 750 APIRET nRet = DosSetFileSize( pInstanceData->hFile, nSize ); 751 if( nRet ) 752 SetError( ::GetSvError( nRet ) ); 753 } 754 } 755