Replaced all hardcoded error codes with ker... constants

This commit is contained in:
Dan Čermák
2018-02-16 00:26:50 +01:00
parent d897997b29
commit efe2ccdcb6
80 changed files with 747 additions and 747 deletions
+6 -6
View File
@@ -57,12 +57,12 @@ try {
FileIo fileIn(argv[1]);
if (fileIn.open() != 0) {
throw Error(9, fileIn.path(), strError());
throw Error(Exiv2::kerDataSourceOpenFailed, fileIn.path(), strError());
}
FileIo fileOut1(argv[2]);
if (fileOut1.open("w+b") != 0) {
throw Error(10, argv[2], "w+b", strError());
throw Error(Exiv2::kerFileOpenFailed, argv[2], "w+b", strError());
}
MemIo memIo1;
@@ -88,7 +88,7 @@ try {
// Create or overwrite the file, then close it
FileIo fileTest("iotest.txt");
if (fileTest.open("w+b") != 0) {
throw Error(10, "iotest.txt", "w+b", strError());
throw Error(Exiv2::kerFileOpenFailed, "iotest.txt", "w+b", strError());
}
fileTest.close();
@@ -100,7 +100,7 @@ try {
memIo2.seek(0, BasicIo::beg);
FileIo fileOut2(argv[3]);
if (fileOut2.open("w+b") != 0) {
throw Error(10, argv[3], "w+b", strError());
throw Error(Exiv2::kerFileOpenFailed, argv[3], "w+b", strError());
}
long readCount = 0;
@@ -138,7 +138,7 @@ int WriteReadSeek(BasicIo &io)
const size_t size2 = std::strlen(tester2) + 1;
if (io.open() != 0) {
throw Error(9, io.path(), strError());
throw Error(Exiv2::kerDataSourceOpenFailed, io.path(), strError());
}
IoCloser closer(io);
if ((size_t) io.write((byte*)tester1, (long)size1) != size1) {
@@ -201,7 +201,7 @@ int WriteReadSeek(BasicIo &io)
// open should seek to beginning
if (io.open() != 0) {
throw Error(9, io.path(), strError());
throw Error(Exiv2::kerDataSourceOpenFailed, io.path(), strError());
}
std::memset(buf, -1, sizeof(buf));
if ((size_t) io.read(buf, sizeof(buf)) != insert + size2) {