diff options
author | Armin Rigo <arigo@tunes.org> | 2012-07-28 13:03:38 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2012-07-28 13:03:38 +0200 |
commit | 7371d496bcd6c2803822ced2c99a182202e9ff26 (patch) | |
tree | 301f57c54b737fb785a4cb095c2569d4e9464a73 /demo | |
parent | 4b742387abadeb921d08b0b353e5c33bef489ccb (diff) | |
download | cffi-7371d496bcd6c2803822ced2c99a182202e9ff26.tar.gz |
Bah. Fix the demos for the updated way of 'ffi.new()'.
Diffstat (limited to 'demo')
-rw-r--r-- | demo/_curses.py | 2 | ||||
-rw-r--r-- | demo/btrfs-snap.py | 2 | ||||
-rw-r--r-- | demo/cffi-cocoa.py | 4 | ||||
-rw-r--r-- | demo/readdir.py | 4 | ||||
-rw-r--r-- | demo/readdir2.py | 4 | ||||
-rw-r--r-- | demo/xclient.py | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/demo/_curses.py b/demo/_curses.py index 369c63c..4b81b1f 100644 --- a/demo/_curses.py +++ b/demo/_curses.py @@ -210,7 +210,7 @@ def setupterm(term=ffi.NULL, fd=-1): if fd < 0: import sys fd = sys.stdout.fileno() - err = ffi.new("int") + err = ffi.new("int *") if lib.setupterm(term, fd, err) == ERR: if err[0] == 0: s = "setupterm: could not find terminal" diff --git a/demo/btrfs-snap.py b/demo/btrfs-snap.py index f166c5a..3224db4 100644 --- a/demo/btrfs-snap.py +++ b/demo/btrfs-snap.py @@ -36,7 +36,7 @@ source = os.open(opts.source, os.O_DIRECTORY) target = os.open(opts.target, os.O_DIRECTORY) -args = ffi.new('struct btrfs_ioctl_vol_args_v2') +args = ffi.new('struct btrfs_ioctl_vol_args_v2 *') args.name = opts.newname args.fd = source args_buffer = ffi.buffer(args) diff --git a/demo/cffi-cocoa.py b/demo/cffi-cocoa.py index b5f2a2c..9e86d99 100644 --- a/demo/cffi-cocoa.py +++ b/demo/cffi-cocoa.py @@ -60,8 +60,8 @@ NSApplicationActivationPolicyRegular = ffi.cast('NSApplicationActivationPolicy', NSTitledWindowMask = ffi.cast('NSUInteger', 1) NSBackingStoreBuffered = ffi.cast('NSBackingStoreType', 2) -NSMakePoint = lambda x, y: ffi.new('NSPoint', (x, y))[0] -NSMakeRect = lambda x, y, w, h: ffi.new('NSRect', ((x, y), (w, h)))[0] +NSMakePoint = lambda x, y: ffi.new('NSPoint *', (x, y))[0] +NSMakeRect = lambda x, y, w, h: ffi.new('NSRect *', ((x, y), (w, h)))[0] get, send, sel = objc.objc_getClass, objc.objc_msgSend, objc.sel_registerName at = lambda s: send( diff --git a/demo/readdir.py b/demo/readdir.py index 04e8cd8..15bc93d 100644 --- a/demo/readdir.py +++ b/demo/readdir.py @@ -40,8 +40,8 @@ def walk(basefd, path): # error in openat() return dir = ffi.C.fdopendir(dirfd) - dirent = ffi.new("struct dirent") - result = ffi.new("struct dirent *") + dirent = ffi.new("struct dirent *") + result = ffi.new("struct dirent **") while True: if ffi.C.readdir_r(dir, dirent, result): # error in readdir_r() diff --git a/demo/readdir2.py b/demo/readdir2.py index de92e91..f4646d8 100644 --- a/demo/readdir2.py +++ b/demo/readdir2.py @@ -47,8 +47,8 @@ def walk(basefd, path): # error in openat() return dir = ffi.C.fdopendir(dirfd) - dirent = ffi.new("struct dirent") - result = ffi.new("struct dirent *") + dirent = ffi.new("struct dirent *") + result = ffi.new("struct dirent **") while True: if ffi.C.readdir_r(dir, dirent, result): # error in readdir_r() diff --git a/demo/xclient.py b/demo/xclient.py index 87b6619..f511d33 100644 --- a/demo/xclient.py +++ b/demo/xclient.py @@ -4,7 +4,7 @@ ffi = FFI() ffi.cdef(""" typedef ... Display; -typedef ... Window; +typedef struct { ...; } Window; typedef struct { int type; ...; } XEvent; @@ -33,7 +33,7 @@ def main(): w = XCreateSimpleWindow(display, DefaultRootWindow(display), 10, 10, 500, 350, 0, 0, 0) XMapRaised(display, w) - event = ffi.new("XEvent") + event = ffi.new("XEvent *") XNextEvent(display, event) if __name__ == '__main__': |