From 03e840f3ecf292eabb58cea7cebb49267358c446 Mon Sep 17 00:00:00 2001 From: Haoyu Bai Date: Tue, 10 Feb 2009 14:21:43 +0000 Subject: [PATCH] changed the mapped 'SIZE' of buffer interface from the length of raw buffer to number of items in the buffer. So it would be easier to use with type other than 'char' git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11125 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 4 ++++ Lib/python/pybuffer.i | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 816c0a4e4..1b1352296 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,10 @@ Version 1.3.39 (in progress) ============================ +2008-02-08: bhy + Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from + the length of the buffer to the number of items in the buffer. + 2008-02-08: wsfulton Fix %feature not working for conversion operators, reported by Matt Sprague, for example: %feature("cs:methodmodifiers") operator bool "protected"; diff --git a/Lib/python/pybuffer.i b/Lib/python/pybuffer.i index 5acbb0aa4..121cd709f 100644 --- a/Lib/python/pybuffer.i +++ b/Lib/python/pybuffer.i @@ -21,7 +21,7 @@ %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum); } $1 = ($1_ltype) buf; - $2 = ($2_ltype) size; + $2 = ($2_ltype) (size/sizeof($*1_type)); } %enddef @@ -73,7 +73,7 @@ %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum); } $1 = ($1_ltype) buf; - $2 = ($2_ltype) size; + $2 = ($2_ltype) (size / sizeof($*1_type)); } %enddef