if (client == -1) {
mode_ = Running;
#ifdef CY_EXECUTE
- json = CYExecute(pool, code.data);
+ json = CYExecute(pool, code);
#else
json = NULL;
#endif
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))
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;
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
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[]);