aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/MD5.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-09-26 20:36:04 +0200
committerJay Berkenbilt <ejb@ql.org>2009-09-26 20:36:04 +0200
commitf3d7c26de1f575a14017a161ad1fdd2b93385e03 (patch)
tree065d6b0e12534a7371974bfb17e77c91d7b217d6 /libqpdf/MD5.cc
parent64546cfa0ddc2cf4c91e0865e979947c6b20ca46 (diff)
downloadqpdf-f3d7c26de1f575a14017a161ad1fdd2b93385e03.tar.zst
removed qexc; non-compatible ABI change
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/MD5.cc')
-rw-r--r--libqpdf/MD5.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc
index b05afa8b..8f6f7ecd 100644
--- a/libqpdf/MD5.cc
+++ b/libqpdf/MD5.cc
@@ -28,6 +28,7 @@
/////////////////////////////////////////////////////////////////////////
#include <qpdf/MD5.hh>
+#include <qpdf/QUtil.hh>
#include <stdio.h>
#include <memory.h>
@@ -330,15 +331,12 @@ void MD5::encodeDataIncrementally(char const* data, int len)
DLL_EXPORT
void MD5::encodeFile(char const *filename, int up_to_size)
- throw (QEXC::System)
{
- FILE *file;
unsigned char buffer[1024];
- if ((file = fopen (filename, "rb")) == NULL)
- {
- throw QEXC::System(std::string("MD5: can't open ") + filename, errno);
- }
+ FILE *file = QUtil::fopen_wrapper(
+ std::string("MD5: open ") + filename,
+ fopen(filename, "rb"));
int len;
int so_far = 0;
@@ -365,7 +363,8 @@ void MD5::encodeFile(char const *filename, int up_to_size)
// Assume, perhaps incorrectly, that errno was set by the
// underlying call to read....
(void) fclose(file);
- throw QEXC::System(std::string("MD5: read error on ") + filename, errno);
+ QUtil::throw_system_error(
+ std::string("MD5: read error on ") + filename);
}
(void) fclose(file);
@@ -446,7 +445,7 @@ MD5::checkFileChecksum(char const* const checksum,
std::string actual_checksum = getFileChecksum(filename, up_to_size);
result = (checksum == actual_checksum);
}
- catch (QEXC::System)
+ catch (std::runtime_error)
{
// Ignore -- return false
}