diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-10 17:14:14 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-10 17:14:14 +0300 |
commit | 373b40f0e9c4f72c3fd8c30c8cbbe22d557d58bd (patch) | |
tree | 5c94faddfa9f8cbca73ec5acd41c4ba428333360 | |
parent | add extern "C" { (diff) | |
download | aes-tools-373b40f0e9c4f72c3fd8c30c8cbbe22d557d58bd.tar.gz aes-tools-373b40f0e9c4f72c3fd8c30c8cbbe22d557d58bd.zip |
utils: bugfix
-rw-r--r-- | utils/aes128ecb_decrypt_file.cpp | 4 | ||||
-rw-r--r-- | utils/aes128ecb_encrypt_file.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/utils/aes128ecb_decrypt_file.cpp b/utils/aes128ecb_decrypt_file.cpp index 788118b..60b1546 100644 --- a/utils/aes128ecb_decrypt_file.cpp +++ b/utils/aes128ecb_decrypt_file.cpp @@ -25,7 +25,9 @@ namespace std::ifstream::pos_type get_file_size(const std::string& path) { - std::ifstream ifs(path, std::ifstream::binary | std::ifstream::ate); + std::ifstream ifs; + ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit); + ifs.open(path, std::ifstream::binary | std::ifstream::ate); return ifs.tellg(); } } diff --git a/utils/aes128ecb_encrypt_file.cpp b/utils/aes128ecb_encrypt_file.cpp index 407dd44..2e24f04 100644 --- a/utils/aes128ecb_encrypt_file.cpp +++ b/utils/aes128ecb_encrypt_file.cpp @@ -25,7 +25,9 @@ namespace std::ifstream::pos_type get_file_size(const std::string& path) { - std::ifstream ifs(path, std::ifstream::binary | std::ifstream::ate); + std::ifstream ifs; + ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit); + ifs.open(path, std::ifstream::binary | std::ifstream::ate); return ifs.tellg(); } } |