mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +02:00
Added error message to float parser
This commit is contained in:
parent
4b9ddbc260
commit
1ba6026a85
1 changed files with 11 additions and 8 deletions
|
@ -16,12 +16,20 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
inline float atof_locale_independent(char *str) {
|
||||
#include <memory.h>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <hfm/ModelFormatLogging.h>
|
||||
#include <hfm/HFMSerializer.h>
|
||||
|
||||
static float atof_locale_independent(char *str) {
|
||||
//TODO: Once we have C++17 we can use std::from_chars
|
||||
std::istringstream streamToParse(str);
|
||||
streamToParse.imbue(std::locale("C"));
|
||||
float value = 0.0f;
|
||||
streamToParse >> value;
|
||||
float value;
|
||||
if(!(streamToParse >> value)) {
|
||||
qDebug(modelformat) << "cgltf: Cannot parse float from string: " << str;
|
||||
return 0.0f;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -29,11 +37,6 @@ inline float atof_locale_independent(char *str) {
|
|||
|
||||
#include "cgltf.h"
|
||||
|
||||
#include <memory.h>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <hfm/ModelFormatLogging.h>
|
||||
#include <hfm/HFMSerializer.h>
|
||||
|
||||
|
||||
class GLTFSerializer : public QObject, public HFMSerializer {
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Reference in a new issue