1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0026922: Huge performance issue writing data to the output stream

Test case for issue CR26922

Correction of literal (char to string)
This commit is contained in:
mgn
2015-12-02 16:39:55 +03:00
committed by bugmaster
parent cc6852f3e9
commit 586db386eb
183 changed files with 3221 additions and 3181 deletions

View File

@@ -75,7 +75,7 @@ static Standard_Integer DDocStd_ListDocuments (Draw_Interpretor& di,
}
return 0;
}
di << "DDocStd_ListDocuments : Error" << "\n";
di << "DDocStd_ListDocuments : Error\n";
return 1;
}
@@ -96,10 +96,10 @@ static Standard_Integer DDocStd_NewDocument (Draw_Interpretor& di,
D = new TDocStd_Document("dummy");
DD = new DDocStd_DrawDocument(D);
Draw::Set(a[1],DD);
di << "document (not handled by application) " << a[1] << " created" << "\n";
di << "document (not handled by application) " << a[1] << " created\n";
DDocStd::ReturnLabel(di,D->Main());
}
else di << a[1] << " is already a document" << "\n";
else di << a[1] << " is already a document\n";
return 0;
}
if (nb == 3) {
@@ -110,13 +110,13 @@ static Standard_Integer DDocStd_NewDocument (Draw_Interpretor& di,
DD = new DDocStd_DrawDocument(D);
TDataStd_Name::Set(D->GetData()->Root(),a[1]);
Draw::Set(a[1],DD);
di << "document " << a[1] << " created" << "\n";
di << "document " << a[1] << " created\n";
DDocStd::ReturnLabel(di,D->Main());
}
else di << a[1] << " is already a document" << "\n";
else di << a[1] << " is already a document\n";
return 0;
}
di << "DDocStd_NewDocument : Error" << "\n";
di << "DDocStd_NewDocument : Error\n";
return 1;
}
@@ -136,7 +136,7 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
Handle(TDocStd_Document) D;
Standard_Integer insession = A->IsInSession(path);
if (insession > 0) {
di <<"document " << insession << " is already in session" << "\n";
di <<"document " << insession << " is already in session\n";
return 0;
}
PCDM_ReaderStatus theStatus = A->Open(path,D);
@@ -149,32 +149,32 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
switch ( theStatus ) {
case PCDM_RS_AlreadyRetrieved:
case PCDM_RS_AlreadyRetrievedAndModified: {
di << " already retrieved " << "\n" ;
di << " already retrieved \n" ;
break;
}
case PCDM_RS_NoDriver: {
di << " could not retrieve , no Driver to make it " <<"\n" ;
di << " could not retrieve , no Driver to make it \n" ;
break ;
}
case PCDM_RS_UnknownDocument:
case PCDM_RS_NoModel: {
di << " could not retrieve , Unknown Document or No Model " <<"\n";
di << " could not retrieve , Unknown Document or No Model \n";
break ;
}
case PCDM_RS_TypeNotFoundInSchema:
case PCDM_RS_UnrecognizedFileFormat: {
di << " could not retrieve , Type not found or Unrecognized File Format" <<"\n";
di << " could not retrieve , Type not found or Unrecognized File Format\n";
break ;
}
case PCDM_RS_PermissionDenied: {
di << " could not retrieve , permission denied " << "\n" ;
di << " could not retrieve , permission denied \n" ;
break;
}
default:
di << " could not retrieve " << "\n" ;
di << " could not retrieve \n" ;
break;
}
di << "DDocStd_Open : Error" << "\n";
di << "DDocStd_Open : Error\n";
}
}
return 1;
@@ -195,13 +195,13 @@ static Standard_Integer DDocStd_Save (Draw_Interpretor& di,
Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1;
if (!D->IsSaved()) {
di << "this document has never been saved" << "\n";
di << "this document has never been saved\n";
return 0;
}
A->Save(D);
return 0;
}
di << "DDocStd_Save : Error" << "\n";
di << "DDocStd_Save : Error\n";
return 1;
}
@@ -224,27 +224,27 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
case PCDM_SS_DriverFailure: {
di << "Error saving document: Could not store , no driver found to make it" << "\n";
di << "Error saving document: Could not store , no driver found to make it\n";
break ;
}
case PCDM_SS_WriteFailure: {
di << "Error saving document: Write access failure" << "\n";
di << "Error saving document: Write access failure\n";
break;
}
case PCDM_SS_Failure: {
di << "Error saving document: Write failure" << "\n" ;
di << "Error saving document: Write failure\n" ;
break;
}
case PCDM_SS_Doc_IsNull: {
di << "Error saving document: No document to save" << "\n";
di << "Error saving document: No document to save\n";
break ;
}
case PCDM_SS_No_Obj: {
di << "Error saving document: No objects written" << "\n";
di << "Error saving document: No objects written\n";
break;
}
case PCDM_SS_Info_Section_Error: {
di << "Error saving document: Write info section failure" << "\n" ;
di << "Error saving document: Write info section failure\n" ;
break;
}
default:
@@ -255,7 +255,7 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
return 0;
}
}
di << "DDocStd_SaveAs : Error not enough argument" << "\n";
di << "DDocStd_SaveAs : Error not enough argument\n";
return 1;
}
@@ -323,7 +323,7 @@ static Standard_Integer DDocStd_IsInSession (Draw_Interpretor& di,
di << A->IsInSession(a[1]);
return 0;
}
di << "DDocStd_IsInSession : Error" << "\n";
di << "DDocStd_IsInSession : Error\n";
return 1;
}
@@ -348,7 +348,7 @@ static Standard_Integer DDocStd_OSDPath (Draw_Interpretor& di,
di << "Extension : " << path.Extension().ToCString() << "\n";
return 0;
}
di << "DDocStd_OSDPath : Error" << "\n";
di << "DDocStd_OSDPath : Error\n";
return 1;
}
@@ -378,7 +378,7 @@ static Standard_Integer DDocStd_Path (Draw_Interpretor& di,
di << "Path : " << PathAsciiString.ToCString() << "\n";
return 0;
}
di << "DDocStd_Path : Error" << "\n";
di << "DDocStd_Path : Error\n";
return 1;
}
@@ -400,7 +400,7 @@ static Standard_Integer DDocStd_AddComment (Draw_Interpretor& di,
D->AddComment(comment);
return 0;
}
di << "DDocStd_AddComment : Wrong arguments number" << "\n";
di << "DDocStd_AddComment : Wrong arguments number\n";
return 1;
}
@@ -428,7 +428,7 @@ static Standard_Integer DDocStd_PrintComments (Draw_Interpretor& di,
return 0;
}
di << "DDocStd_PrintComments : Wrong arguments number" << "\n";
di << "DDocStd_PrintComments : Wrong arguments number\n";
return 1;
}

View File

@@ -61,7 +61,7 @@ static Standard_Integer DDocStd_Main (Draw_Interpretor& di,Standard_Integer nb,
DDocStd::ReturnLabel(di,DOC->Main());
return 0;
}
di << "DDocStd_Main : Error" << "\n";
di << "DDocStd_Main : Error\n";
return 1;
}
@@ -89,7 +89,7 @@ static Standard_Integer DDocStd_Format (Draw_Interpretor& di,Standard_Integer n,
D->ChangeStorageFormat(a[2]);
return 0;
}
di << "DDocStd_Format : Error" << "\n";
di << "DDocStd_Format : Error\n";
return 1;
}
@@ -109,11 +109,11 @@ static Standard_Integer DDocStd_Copy (Draw_Interpretor& di,Standard_Integer n, c
TDocStd_XLinkTool XLinkTool;
XLinkTool.Copy(L,XL);
if (!XLinkTool.IsDone()) {
di << "DDocStd_XLinkTool : not done" << "\n";
di << "DDocStd_XLinkTool : not done\n";
}
return 0;
}
di << "DDocStd_XLinkTool : Error" << "\n";
di << "DDocStd_XLinkTool : Error\n";
return 1;
}
@@ -134,11 +134,11 @@ static Standard_Integer DDocStd_CopyWithLink (Draw_Interpretor& di,Standard_Inte
TDocStd_XLinkTool XLinkTool;
XLinkTool.CopyWithLink(L,XL);
if (!XLinkTool.IsDone()) {
di << "DDocStd_CopyWithLink : not done" << "\n";
di << "DDocStd_CopyWithLink : not done\n";
}
return 0;
}
di << "DDocStd_CopyWithLink : Error" << "\n";
di << "DDocStd_CopyWithLink : Error\n";
return 1;
}
@@ -157,20 +157,20 @@ static Standard_Integer DDocStd_UpdateLink (Draw_Interpretor& di,Standard_Intege
if (!DDocStd::Find(DOC,a[2],TDF_Reference::GetID(),REF)) return 1;
XLinkTool.UpdateLink(REF->Label());
if (!XLinkTool.IsDone()) {
di << "DDocStd_UpdateXLink : not done" << "\n";
di << "DDocStd_UpdateXLink : not done\n";
}
}
else {
for (TDocStd_XLinkIterator xit (DOC); xit.More(); xit.Next()) {
XLinkTool.UpdateLink(xit.Value()->Label());
if (!XLinkTool.IsDone()) {
di << "DDocStd_UpdateXLink : not done" << "\n";
di << "DDocStd_UpdateXLink : not done\n";
}
}
}
return 0;
}
di << "DDocStd_UpdateXLink : Error" << "\n";
di << "DDocStd_UpdateXLink : Error\n";
return 1;
}
@@ -220,10 +220,10 @@ static Standard_Integer DDocStd_Undo (Draw_Interpretor& di,Standard_Integer n, c
for (i = 1; i <= step; i++) {
if (undo) {
if (!D->Undo()) di << "Undo not done" << "\n";
if (!D->Undo()) di << "Undo not done\n";
}
else {
if (!D->Redo()) di << "Redo not done" << "\n";
if (!D->Redo()) di << "Redo not done\n";
}
}
@@ -305,7 +305,7 @@ static Standard_Integer DDocStd_DumpDocument (Draw_Interpretor& di,
if (D->IsSaved())
di << "DOCUMENT : " << TCollection_AsciiString(D->GetName(),'?').ToCString();
else
di << "DOCUMENT : " << "not saved";
di << "DOCUMENT : not saved";
di << "\n";
// format
//cout << "FORMAT : " << D->StorageFormat();
@@ -337,7 +337,7 @@ static Standard_Integer DDocStd_DumpDocument (Draw_Interpretor& di,
if (!TDocStd_Modified::IsEmpty(D->Main())) {
di << "MODIFICATIONS : ";
TDF_MapIteratorOfLabelMap it (D->GetModified());
if (!it.More()) di << "VALID" << "\n";
if (!it.More()) di << "VALID\n";
else {
TCollection_AsciiString string;
for (;it.More();it.Next()) {
@@ -349,7 +349,7 @@ static Standard_Integer DDocStd_DumpDocument (Draw_Interpretor& di,
}
return 0;
}
di << "DDocStd_DumpDocument : Error" << "\n";
di << "DDocStd_DumpDocument : Error\n";
return 1;
}
@@ -369,7 +369,7 @@ static Standard_Integer DDocStd_SetModified (Draw_Interpretor& di,Standard_Integ
}
return 0;
}
di << "DDocStd_SetModified : Error" << "\n";
di << "DDocStd_SetModified : Error\n";
return 1;
}
@@ -400,7 +400,7 @@ static Standard_Integer DDocStd_Propagate (Draw_Interpretor& di,Standard_Integer
// D->PurgeModified();
// return 0;
// }
di << "DDocStd_Propagate : not implemented" << "\n";
di << "DDocStd_Propagate : not implemented\n";
return 1;
}

View File

@@ -63,20 +63,20 @@ static int mtmCreate (Draw_Interpretor& /*di*/, int n, const char** a)
static int mtmAddDocument (Draw_Interpretor& di, int n, const char** a)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
if(n > 1) {
Handle(DDocStd_DrawDocument) aDrawDoc =
Handle(DDocStd_DrawDocument)::DownCast(Draw::Get(a[1]));
if(aDrawDoc.IsNull()) {
di << "Error : wrong document name" << "\n";
di << "Error : wrong document name\n";
return 1;
}
sMultiTransactionManager->AddDocument(aDrawDoc->GetDocument());
}
else {
di << "Error : document name is not defined" << "\n";
di << "Error : document name is not defined\n";
return 1;
}
return 0;
@@ -90,7 +90,7 @@ static int mtmAddDocument (Draw_Interpretor& di, int n, const char** a)
static int mtmOpenTransaction (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
sMultiTransactionManager->OpenCommand();
@@ -105,7 +105,7 @@ static int mtmOpenTransaction (Draw_Interpretor& di, int /*n*/, const char** /*a
static int mtmCommitTransaction (Draw_Interpretor& di, int n, const char** a)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
if(n > 1)
@@ -123,7 +123,7 @@ static int mtmCommitTransaction (Draw_Interpretor& di, int n, const char** a)
static int mtmAbortTransaction (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
sMultiTransactionManager->AbortCommand();
@@ -138,15 +138,15 @@ static int mtmAbortTransaction (Draw_Interpretor& di, int /*n*/, const char** /*
static int mtmDump (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
di << "*** Dump of MTM ***" << "\n";
di << "*** Dump of MTM ***\n";
//sMultiTransactionManager->DumpTransaction(cout);
Standard_SStream aStream;
sMultiTransactionManager->DumpTransaction(aStream);
di << aStream;
di << "\n" << "*** End ***" << "\n";
di << "\n*** End ***\n";
return 0;
}
@@ -158,7 +158,7 @@ static int mtmDump (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
static int mtmUndo (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
sMultiTransactionManager->Undo();
@@ -173,7 +173,7 @@ static int mtmUndo (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
static int mtmRedo (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
sMultiTransactionManager->Redo();
@@ -188,7 +188,7 @@ static int mtmRedo (Draw_Interpretor& di, int /*n*/, const char** /*a*/)
static int mtmNestedMode (Draw_Interpretor& di, int n, const char** a)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
Standard_Boolean aMode = Standard_False;
@@ -206,7 +206,7 @@ static int mtmNestedMode (Draw_Interpretor& di, int n, const char** a)
static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if ( argc <4 ) { di << "ERROR: Too few args" << "\n"; return 0; }
if ( argc <4 ) { di << "ERROR: Too few args\n"; return 0; }
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(argv[1], Standard_True));
if ( browser.IsNull() ) { di << "ERROR: Not a browser: " << argv[1] << "\n"; return 0; }
@@ -219,7 +219,7 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer
TDF_AttributeIterator itr(lab,Standard_False);
for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next();
if ( ! itr.More() ) { di << "ERROR: Attribute #" << num << " not found" << "\n"; return 0; }
if ( ! itr.More() ) { di << "ERROR: Attribute #" << num << " not found\n"; return 0; }
const Handle(TDF_Attribute)& att = itr.Value();
if ( att->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) )
@@ -331,20 +331,20 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer
static int mtmRemoveDocument (Draw_Interpretor& di, int n, const char** a)
{
if(sMultiTransactionManager.IsNull()) {
di << "Error : manager is not initialised" << "\n";
di << "Error : manager is not initialised\n";
return 1;
}
if(n > 1) {
Handle(DDocStd_DrawDocument) aDrawDoc =
Handle(DDocStd_DrawDocument)::DownCast(Draw::Get(a[1]));
if(aDrawDoc.IsNull()) {
di << "Error : wrong document name" << "\n";
di << "Error : wrong document name\n";
return 1;
}
sMultiTransactionManager->RemoveDocument(aDrawDoc->GetDocument());
}
else {
di << "Error : document name is not defined" << "\n";
di << "Error : document name is not defined\n";
return 1;
}
return 0;

View File

@@ -67,7 +67,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
TDF_AttributeDeltaList added, forgoten, resumed, removed, modified;
Handle(TDF_AttributeDelta) AD;
if (D->GetUndos().IsEmpty()) {
di << "no UNDO available" << "\n";
di << "no UNDO available\n";
return 0;
}
Handle(TDF_Delta) DELTA = D->GetUndos().Last();
@@ -90,7 +90,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
di << "ADDED :";
it.Initialize(added);
if (it.More()) di << "\n";
else di << " empty" << "\n";
else di << " empty\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
@@ -102,7 +102,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
di << "FORGOTEN :";
it.Initialize(forgoten);
if (it.More()) di << "\n";
else di << " empty" << "\n";
else di << " empty\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
@@ -114,7 +114,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
di << "RESUMED :";
it.Initialize(resumed);
if (it.More()) di << "\n";
else di << " empty" << "\n";
else di << " empty\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
@@ -126,7 +126,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
di << "REMOVED :";
it.Initialize(removed);
if (it.More()) di << "\n";
else di << " empty" << "\n";
else di << " empty\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
@@ -138,7 +138,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
di << "MODIFIED :";
it.Initialize(modified);
if (it.More()) di << "\n";
else di << " empty" << "\n";
else di << " empty\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
@@ -147,7 +147,7 @@ static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
}
return 0;
}
di << "TDocStd_DumpCommand : Error" << "\n";
di << "TDocStd_DumpCommand : Error\n";
return 1;
}