Works now with Windows Visual Studio C++ too
[owTools.git] / src / hexfile.cpp
index 32ce679..df45d46 100755 (executable)
@@ -53,13 +53,13 @@ hexFile::hexFile(std::string fname) {
         if (line[0]==':') {
                        //ss << std::hex << line.substr(1,2);
                        //ss >> bc;
-                       uint8_t bc=std::stoul( line.substr(1,2), nullptr, 16);
+                       uint8_t bc=(uint8_t)std::stoul( line.substr(1,2), nullptr, 16);
                        uint32_t fw=std::stoul(line.substr(3,4),nullptr, 16);
-                       uint8_t ty=std::stoul(line.substr(7,2),nullptr,16);
+                       uint8_t ty=(uint8_t)std::stoul(line.substr(7,2),nullptr,16);
                        uint32_t chsm = bc + (fw >> 8) + (fw & 0xFF) + ty;
                        for (int i = 0; i < bc; i++) {
                                int p = 9 + i * 2;
-                               uint8_t b = std::stoul(line.substr(p, 2),nullptr, 16);
+                               uint8_t b = (uint8_t)std::stoul(line.substr(p, 2),nullptr, 16);
                                chsm = chsm + b;
                                prog.push_back(b);
                        }