Skip to content

Commit db0544b

Browse files
TomTascheandiwand
andauthored
Apply suggestions from code review
Co-authored-by: Andreas Stefl <stefl.andreas@gmail.com>
1 parent ae1a70b commit db0544b

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

OpenDocumentReader/CoreWrapper.mm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,19 @@ - (bool)translate:(NSString *)inputPath into:(NSString *)outputPath with:(NSStri
4747
auto inputPathC = [inputPath cStringUsingEncoding:NSUTF8StringEncoding];
4848
auto inputPathCpp = std::string(inputPathC);
4949

50-
odr::FileType fileType;
50+
std::vector<odr::FileType> fileTypes;
5151
try {
52-
const auto types = odr::OpenDocumentReader::types(inputPathCpp);
52+
fileTypes = odr::OpenDocumentReader::types(inputPathCpp);
5353
if (types.empty()) {
5454
_errorCode = @(-5);
5555
return false;
5656
}
57-
58-
fileType = types.back();
5957
} catch (odr::UnsupportedFileType &e) {
6058
_errorCode = @(-5);
6159
return false;
6260
}
6361

64-
const auto extensionCpp = odr::OpenDocumentReader::type_to_string(fileType);
65-
if (extensionCpp == "pdf") {
62+
if (fileTypes.find(odr::FileType::portable_document_format) != fileTypes.end()) {
6663
_errorCode = @(-5);
6764
return false;
6865
}

0 commit comments

Comments
 (0)