Merge pull request #1290 from assimp/issue_1244

closes https://github.com/assimp/assimp/issues/1244: log error for
pull/1291/head
Kim Kulling 2017-05-31 22:25:46 +02:00 committed by GitHub
commit 3d088e5d90
2 changed files with 10 additions and 17 deletions

View File

@ -289,7 +289,6 @@ size_t ObjFileParser::getNumComponentsInDataDefinition() {
const char* tmp( &m_DataIt[0] );
bool end_of_definition = false;
while ( !end_of_definition ) {
//while( !IsLineEnd( *tmp ) ) {
if ( isDataDefinitionEnd( tmp ) ) {
tmp += 2;
} else if ( IsLineEnd( *tmp ) ) {
@ -420,10 +419,6 @@ static const std::string DefaultObjName = "defaultobject";
// -------------------------------------------------------------------
// Get values for a new face instance
void ObjFileParser::getFace( aiPrimitiveType type ) {
//copyNextLine(m_buffer, Buffersize);
//char *pPtr = m_DataIt;
//char *pPtr = m_buffer;
//char *pEnd = &pPtr[Buffersize];
m_DataIt = getNextToken<DataArrayIt>( m_DataIt, m_DataItEnd );
if ( m_DataIt == m_DataItEnd || *m_DataIt == '\0' ) {
return;
@ -595,15 +590,6 @@ void ObjFileParser::getMaterialDesc() {
// Get a comment, values will be skipped
void ObjFileParser::getComment() {
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
/* while (m_DataIt != m_DataItEnd) {
if ( '\n' == (*m_DataIt)) {
++m_DataIt;
break;
} else {
++m_DataIt;
}
}*/
}
// -------------------------------------------------------------------

View File

@ -1,3 +1,5 @@
#pragma once
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
@ -22,6 +24,7 @@
#include <assimp/defs.h>
#include "StringComparison.h"
#include <assimp/DefaultLogger.hpp>
#ifdef _MSC_VER
@ -192,7 +195,7 @@ inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int*
uint64_t value = 0;
if ( *in < '0' || *in > '9' )
throw std::invalid_argument(std::string("The string \"") + in + "\" cannot be converted into a value.");
throw std::invalid_argument(std::string("The string \"") + in + "\" cannot be converted into a value.");
bool running = true;
while ( running )
@ -202,8 +205,12 @@ inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int*
const uint64_t new_value = ( value * 10 ) + ( *in - '0' );
if (new_value < value) /* numeric overflow, we rely on you */
throw std::overflow_error(std::string("Converting the string \"") + in + "\" into a value resulted in overflow.");
// numeric overflow, we rely on you
if ( new_value < value ) {
DefaultLogger::get()->warn( std::string( "Converting the string \"" ) + in + "\" into a value resulted in overflow." );
return 0;
}
//throw std::overflow_error();
value = new_value;