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