Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining MSVC warnings #36

Merged
merged 3 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/CheckedFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#endif

#include <cmath>
#include <cstdio>
#include <cstring>
#include <fcntl.h>

Expand All @@ -67,10 +68,6 @@
#define O_BINARY ( 0 )
#endif

#ifndef _unlink
#define _unlink unlink
#endif

using namespace e57;
using namespace std;

Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions src/SourceDestBufferImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ template <typename T> 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<float *>( p ) = inValue;
#pragma warning( default : C4244 )
#pragma warning( default : 4244 )
#else
*reinterpret_cast<float *>( p ) = inValue;
#endif
Expand Down
10 changes: 7 additions & 3 deletions src/StructureNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ void StructureNodeImpl::writeXml( ImageFileImplSharedPtr imf, CheckedFile &cf, i

cf << space( indent ) << "<" << fieldName << " type=\"Structure\"";

const int numSpaces = indent + static_cast<int>( 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
Expand All @@ -392,17 +394,19 @@ void StructureNodeImpl::writeXml( ImageFileImplSharedPtr imf, CheckedFile &cf, i
xmlnsExtension = "xmlns:";
}

int index = static_cast<int>( i );
const int index = static_cast<int>( 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() )
{
Expand Down