summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-11-15 16:00:23 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2010-11-15 23:17:10 -0800
commit90c63676529c30063994aa4e2650754f8ca4856c (patch)
tree02a5c028965c400fcd8ef23539e6cb5bab9611d5
parentc626a63f510ec0bcca2fa3f4b4c506ef2f507270 (diff)
Make CFCString() accept non-UTF8 data without horrible error.
-rw-r--r--MobileCydia.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 8b0ae70..03d76f5 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1070,7 +1070,11 @@ NSString *SizeString(double size) {
}
static _finline CFStringRef CFCString(const char *value) {
- return CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const uint8_t *>(value), strlen(value), kCFStringEncodingUTF8, NO, kCFAllocatorNull);
+ size_t size(strlen(data));
+
+ return
+ CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const uint8_t *>(data), size, kCFStringEncodingUTF8, NO, kCFAllocatorNull) ?:
+ CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const uint8_t *>(data), size, kCFStringEncodingISOLatin1, NO, kCFAllocatorNull);
}
const char *StripVersion_(const char *version) {