]> git.saurik.com Git - cycript.git/commitdiff
Make CYExecute take a CYUTF8String and fix the size shell game in Console's Run.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Apr 2010 01:11:12 +0000 (01:11 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Apr 2010 01:11:12 +0000 (01:11 +0000)
Console.cpp
Execute.cpp
Handler.mm
JavaScript.hpp

index 7f4f4549bb61d87f93e54211ac71b71eca16bb50..ae5802c87ee262481ed5ad6a2bc49eb2659beaa0 100644 (file)
@@ -136,7 +136,7 @@ static CYUTF8String Run(CYPool &pool, int client, CYUTF8String code) {
     if (client == -1) {
         mode_ = Running;
 #ifdef CY_EXECUTE
-        json = CYExecute(pool, code.data);
+        json = CYExecute(pool, code);
 #else
         json = NULL;
 #endif
@@ -145,8 +145,9 @@ static CYUTF8String Run(CYPool &pool, int client, CYUTF8String code) {
             size = strlen(json);
     } else {
         mode_ = Sending;
+        size = code.size;
         CYSendAll(client, &size, sizeof(size));
-        CYSendAll(client, code.data, size);
+        CYSendAll(client, code.data, code.size);
         mode_ = Waiting;
         CYRecvAll(client, &size, sizeof(size));
         if (size == _not(size_t))
index 6197bc9dfb08d98a1e3f08402194c2da928de441..e8ea4ae006674d8f348818c6805ee4431df3212c 100644 (file)
@@ -1199,7 +1199,7 @@ JSObjectRef CYGetGlobalObject(JSContextRef context) {
     return JSContextGetGlobalObject(context);
 }
 
-const char *CYExecute(apr_pool_t *pool, const char *code) {
+const char *CYExecute(apr_pool_t *pool, CYUTF8String code) {
     JSContextRef context(CYGetJSContext());
     JSValueRef exception(NULL), result;
 
index 833ebf3450cf165cd423d9edefba93f4b522fe60..01c3cbcbf8dd1a58f1f8f460a5d0c45f947a95c3 100644 (file)
@@ -74,7 +74,7 @@ struct CYExecute_ {
     CYExecute_ *execute(reinterpret_cast<CYExecute_ *>([value pointerValue]));
     const char *data(execute->data_);
     execute->data_ = NULL;
-    execute->data_ = CYExecute(execute->pool_, data);
+    execute->data_ = CYExecute(execute->pool_, CYUTF8String(data));
 }
 
 @end
index f5c487d5144928b789ae5d54b0d723f097f7b409..4dba607d77611b50077c852b7d7df76a2b0cd958 100644 (file)
@@ -69,7 +69,7 @@ JSGlobalContextRef CYGetJSContext();
 JSObjectRef CYGetGlobalObject(JSContextRef context);
 
 extern "C" void CYSetupContext(JSGlobalContextRef context);
-const char *CYExecute(apr_pool_t *pool, const char *code);
+const char *CYExecute(apr_pool_t *pool, CYUTF8String code);
 
 void CYSetArgs(int argc, const char *argv[]);