|
|
@ -114,9 +114,11 @@ char* floatToString( char* buf, float value, bool halfprecision, bool explicitZe |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
static const char* fmt = halfprecision ? "%.4e" : "%.8e"; |
|
|
|
|
|
|
|
char* ptr = buf; |
|
|
|
char* ptr = buf; |
|
|
|
sprintf( buf, fmt, value ); |
|
|
|
if (halfprecision) |
|
|
|
|
|
|
|
sprintf(buf, "%.4e", value); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
sprintf(buf, "%.8e", value); |
|
|
|
if( *ptr == '+' || *ptr == '-' ) |
|
|
|
if( *ptr == '+' || *ptr == '-' ) |
|
|
|
ptr++; |
|
|
|
ptr++; |
|
|
|
for( ; cv_isdigit(*ptr); ptr++ ) |
|
|
|
for( ; cv_isdigit(*ptr); ptr++ ) |
|
|
@ -350,6 +352,7 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
void init() |
|
|
|
void init() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
flags = 0; |
|
|
|
buffer.clear(); |
|
|
|
buffer.clear(); |
|
|
|
bufofs = 0; |
|
|
|
bufofs = 0; |
|
|
|
state = UNDEFINED; |
|
|
|
state = UNDEFINED; |
|
|
@ -358,6 +361,7 @@ public: |
|
|
|
write_mode = false; |
|
|
|
write_mode = false; |
|
|
|
mem_mode = false; |
|
|
|
mem_mode = false; |
|
|
|
space = 0; |
|
|
|
space = 0; |
|
|
|
|
|
|
|
wrap_margin = 71; |
|
|
|
fmt = 0; |
|
|
|
fmt = 0; |
|
|
|
file = 0; |
|
|
|
file = 0; |
|
|
|
gzfile = 0; |
|
|
|
gzfile = 0; |
|
|
@ -615,7 +619,8 @@ public: |
|
|
|
for(;;) |
|
|
|
for(;;) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int line_offset = (int)ftell( file ); |
|
|
|
int line_offset = (int)ftell( file ); |
|
|
|
char* ptr0 = gets( &xml_buf_[0], xml_buf_size ), *ptr; |
|
|
|
const char* ptr0 = this->gets(&xml_buf_[0], xml_buf_size ); |
|
|
|
|
|
|
|
const char* ptr = NULL; |
|
|
|
if( !ptr0 ) |
|
|
|
if( !ptr0 ) |
|
|
|
break; |
|
|
|
break; |
|
|
|
ptr = ptr0; |
|
|
|
ptr = ptr0; |
|
|
@ -708,7 +713,7 @@ public: |
|
|
|
const char* json_signature = "{"; |
|
|
|
const char* json_signature = "{"; |
|
|
|
const char* xml_signature = "<?xml"; |
|
|
|
const char* xml_signature = "<?xml"; |
|
|
|
char buf[16]; |
|
|
|
char buf[16]; |
|
|
|
gets( buf, sizeof(buf)-2 ); |
|
|
|
this->gets( buf, sizeof(buf)-2 ); |
|
|
|
char* bufPtr = cv_skip_BOM(buf); |
|
|
|
char* bufPtr = cv_skip_BOM(buf); |
|
|
|
size_t bufOffset = bufPtr - buf; |
|
|
|
size_t bufOffset = bufPtr - buf; |
|
|
|
|
|
|
|
|
|
|
@ -861,7 +866,7 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
char* gets() |
|
|
|
char* gets() |
|
|
|
{ |
|
|
|
{ |
|
|
|
char* ptr = gets(bufferStart(), (int)(bufferEnd() - bufferStart())); |
|
|
|
char* ptr = this->gets(bufferStart(), (int)(bufferEnd() - bufferStart())); |
|
|
|
if( !ptr ) |
|
|
|
if( !ptr ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ptr = bufferStart(); // FIXIT Why do we need this hack? What is about other parsers JSON/YAML?
|
|
|
|
ptr = bufferStart(); // FIXIT Why do we need this hack? What is about other parsers JSON/YAML?
|
|
|
@ -1766,11 +1771,13 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
FileStorage::FileStorage() |
|
|
|
FileStorage::FileStorage() |
|
|
|
|
|
|
|
: state(0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
p = makePtr<FileStorage::Impl>(this); |
|
|
|
p = makePtr<FileStorage::Impl>(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FileStorage::FileStorage(const String& filename, int flags, const String& encoding) |
|
|
|
FileStorage::FileStorage(const String& filename, int flags, const String& encoding) |
|
|
|
|
|
|
|
: state(0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
p = makePtr<FileStorage::Impl>(this); |
|
|
|
p = makePtr<FileStorage::Impl>(this); |
|
|
|
bool ok = p->open(filename.c_str(), flags, encoding.c_str()); |
|
|
|
bool ok = p->open(filename.c_str(), flags, encoding.c_str()); |
|
|
|