Skip to content

Commit

Permalink
Merge pull request #441 from tpaviot/review/fix-writing-XCAF
Browse files Browse the repository at this point in the history
Fix writing of XML CAF documents
  • Loading branch information
dbarbier committed Dec 26, 2013
2 parents 0871b15 + 5a5a477 commit d94733c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/LDOM/LDOM_OSStream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Standard_CString LDOM_SBuffer::str () const
//function : overflow()
//purpose : redefined virtual
//=======================================================================
int LDOM_SBuffer::overflow(signed char c)
int LDOM_SBuffer::overflow(int c)
{
char cc = (char)c;
return (int)xsputn(&cc,1);
Expand Down
2 changes: 1 addition & 1 deletion src/LDOM/LDOM_OSStream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LDOM_SBuffer : public streambuf

// Methods of streambuf

Standard_EXPORT virtual int overflow(signed char c = EOF);
Standard_EXPORT virtual int overflow(int c = EOF);
Standard_EXPORT virtual int underflow();
//virtual int uflow();

Expand Down
11 changes: 11 additions & 0 deletions test/OCAFExport_test/OCAFExport_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <OSD_File.hxx>
#include <OSD_Path.hxx>
#include <TCollection_ExtendedString.hxx>
#include <LDOM_OSStream.hxx>
#include <iostream>
#include <gtest/gtest.h>

Handle(TDocStd_Application) app = new AppStd_Application();
Expand Down Expand Up @@ -45,6 +47,15 @@ TEST(OCAFExportTestSuite, testExportNonAscii)
delete[] filename;
}

TEST(OCAFExportTestSuite, testOverflow)
{
// See https://github.com/tpaviot/oce/pull/441
LDOM_OSStream oss(128);
oss << "line 1" << std::endl;
oss << "line 2" << std::endl;
ASSERT_TRUE(strlen(oss.str()) == 14);
}

int main(int argc, char **argv){
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down

0 comments on commit d94733c

Please sign in to comment.