comparison mupdf-source/thirdparty/zxing-cpp/wrappers/ios/Sources/Wrapper/ZXIErrors.mm @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 // Copyright 2023 KURZ Digital Solutions GmbH
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 #import "ZXIErrors.h"
6
7 void SetNSError(NSError *__autoreleasing _Nullable* error,
8 NSInteger code,
9 const char* message) {
10 if (error == nil) {
11 return;
12 }
13 NSString *errorDescription = @"Unknown C++ error";
14 if (message && strlen(message) > 0) {
15 errorDescription = [NSString stringWithUTF8String: message];
16 if (errorDescription == nil) {
17 errorDescription = [NSString stringWithCString: message
18 encoding: NSASCIIStringEncoding];
19 }
20 }
21 NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: errorDescription };
22 *error = [NSError errorWithDomain:ZXIErrorDomain
23 code:code
24 userInfo:userInfo];
25 }