]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
Correctly check for old and new format in when reading wavelength
authorMichal Malý <malymi@natur.cuni.cz>
Wed, 10 Feb 2016 19:25:31 +0000 (20:25 +0100)
committerMichal Malý <malymi@natur.cuni.cz>
Wed, 10 Feb 2016 19:25:31 +0000 (20:25 +0100)
libhpcs.c

index 13a353add67c561e38d6e30342bfd93f0cb7c7de..7a48a9254e82136d9730fe7fa8b5359f27b92a03 100644 (file)
--- a/libhpcs.c
+++ b/libhpcs.c
@@ -522,7 +522,7 @@ static enum HPCS_ParseCode read_dad_wavelength(FILE* datafile, struct HPCS_Wavel
        measured->interval = 0;
        reference->wavelength = 0;
        reference->interval = 0;
-       pret = read_string_at_offset(datafile, devsig_info_offset, &str, gentype);
+       pret = read_string_at_offset(datafile, devsig_info_offset, &str, OLD_FORMAT(gentype));
        if (pret != PARSE_OK)
                return pret;
 
@@ -1261,7 +1261,7 @@ static enum HPCS_ParseCode __win32_latin1_to_utf8(char** target, const char *s)
        wchar_t* intermediate;
        size_t mb_size;
 
-       size_t w_size = MultiByteToWideChar(28591, MB_ERR_INVALID_CHARS, s, -1, NULL, 0);
+       size_t w_size = MultiByteToWideChar(28591, MB_COMPOSITE, s, -1, NULL, 0);
        if (w_size == 0) {
                PR_DEBUGF("Count MultiByteToWideChar() error 0x%x\n", GetLastError());
                return PARSE_E_INTERNAL;
@@ -1272,7 +1272,7 @@ static enum HPCS_ParseCode __win32_latin1_to_utf8(char** target, const char *s)
        if (intermediate == NULL)
                return PARSE_E_NO_MEM;
 
-       if (MultiByteToWideChar(28591, MB_ERR_INVALID_CHARS, s, -1, intermediate, 0) == 0) {
+       if (MultiByteToWideChar(28591, MB_COMPOSITE, s, -1, intermediate, 0) == 0) {
                PR_DEBUGF("Convert MultiByteToWideChar() error 0x%x\n", GetLastError());
                return PARSE_E_INTERNAL;
        }