Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/wrappers/ios/Sources/Wrapper/ZXIErrors.mm @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | b50eed0cc0ef |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 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 } |
