]> OCCT Git - occt-copy.git/commitdiff
Fix for draw tests, restoring API and linux compilation CR26229_V7_0_0
authorpdn <pdn@opencascade.com>
Tue, 22 Sep 2015 06:47:35 +0000 (09:47 +0300)
committerpdn <pdn@opencascade.com>
Tue, 22 Sep 2015 06:47:35 +0000 (09:47 +0300)
src/FSD/FSD_CmpFile.cxx
src/FSD/FSD_CmpFile.hxx
src/FSD/FSD_File.cxx
src/FSD/FSD_File.hxx
src/PCDM/PCDM_Reference.hxx
src/QABugs/QABugs_11.cxx
src/QABugs/QABugs_3.cxx

index c7c7e4f67aa4924ab3ce2155ce14f2fcf62fe376..2f8651d74b29444dc6472535a4b11a6e88209756 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <FSD_CmpFile.hxx>
 #include <OSD.hxx>
+#include <Storage_File.hxx>
 #include <Standard_PCharacter.hxx>
 #include <Storage_BaseDriver.hxx>
 #include <Storage_StreamExtCharParityError.hxx>
@@ -72,6 +73,18 @@ Storage_Error FSD_CmpFile::IsGoodFileType(const Handle(Storage_IODevice)& aDevic
 //purpose  : 
 //=======================================================================
 
+Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName, const Storage_OpenMode aMode)
+{
+
+  Handle(Storage_File) aFile = new Storage_File(TCollection_ExtendedString(aName));
+  return Open(aFile, aMode);
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+
 Storage_Error FSD_CmpFile::Open(const Handle(Storage_IODevice)& aDevice,const Storage_OpenMode aMode)
 {
   SetDevice(aDevice);
@@ -80,61 +93,6 @@ Storage_Error FSD_CmpFile::Open(const Handle(Storage_IODevice)& aDevice,const St
     return Storage_VSOpenError;
 
   return Device()->Open(aMode);
-
-  /*
-  Storage_Error result = Storage_VSOk;
-
-  SetName(aName);
-
-  if (OpenMode() == Storage_VSNone) {
-
-#if defined(_WNT32)
-    TCollection_ExtendedString aWName(aName);
-    if (aMode == Storage_VSRead) {
-      myStream.open((const wchar_t*)aWName.ToExtString(),ios::in|ios::binary); // ios::nocreate is not portable
-    }
-    else if (aMode == Storage_VSWrite) {
-      myStream.open((const wchar_t*)aWName.ToExtString(),ios::out|ios::binary);
-    }
-    else if (aMode == Storage_VSReadWrite) {
-      myStream.open((const wchar_t*)aWName.ToExtString(),ios::in|ios::out|ios::binary);
-    }
-#elif !defined(IRIX) && !defined(DECOSF1)
-    if (aMode == Storage_VSRead) {
-      myStream.open(aName.ToCString(),ios::in|ios::binary); // ios::nocreate is not portable
-    }
-    else if (aMode == Storage_VSWrite) {
-      myStream.open(aName.ToCString(),ios::out|ios::binary);
-    }
-    else if (aMode == Storage_VSReadWrite) {
-      myStream.open(aName.ToCString(),ios::in|ios::out|ios::binary);
-    }
-#else
-    if (aMode == Storage_VSRead) {
-      myStream.open(aName.ToCString(),ios::in); // ios::nocreate is not portable
-    }
-    else if (aMode == Storage_VSWrite) {
-      myStream.open(aName.ToCString(),ios::out);
-    }
-    else if (aMode == Storage_VSReadWrite) {
-      myStream.open(aName.ToCString(),ios::in|ios::out);
-    }
-#endif
-
-    if (myStream.fail()) {
-      result = Storage_VSOpenError;
-    }
-    else {
-      myStream.precision(17);
-      myStream.imbue (std::locale::classic()); // use always C locale
-      SetOpenMode(aMode);
-    }
-  }
-  else {
-    result = Storage_VSAlreadyOpen;
-  }
-  return result;
-  */
 }
 
 //=======================================================================
@@ -183,24 +141,6 @@ const Standard_CString FSD_CmpFile::MagicNumber()
 
 void FSD_CmpFile::FlushEndOfLine()
 {
-//  TCollection_AsciiString aDummy;
-//  ReadLine (aDummy); // flush is nothing more than to read till the line-break
-  /*
-  static char Buffer[8192];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-
-  while (!IsEnd && !FSD_CmpFile::IsEnd()) {
-    Buffer[0] = '\0';
-    myStream.get(Buffer,8192,'\n');
-
-    if (myStream.get(c) && c != '\r' && c != '\n') {
-    }
-    else {
-      IsEnd = Standard_True;
-    }
-  }
-  */
 }
 
 //=======================================================================
@@ -218,7 +158,6 @@ void FSD_CmpFile::WriteLine(const TCollection_AsciiString& aStr, const Standard_
     Storage_StreamWriteError::Raise();
 }
 
-
 //=======================================================================
 //function : ReadLine
 //purpose  : read from the current position to the end of line.
@@ -230,14 +169,14 @@ void FSD_CmpFile::ReadLine(TCollection_AsciiString& buffer)
   
   buffer.Clear();
 
-  while (!IsEnd && !FSD_CmpFile::IsEnd())
+  while ( !IsEnd && !FSD_CmpFile::IsEnd() )
   {
     Standard_Character c;
     Device()->Read( (Standard_Address)&c, 1 );
     if ( c != '\n' && c != '\r')
     {
       buffer += c;
-    }  
+    }
     else
     {
       buffer += '\0';
index 29f8366fff00aef3fedfdee89dddb9c91236c9ae..5e8a5de89a4bc35a9eb2e7883da93b838ed1502c 100644 (file)
@@ -56,6 +56,8 @@ public:
 
   
   Standard_EXPORT FSD_CmpFile();
+
+  Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
   
   Standard_EXPORT Storage_Error Open (const Handle(Storage_IODevice)& aDevice, const Storage_OpenMode aMode);
   
index 0ffbef9620f15b4a6a652827f304dae91a2572b5..22464c51a2371c567ab531e529a0f035288cd1d8 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <FSD_File.hxx>
 #include <OSD.hxx>
+#include <Storage_File.hxx>
 #include <Storage_BaseDriver.hxx>
 #include <Storage_StreamExtCharParityError.hxx>
 #include <Storage_StreamFormatError.hxx>
@@ -27,7 +28,6 @@ const Standard_CString MAGICNUMBER = "FSDFILE";
 const Standard_CString ENDOFNORMALEXTENDEDSECTION = "BEGIN_REF_SECTION";
 const Standard_Integer SIZEOFNORMALEXTENDEDSECTION = 16;
 
-//#define USEOSDREAL 1
 
 //=======================================================================
 //function : FSD_File
@@ -68,6 +68,20 @@ Storage_Error FSD_File::IsGoodFileType(const Handle(Storage_IODevice)& aDevice)
   return s;
 }
 
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+
+Storage_Error FSD_File::Open(const TCollection_AsciiString& aName, const Storage_OpenMode aMode)
+{
+
+  Handle(Storage_File) aFile = new Storage_File(TCollection_ExtendedString(aName));
+  return Open(aFile, aMode);
+}
+
+
+
 //=======================================================================
 //function : Open
 //purpose  : 
@@ -129,22 +143,6 @@ const Standard_CString FSD_File::MagicNumber()
 
 void FSD_File::FlushEndOfLine()
 {
-  TCollection_AsciiString aDummy;
-  ReadLine (aDummy); // flush is nothing more than to read till the line-break
-/*  static char Buffer[8192];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-
-  while (!IsEnd && !FSD_File::IsEnd()) {
-    Buffer[0] = '\0';
-    myStream.get(Buffer,8192,'\n');
-
-    if (myStream.get(c) && c != '\n') {
-    }
-    else {
-      IsEnd = Standard_True;
-    }
-  }*/
 }
 
 //=======================================================================
@@ -169,19 +167,18 @@ void FSD_File::WriteLine(const TCollection_AsciiString& aStr, const Standard_Boo
 
 void FSD_File::ReadLine(TCollection_AsciiString& buffer)
 {
-  //  char Buffer[8193];
   Standard_Boolean IsEnd = Standard_False;
   
   buffer.Clear();
 
   while ( !IsEnd && !FSD_File::IsEnd() )
   {
-    //    Buffer[0] = '\0';
-    //    myStream.getline(Buffer,8192,'\n');
     Standard_Character c;
     Device()->Read( (Standard_Address)&c, 1 );
     if ( c != '\n')
+    {
       buffer += c;
+    }
     else
     {
       buffer += '\0';
index 7954d64a3cb34652aa6b4c24f1d02e487648c7bd..315d5f4e05c512344490209ed314e5d2e289f00f 100644 (file)
@@ -69,6 +69,13 @@ public:
   //! The function returns Storage_VSOk if the file
   //! is opened correctly, or any other value of the
   //! Storage_Error enumeration which specifies the problem encountered.
+  Standard_EXPORT Storage_Error Open (const TCollection_AsciiString& aName, const Storage_OpenMode aMode);
+
+  //! Opens source specified by device. aMode precises if the device is
+  //! opened in read or write mode.
+  //! The function returns Storage_VSOk if the file
+  //! is opened correctly, or any other value of the
+  //! Storage_Error enumeration which specifies the problem encountered.
   Standard_EXPORT Storage_Error Open (const Handle(Storage_IODevice)& aDevice, const Storage_OpenMode aMode);
   
   Standard_EXPORT Standard_Boolean IsEnd();
index 16c4c0b8e70dad32c6f3d8fb42575f46ff5e6252..487ba8e785dbde318cb704e53aac2b2af182d9c9 100644 (file)
@@ -39,7 +39,7 @@ public:
   
   Standard_EXPORT Standard_Integer ReferenceIdentifier() const;
   
-  Standard_EXPORT Handle(Storage_IODevice) PCDM_Reference::Device() const;
+  Standard_EXPORT Handle(Storage_IODevice) Device() const;
   
   Standard_EXPORT Standard_Integer DocumentVersion() const;
 
index ca5c858ad1811010a0422f1cdb1f2d1b67463721..1ada39b5e6a9d244cbe923a12ebd3c39329e57ce 100644 (file)
@@ -825,7 +825,7 @@ static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb
   if (!DDocStd::Find(A)) return 1;
 
   TCollection_ExtendedString theStatusMessage;
-  PCDM_StoreStatus theStatus = PCDM_SS_Failure; //A->SaveAs(D,path, theStatusMessage);
+  PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
   if (theStatus != PCDM_SS_OK ) {
     switch ( theStatus ) {
       case PCDM_SS_DriverFailure: {
index b4438aff674b3809cc41d252166059aa45911851..7ebd7b6ac9494083ada732bc2e0f9f0f63e14998 100644 (file)
@@ -1594,9 +1594,8 @@ static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char ** a
   TDF_Label L;
   DDF::AddLabel(aDF, "0:2", L);
  
-  Handle(TPrsStd_AISPresentation) AISP = new TPrsStd_AISPresentation;
-
-  AISP->Set(L,TDataXtd_Constraint::GetID());
+  Handle(TPrsStd_AISPresentation) AISP = 
+    TPrsStd_AISPresentation::Set(L,TDataXtd_Constraint::GetID());
 
   if (AISP->HasOwnMode()) {di<<3;return 0;}
   AISP->SetMode(3);