summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordan <[email protected]>2023-04-14 20:52:39 -0400
committerdan <[email protected]>2023-04-14 20:52:39 -0400
commit8e0de102ce0b91cb15c2cbc735ff893acd027420 (patch)
tree6c72150ec5b7b0af1e9f659fa4e7d1c977f91434 /lib
parent889c58413b613d234e880007966fc38b262d77e2 (diff)
download54-8e0de102ce0b91cb15c2cbc735ff893acd027420.tar.gz
54-8e0de102ce0b91cb15c2cbc735ff893acd027420.tar.bz2
54-8e0de102ce0b91cb15c2cbc735ff893acd027420.zip
pw should actually be checked
Diffstat (limited to 'lib')
-rw-r--r--lib/exif_wrapper.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/exif_wrapper.cpp b/lib/exif_wrapper.cpp
index 21ee6c6..c4088ef 100644
--- a/lib/exif_wrapper.cpp
+++ b/lib/exif_wrapper.cpp
@@ -93,11 +93,31 @@ extern "C" void setExifOrientation(uint8_t* imgBytes, unsigned int size, unsigne
image->setExifData(exifData);
image->writeMetadata();
+
+ //TODO: fix problem of img file corruption caused by output being a different size
+ // to the input buffer
+
+ FILE *fileptr;
+ char *buffer;
+ long filelen;
+
+ fileptr = fopen(tmpFileName, "rb");
+ fseek(fileptr, 0, SEEK_END);
+ filelen = ftell(fileptr);
+ rewind(fileptr);
+
+ buffer = (char *)malloc(filelen * sizeof(char));
+ fread(buffer, filelen, 1, fileptr);
+ fclose(fileptr);
+
+ printf("new len: %ld old len: %d", filelen, size);
+
+
// reopen temp file, copy result back into byte array
- FILE* fileptr = fopen(tmpFileName, "rb");
+ fileptr = fopen(tmpFileName, "rb");
fread(imgBytes, size, 1, fileptr);
fclose(fileptr);
- unlink(tmpFileName);
+// unlink(tmpFileName);
}
catch (Exiv2::Error& e) {
std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";