[commit] r2592 - in trunk: Doc GME/Parser
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Tue Apr 14 12:52:43 CDT 2015
Author: ksmyth
Date: Tue Apr 14 12:52:42 2015
New Revision: 2592
Log:
xme serialize/deserialize: use C locale for doubles
Modified:
trunk/Doc/README_in.txt
trunk/GME/Parser/MgaDumper.cpp
trunk/GME/Parser/MgaParser.cpp
trunk/GME/Parser/StdAfx.cpp
trunk/GME/Parser/StdAfx.h
Modified: trunk/Doc/README_in.txt
==============================================================================
--- trunk/Doc/README_in.txt Wed Apr 8 11:10:39 2015 (r2591)
+++ trunk/Doc/README_in.txt Tue Apr 14 12:52:42 2015 (r2592)
@@ -29,6 +29,7 @@
----------------------------------
- Binary compatibility with 11.12.2
- Fix bug where an instance of a library object would have IsLibObject == true after DetachFromArcheType() was called on it
+ - Fix bug where floating-point numbers in xmes files were not read correctly under non-English locales (error "Type mismatch")
Release Notes of Release 14.12.4
----------------------------------
Modified: trunk/GME/Parser/MgaDumper.cpp
==============================================================================
--- trunk/GME/Parser/MgaDumper.cpp Wed Apr 8 11:10:39 2015 (r2591)
+++ trunk/GME/Parser/MgaDumper.cpp Tue Apr 14 12:52:42 2015 (r2592)
@@ -1022,7 +1022,9 @@
{
double d;
COMTHROW( attribute->get_FloatValue(&d) );
- Format(data, _T("%.17g"), d);
+ wchar_t dblbuf[40];
+ _swprintf_s_l(dblbuf, sizeof(dblbuf) / sizeof(dblbuf[0]), L"%.17g", c_locale, d);
+ data = dblbuf;
break;
}
Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp Wed Apr 8 11:10:39 2015 (r2591)
+++ trunk/GME/Parser/MgaParser.cpp Tue Apr 14 12:52:42 2015 (r2592)
@@ -985,8 +985,9 @@
}
else
{
- v = val;
- COMTHROW( v.ChangeType(VT_R8) );
+ double doubleVal;
+ _swscanf_s_l(val, L"%lg", c_locale, &doubleVal);
+ v = doubleVal;
}
}
break;
Modified: trunk/GME/Parser/StdAfx.cpp
==============================================================================
--- trunk/GME/Parser/StdAfx.cpp Wed Apr 8 11:10:39 2015 (r2591)
+++ trunk/GME/Parser/StdAfx.cpp Tue Apr 14 12:52:42 2015 (r2592)
@@ -10,3 +10,5 @@
#import "MgaLib.tlb" implementation_only no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
#import "MgaUtilLib.tlb" implementation_only no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
+
+_locale_t c_locale = _create_locale(LC_ALL, "C");
Modified: trunk/GME/Parser/StdAfx.h
==============================================================================
--- trunk/GME/Parser/StdAfx.h Wed Apr 8 11:10:39 2015 (r2591)
+++ trunk/GME/Parser/StdAfx.h Tue Apr 14 12:52:42 2015 (r2592)
@@ -125,6 +125,7 @@
}
};
+extern _locale_t c_locale;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
More information about the gme-commit
mailing list