if (std::ferror(fp.get()))
throw std::logic_error("Failed to set the position as end [" + path + "].");
- unsigned int fsize = std::ftell(fp.get());
+ long fsize = std::ftell(fp.get());
+ if (fsize == -1L)
+ throw std::logic_error("Failed to get the position [" + path + "].");
+
std::fseek(fp.get(), 0L, SEEK_SET);
if (std::ferror(fp.get()))
throw std::logic_error("Failed to set the position as beginning [" + path + "].");
std::string buff(fsize, 0);
- if (fsize != std::fread(static_cast<void*>(&buff[0]), 1, fsize, fp.get()))
+ size_t rsize = std::fread(static_cast<void*>(&buff[0]), 1, fsize, fp.get());
+ if (rsize != static_cast<size_t>(fsize))
throw std::logic_error("Failed to read [" + path + "]");
return buff;
TEST_EXPECT(true, hash.compare(TEST_PEM_HASH) == 0);
} catch (const std::exception &e) {
std::cout << "std::exception occured." << e.what() << std::endl;
+ TEST_EXPECT(true, false);
} catch (...) {
std::cout << "Unknown exception occured." << std::endl;
+ TEST_EXPECT(true, false);
}
}
TEST_EXPECT(true, data.compare(TEST_PEM_DATA) == 0);
} catch (const std::exception &e) {
std::cout << "std::exception occured." << e.what() << std::endl;
+ TEST_EXPECT(true, false);
} catch (...) {
std::cout << "Unknown exception occured." << std::endl;
+ TEST_EXPECT(true, false);
}
}
{
int ret = test::util::connectSSL("https://google.com");
TEST_EXPECT(true, ret == 0);
-
- if (ret != 0)
- std::cout << "Check wifi connection.." << std::endl;
}
TESTCASE(TRUST_ANCHOR_LAUNCH)