From 0fe905920f850129bc4b2b869d68d22bc6d568dc Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 2 Nov 2009 20:08:09 +0000 Subject: [PATCH] Changed "%zu" to "%"APR_SIZE_T_FMT on APR format calls, removed the accidental NSAutoreleasePool around individual ffi_call events, and enhanced todo list. --- Library.cpp | 2 +- ObjectiveC/Library.mm | 6 ++++-- sig/parse.cpp | 4 ++-- todo.txt | 8 ++++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Library.cpp b/Library.cpp index 383008a..0a8508e 100644 --- a/Library.cpp +++ b/Library.cpp @@ -539,7 +539,7 @@ static size_t Nonce_(0); static JSValueRef $cyq(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYPool pool; - const char *name(apr_psprintf(pool, "%s%zu", CYPoolCString(pool, context, arguments[0]), Nonce_++)); + const char *name(apr_psprintf(pool, "%s%"APR_SIZE_T_FMT"", CYPoolCString(pool, context, arguments[0]), Nonce_++)); return CYCastJSValue(context, name); } diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 1de5595..9c7bcc1 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1287,9 +1287,11 @@ JSValueRef CYObjectiveC_RuntimeProperty(JSContextRef context, CYUTF8String name) return NULL; } CYPoolCatch(NULL) return /*XXX*/ NULL; } -static void CYObjectiveC_CallFunction(JSContextRef context, ffi_cif *cif, void (*function)(), uint8_t *value, void **values) { CYPoolTry { +static void CYObjectiveC_CallFunction(JSContextRef context, ffi_cif *cif, void (*function)(), uint8_t *value, void **values) { @try { ffi_call(cif, function, value, values); -} CYPoolCatch() } +} @catch (NSException *error ) { + throw CYJSError(context, CYCastJSValue(context, error)); +} } static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, JSValueRef value) { CYPoolTry { switch (type->primitive) { diff --git a/sig/parse.cpp b/sig/parse.cpp index 9eac602..b8d16c3 100644 --- a/sig/parse.cpp +++ b/sig/parse.cpp @@ -265,11 +265,11 @@ const char *Unparse(apr_pool_t *pool, struct Type *type) { case array_P: { const char *value = Unparse(pool, type->data.data.type); - return apr_psprintf(pool, "[%zu%s]", type->data.data.size, value); + return apr_psprintf(pool, "[%"APR_SIZE_T_FMT"%s]", type->data.data.size, value); } break; case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type)); - case bit_P: return apr_psprintf(pool, "b%zu", type->data.data.size); + case bit_P: return apr_psprintf(pool, "b%"APR_SIZE_T_FMT"", type->data.data.size); case char_P: return "c"; case double_P: return "d"; case float_P: return "f"; diff --git a/todo.txt b/todo.txt index f61cb94..531b6a4 100644 --- a/todo.txt +++ b/todo.txt @@ -5,9 +5,17 @@ look into what String is, and whether to bridge it some JS callbacks don't use exception pointers at all... a newline needs to not be allowed after a unary * finish implementing default xml namespace statement +encode newlines in history for later reply (psql uses ^A) + consider replacing regex literals with constructors https://bugzilla.mozilla.org/show_bug.cgi?id=98409 numerification needs to use specific precision values https://bugzilla.mozilla.org/show_bug.cgi?id=5856 consider a mode where unicode string content is saved https://bugzilla.mozilla.org/show_bug.cgi?id=274152 + +cy# SBAwayController.sharedAwayController->_displayValues +"*** -[NSCFNumber length]: unrecognized selector sent to instance 0x4a4bda0" +b = []; for (x in a) b.push(x); <- crashes + +errors in another process aren't displayed; to fix this, parse errors should get converted to exceptions and thrown -- 2.45.2