Permalink
Browse files

- Implement NPN_PostURLNotify, seems to help a lot of sites

- Make us compile against xcode 3.2 for generic certificats
- Remove some spew
- Remove some junk
  • Loading branch information...
Geoff Norton authored and comex committed Jul 5, 2010
1 parent c848002 commit c57e31b1de66fc672280834e34307e29c76ae272
Showing with 103 additions and 3,834 deletions.
  1. +8 −8 Player2/Player2.xcodeproj/project.pbxproj
  2. +61 −27 Player2/server.m
  3. +2 −2 food/Makefile
  4. +0 −1 food/TODO
  5. +1 −2 food/anp.cpp
  6. +1 −1 food/common.h
  7. +2 −2 food/fixups/cppfixups.cpp
  8. +0 −3,785 food/np.S
  9. +22 −1 food/np.c
  10. +1 −1 install
  11. +1 −1 libgcc/Makefile
  12. +1 −1 rpc/Makefile
  13. +2 −1 rpc/food.proto
  14. +1 −1 utils/Makefile
@@ -371,22 +371,22 @@
ARCHS = armv7;
CODE_SIGN_ENTITLEMENTS = Entitlements.plist;
CODE_SIGN_IDENTITY = "Don't Code Sign";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: comex";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_PREPROCESSOR_DEFINITIONS = "stream_t=int";
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO;
HEADER_SEARCH_PATHS = "${PROJECT_DIR}";
- OTHER_CODE_SIGN_FLAGS = "-gta";
+ OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = (
- "-F/var/sdk/System/Library/PrivateFrameworks",
+ "-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/System/Library/PrivateFrameworks",
"-framework",
IOSurface,
);
PREBINDING = NO;
- SDKROOT = iphoneos3.1.3;
+ SDKROOT = iphoneos3.2;
};
name = Debug;
};
@@ -396,7 +396,7 @@
ARCHS = armv7;
CODE_SIGN_ENTITLEMENTS = Entitlements.plist;
CODE_SIGN_IDENTITY = "Don't Code Sign";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: comex";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_PREPROCESSOR_DEFINITIONS = "stream_t=int";
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
@@ -405,14 +405,14 @@
GCC_WARN_UNUSED_VARIABLE = NO;
HEADER_SEARCH_PATHS = "${PROJECT_DIR}";
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
- OTHER_CODE_SIGN_FLAGS = "-gta";
+ OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = (
- "-F/var/sdk/System/Library/PrivateFrameworks",
+ "-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/System/Library/PrivateFrameworks",
"-framework",
IOSurface,
);
PREBINDING = NO;
- SDKROOT = iphoneos3.1.3;
+ SDKROOT = iphoneos3.2;
};
name = Release;
};
View
@@ -18,6 +18,7 @@
#include "server.h"
#import <Foundation/Foundation.h>
#include <unistd.h>
+#undef __BLOCKS__
#include <notify.h>
#include <QuartzCore/QuartzCore.h>
@@ -38,16 +39,21 @@ @interface URLDude : NSThread {
stream_t stream;
int rpc_fd;
NSURLConnection *connection;
- NSURLRequest *request;
+ NSMutableURLRequest *request;
BOOL shouldKeepRunning;
}
+
+@property (readonly) NSMutableURLRequest *request;
+
@end
@implementation URLDude
+
+@synthesize request;
- (id)initWithStream:(stream_t)stream_ URL:(NSURL *)url rpc_fd:(int)rpc_fd_ {
if(self = [super init]) {
stream = stream_;
rpc_fd = rpc_fd_;
- request = [[NSURLRequest alloc] initWithURL:url];
+ request = [[NSMutableURLRequest alloc] initWithURL:url];
}
return self;
@@ -65,7 +71,7 @@ - (void)main {
connection_all_done(rpc_fd, stream, false);
return;
} else {
- NSLog(@"FYI I made a connection %@", connection);
+ NSLog(@"FYI I made a connection %@", connection);
NSRunLoop *theRL = [NSRunLoop currentRunLoop];
shouldKeepRunning = YES;
while (shouldKeepRunning && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);
@@ -111,12 +117,12 @@ @implementation Server
static void error(int rpc_fd, int err) {
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
NSString *str;
if(err == 0) {
str = [NSString stringWithFormat:@"Unexpected error"];
} else if(err < 0) {
- str = [NSString stringWithFormat:@"Socket error: %s", strerror(-err)];
+ str = [NSString stringWithFormat:@"Socket error: %s", strerror(-err)];
} else {
str = [NSString stringWithFormat:@"Internal error: %d", err];
}
@@ -154,7 +160,7 @@ - (id)initWithDelegate:(id)delegate_ {
}
int big = 120000;
assert(!setsockopt(rpc_fd, SOL_SOCKET, SO_SNDBUF, &big, sizeof(big)));
- assert(!setsockopt(rpc_fd, SOL_SOCKET, SO_RCVBUF, &big, sizeof(big)));
+ assert(!setsockopt(rpc_fd, SOL_SOCKET, SO_RCVBUF, &big, sizeof(big)));
signal(SIGPIPE, SIG_IGN);
rpcserve(rpc_fd, error);
@@ -175,7 +181,7 @@ - (void)teardown {
}
if(rpc_source) {
- CFRunLoopRemoveSource(CFRunLoopGetMain(), rpc_source, kCFRunLoopCommonModes);
+ CFRunLoopRemoveSource(CFRunLoopGetMain(), rpc_source, kCFRunLoopCommonModes);
rpc_source = NULL;
}
if(rpc_fd) {
@@ -198,20 +204,20 @@ - (void)dealloc {
int set_sekrit(int rpc_fd, void *sekrit_, size_t sekrit_len) {
Server *self = get_server(rpc_fd);
- NSLog(@"sekrit: %s", sekrit_);
+ NSLog(@"sekrit: %s", sekrit_);
if(!self->sekrit) self->sekrit = sekrit_;
return 0;
}
int abort_msg(int rpc_fd, void *message, size_t message_len) {
Server *self = get_server(rpc_fd);
- NSString *str = [[[NSString alloc] initWithBytes:message length:message_len encoding:NSUTF8StringEncoding] autorelease];
+ NSString *str = [[[NSString alloc] initWithBytes:message length:message_len encoding:NSUTF8StringEncoding] autorelease];
[self dieWithError:str];
return 0;
}
int use_surface(int rpc_fd, int surface) {
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
IOSurfaceRef sfc = IOSurfaceLookup(surface);
if(!sfc) return 1;
[self->delegate performSelector:@selector(useSurface:) withObject:(id)sfc];
@@ -225,16 +231,41 @@ int display_sync(int rpc_fd, int l, int t, int r, int b) {
return 0;
}
-int new_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, void **url_abs, size_t *url_abs_len) {
+int new_post_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, bool isfile, void *buf, size_t buf_len, void **url_abs, size_t *url_abs_len) {
+ Server *self = get_server(rpc_fd);
+ NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
+ NSURL *nsurl = [NSURL URLWithString:str relativeToURL:[self->delegate baseURL]];
+
+ NSLog(@"posting %i bytes to %s", buf_len, (char *)url);
+ if(target_len > 0) {
+ // This is even more wrong for posts, what should we do here?
+ NSLog(@"new_post_connection: with target %s -- ignoring", target);
+ }
+
+ NSString *abs = [nsurl absoluteString];
+ NSData *data = [abs dataUsingEncoding:NSUTF8StringEncoding];
+ *url_abs = (void *) [data bytes];
+ *url_abs_len = [data length];
+ URLDude *dude = [[URLDude alloc] initWithStream:stream URL:nsurl rpc_fd:rpc_fd];
+ [dude.request setHTTPMethod:@"POST"];
+ [dude.request setHTTPBody:[NSData dataWithContentsOfFile:[[[NSString alloc] initWithBytes:buf length:buf_len encoding:NSUTF8StringEncoding] autorelease]]];
+ [dude start];
+ [dude autorelease];
+ free(target);
+ free(url);
+ return 0;
+}
+
+int new_get_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, void **url_abs, size_t *url_abs_len) {
Server *self = get_server(rpc_fd);
- NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
+ NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
NSURL *nsurl = [NSURL URLWithString:str
- relativeToURL:[self->delegate baseURL]];
+ relativeToURL:[self->delegate baseURL]];
if(target_len > 0) {
// This is wrong.
NSLog(@"new_connection with target %s", target);
- NSString *str2 = [[[NSString alloc] initWithBytes:target length:target_len encoding:NSUTF8StringEncoding] autorelease];
+ NSString *str2 = [[[NSString alloc] initWithBytes:target length:target_len encoding:NSUTF8StringEncoding] autorelease];
[self->delegate performSelector:@selector(goToURL:inFrame:) withObject:nsurl withObject:str2];
*url_abs = url;
*url_abs_len = url_len;
@@ -257,15 +288,17 @@ int new_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void
NSData *data = [abs dataUsingEncoding:NSUTF8StringEncoding];
*url_abs = (void *) [data bytes];
*url_abs_len = [data length];
- [[[[URLDude alloc] initWithStream:stream URL:nsurl rpc_fd:rpc_fd] autorelease] start];
+ URLDude *dude = [[URLDude alloc] initWithStream:stream URL:nsurl rpc_fd:rpc_fd];
+ [dude start];
+ [dude autorelease];
free(target);
free(url);
return 0;
}
int get_parameters(int rpc_fd, void **params, size_t *params_len, int *params_count) {
NSLog(@"GET_PARAMETERS");
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
NSDictionary *dict = [self->delegate performSelector:@selector(paramsDict)];
*params_count = [dict count];
@@ -275,7 +308,7 @@ int get_parameters(int rpc_fd, void **params, size_t *params_len, int *params_co
[data appendData:[key dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:nullo];
[data appendData:[[dict objectForKey:key] dataUsingEncoding:NSUTF8StringEncoding]];
- [data appendData:nullo];
+ [data appendData:nullo];
}
*params = (void *) [data bytes];
@@ -303,9 +336,9 @@ - (id)objectForName:(int)name {
}
int get_string_value(int rpc_fd, int obj, bool *valid, void **value, size_t *value_len) {
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
NSString *str = [self objectForName:obj];
- NSLog(@"get_string_value %@", str);
+ NSLog(@"get_string_value %@", str);
if([str isKindOfClass:[NSString class]]) {
*valid = true;
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
@@ -319,8 +352,8 @@ int get_string_value(int rpc_fd, int obj, bool *valid, void **value, size_t *val
}
int get_object_property(int rpc_fd, int obj, void *property, size_t property_len, int *obj2) {
- Server *self = get_server(rpc_fd);
- if(![self->delegate performSelector:@selector(isOn)]) return 1;
+ Server *self = get_server(rpc_fd);
+ if(![self->delegate performSelector:@selector(isOn)]) return 1;
NSString *str = [[NSString alloc] initWithBytes:property length:property_len encoding:NSUTF8StringEncoding];
id base = [self objectForName:obj];
id prop = [base valueForKey:str];
@@ -332,13 +365,13 @@ int get_object_property(int rpc_fd, int obj, void *property, size_t property_len
}
int get_string_object(int rpc_fd, void *string, size_t string_len, int *obj2) {
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
*obj2 = [self nameForObject:[[[NSString alloc] initWithBytes:string length:string_len encoding:NSUTF8StringEncoding] autorelease]];
return 0;
}
int get_int_object(int rpc_fd, int theint, int *obj2) {
- Server *self = get_server(rpc_fd);
+ Server *self = get_server(rpc_fd);
*obj2 = [self nameForObject:[NSNumber numberWithInt:theint]];
return 0;
}
@@ -371,16 +404,17 @@ int invoke_object_property(int rpc_fd, int obj, void *property, size_t property_
NSLog(@"Invocation returned undefined");
ret = nil;
}*/
- NSLog(@"%@[%@](%@) = %@", base, str, array, ret);
- [str release];
+ NSLog(@"%@[%@](%@) = %@", base, str, array, ret);
+ [str release];
*obj2 = [self nameForObject:ret];
return 0;
}
int get_window_object(int rpc_fd, int *obj) {
+ NSLog(@"Getting window object");
Server *self = get_server(rpc_fd);
- if(![self->delegate performSelector:@selector(isOn)]) return 1;
+ if(![self->delegate performSelector:@selector(isOn)]) return 1;
id windowObject = [self->delegate performSelector:@selector(getWindowObject)]; // windowScriptObject
*obj = [self nameForObject:windowObject];
NSLog(@"Getting window object %@ -> %d", windowObject, *obj);
@@ -389,7 +423,7 @@ int get_window_object(int rpc_fd, int *obj) {
int evaluate_web_script(int rpc_fd, void *script, size_t script_len, int *obj) {
Server *self = get_server(rpc_fd);
- NSString *str = [[NSString alloc] initWithBytes:script length:script_len encoding:NSUTF8StringEncoding];
+ NSString *str = [[NSString alloc] initWithBytes:script length:script_len encoding:NSUTF8StringEncoding];
id resultObject = [self->delegate performSelector:@selector(evaluateWebScript:) withObject:str];
*obj = [self nameForObject:resultObject];
[str release];
View
@@ -1,8 +1,8 @@
-export SDK := /var/sdk
+export SDK := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/
all: food food_wrapper
-STUFF = -mthumb -Wreturn-type -Wall -DHAVE_MACOSX_IPC -DOS_PATH_SEPARATOR="'/'" -DHAVE_PTHREADS -DHAVE_POSIX_FILEMAP -DHAVE_LITTLE_ENDIAN -I. -I../rpc -I../utils -I../utils/libcutils -isysroot $(SDK) -arch armv7 -ffixed-r9 -Werror -Wno-uninitialized -g3 -O2
+STUFF = -mthumb -Wreturn-type -Wall -DHAVE_MACOSX_IPC -DOS_PATH_SEPARATOR="'/'" -DHAVE_PTHREADS -DHAVE_POSIX_FILEMAP -DHAVE_LITTLE_ENDIAN -I. -I../rpc -I../utils -I../utils/libcutils -isysroot $(SDK) -arch armv7 -ffixed-r9 -Wno-uninitialized -g3 -O2
DEBUG = 1
#ifeq "$(DEBUG)" "1"
View
@@ -3,5 +3,4 @@
- invocation arguments
- make it think it's fullscreen or otherwise fix mouse
- overzoom
-- missing npfunctions (NPN_PostURLNotify)
- Figure out bad canvas_impl (CRAP error)
View
@@ -851,8 +851,7 @@ struct ANPCanvas {
ANPCanvas* canvas_impl_newCanvas(ANPBitmap *bitmap) {
ANPCanvas *result = new ANPCanvas;
- notice("width:%d height:%d baseAddr:%p rowBytes:%d format:%d", bitmap->width, bitmap->height, bitmap->baseAddr, bitmap->rowBytes, bitmap->format);
-
+ notice("bitmap: %p width:%d height:%d baseAddr:%p rowBytes:%d format:%d", bitmap, bitmap->width, bitmap->height, bitmap->baseAddr, bitmap->rowBytes, bitmap->format);
//_assert(bitmap->format == kRGBA_8888_ANPBitmapFormat);
if(bitmap->format != kRGBA_8888_ANPBitmapFormat) {
View
@@ -105,7 +105,7 @@ extern int movie_w, movie_h, pending_movie_w, pending_movie_h;
#define logreal(fmt, args...) logreal_(CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR(fmt), ##args))
#define logx(level, args...) (LOG_LEVEL >= (level) ? (logreal(args)) : (void)0)
-#define LOG_LEVEL 1
+#define LOG_LEVEL 0
#define warn(args...) logx(2, args)
#define notice(args...) logx(3, args)
#define log(args...) logx(1, args)
@@ -152,11 +152,11 @@ sp<OMXCodec> OMXCodec::Create(
extern "C" {
void *_Znwj(unsigned int a) {
- fprintf(stderr, "operator new: %u\n", a);
+ //fprintf(stderr, "operator new: %u\n", a);
return (operator new)((unsigned long)a);
}
void *_Znaj(unsigned int a) {
- fprintf(stderr, "operator new[]: %u\n", a);
+ //fprintf(stderr, "operator new[]: %u\n", a);
return (operator new[])((unsigned long)a);
}
}
Oops, something went wrong.

0 comments on commit c57e31b

Please sign in to comment.