diff --git a/src/CheckedFile.cpp b/src/CheckedFile.cpp index df6d4c6..72c33b0 100644 --- a/src/CheckedFile.cpp +++ b/src/CheckedFile.cpp @@ -51,6 +51,7 @@ #endif #include +#include #include #include @@ -67,10 +68,6 @@ #define O_BINARY ( 0 ) #endif -#ifndef _unlink -#define _unlink unlink -#endif - using namespace e57; using namespace std; @@ -669,12 +666,12 @@ void CheckedFile::unlink() { close(); - /// Try to unlink the file, don't report a failure - int result = ::_unlink( fileName_.c_str() ); //??? unicode support here + /// Try to remove the file, don't report a failure + int result = std::remove( fileName_.c_str() ); //??? unicode support here #ifdef E57_MAX_VERBOSE if ( result < 0 ) { - cout << "::unlink() failed, result=" << result << endl; + cout << "std::remove() failed, result=" << result << endl; } #endif } diff --git a/src/SourceDestBufferImpl.cpp b/src/SourceDestBufferImpl.cpp index 2327a3d..bdab57e 100644 --- a/src/SourceDestBufferImpl.cpp +++ b/src/SourceDestBufferImpl.cpp @@ -221,9 +221,9 @@ template void SourceDestBufferImpl::_setNextReal( T inValue ) { #ifdef _MSC_VER // MSVC is not smart enough to realize 'inValue' cannot be a double here, so disable warning -#pragma warning( disable : C4244 ) +#pragma warning( disable : 4244 ) *reinterpret_cast( p ) = inValue; -#pragma warning( default : C4244 ) +#pragma warning( default : 4244 ) #else *reinterpret_cast( p ) = inValue; #endif diff --git a/src/StructureNodeImpl.cpp b/src/StructureNodeImpl.cpp index ab386e1..492cda6 100644 --- a/src/StructureNodeImpl.cpp +++ b/src/StructureNodeImpl.cpp @@ -373,6 +373,8 @@ void StructureNodeImpl::writeXml( ImageFileImplSharedPtr imf, CheckedFile &cf, i cf << space( indent ) << "<" << fieldName << " type=\"Structure\""; + const int numSpaces = indent + static_cast( fieldName.length() ) + 2; + /// If this struct is the root for the E57 file, add name space declarations /// Note the prototype of a CompressedVector is a separate tree, so don't /// want to write out namespaces if not the ImageFile root @@ -392,17 +394,19 @@ void StructureNodeImpl::writeXml( ImageFileImplSharedPtr imf, CheckedFile &cf, i xmlnsExtension = "xmlns:"; } - int index = static_cast( i ); + const int index = static_cast( i ); cf << "\n" - << space( indent + fieldName.length() + 2 ) << xmlnsExtension << imf->extensionsPrefix( index ) << "=\"" + << space( numSpaces ) << xmlnsExtension << imf->extensionsPrefix( index ) << "=\"" << imf->extensionsUri( index ) << "\""; } /// If user didn't explicitly declare a default namespace, use the current /// E57 standard one. if ( !gotDefaultNamespace ) - cf << "\n" << space( indent + fieldName.length() + 2 ) << "xmlns=\"" << E57_V1_0_URI << "\""; + { + cf << "\n" << space( numSpaces ) << "xmlns=\"" << E57_V1_0_URI << "\""; + } } if ( !children_.empty() ) {