[Python-modules-commits] r11915 - in packages/gamera/trunk/debian/patches (1 file)

jwilk at users.alioth.debian.org jwilk at users.alioth.debian.org
Wed Feb 24 12:44:04 UTC 2010


    Date: Wednesday, February 24, 2010 @ 12:44:02
  Author: jwilk
Revision: 11915

Replace fix-unaligned-access.diff with the one applied upstream.

Modified:
  packages/gamera/trunk/debian/patches/fix-unaligned-access.diff

Modified: packages/gamera/trunk/debian/patches/fix-unaligned-access.diff
===================================================================
--- packages/gamera/trunk/debian/patches/fix-unaligned-access.diff	2010-02-24 07:58:33 UTC (rev 11914)
+++ packages/gamera/trunk/debian/patches/fix-unaligned-access.diff	2010-02-24 12:44:02 UTC (rev 11915)
@@ -1,40 +1,36 @@
 Description: Fix unaligned memory access in the generated C code.
-Author: Jakub Wilk <jwilk at debian.org>
+Origin: upstream, http://gamera.svn.sourceforge.net/viewvc/gamera/trunk/gamera/gamera/generate.py?r1=1109&r2=1205&pathrev=1205
 Bug: http://tech.groups.yahoo.com/group/gamera-devel/message/1952
 Bug-Debian: http://bugs.debian.org/570953 
 
 Index: gamera-3.2.4/gamera/generate.py
 ===================================================================
 --- gamera-3.2.4.orig/gamera/generate.py	2009-07-03 17:21:42.000000000 +0200
-+++ gamera-3.2.4/gamera/generate.py	2010-02-23 13:25:19.000000000 +0100
-@@ -183,10 +183,23 @@
++++ gamera-3.2.4/gamera/generate.py	2010-02-24 13:36:37.000000000 +0100
+@@ -1,8 +1,8 @@
+ # -*- mode: python; indent-tabs-mode: nil; tab-width: 3 -*-
+ # vim: set tabstop=3 shiftwidth=3 expandtab:
+ #
+-# Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom,
+-#                          and Karl MacMillan
++# Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom, Karl MacMillan
++#               2010      Christoph Dalitz
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+@@ -183,10 +183,8 @@
  
        [[if function.feature_function]]
           feature_t* feature_buffer = 0;
 -         PyObject* str = 0;
-+         PyObject* array = 0;
           if (offset < 0) {
 -           str = PyString_FromStringAndSize(NULL, [[function.return_type.length]] * sizeof(feature_t));
 -           feature_buffer = (feature_t*)PyString_AsString(str);
-+           void* feature_buffer_v = 0;
-+           Py_ssize_t feature_buffer_len;
-+           PyObject *str = PyString_FromStringAndSize(NULL, [[function.return_type.length]] * sizeof(feature_t));
-+           if (str == 0)
-+             return 0;
-+           PyObject* array_init = get_ArrayInit();
-+           if (array_init != 0)
-+             array = PyObject_CallFunction(
-+               array_init, (char *)\"sO\", (char *)\"d\", str);
-+           Py_DECREF(str);
-+           if (array == 0)
-+             return 0;
-+           if (PyObject_AsWriteBuffer(array, &feature_buffer_v, &feature_buffer_len) < 0)
-+             return 0;
-+           feature_buffer = (feature_t*)feature_buffer_v;
++           feature_buffer = new feature_t[ [[function.return_type.length]] ];
           } else {
             if (self_arg->features_len < offset + [[function.return_type.length]]) {
               PyErr_Format(PyExc_ValueError, \"Offset as given (%d) will cause data to be written outside of array of length (%d).  Perhaps the feature array is not initialised?\", offset, (int)self_arg->features_len);
-@@ -212,14 +225,7 @@
+@@ -212,15 +210,22 @@
        [[end]]
  
        [[if function.feature_function]]
@@ -46,7 +42,23 @@
 -            PyObject* array = PyObject_CallFunction(
 -                  array_init, (char *)\"sO\", (char *)\"d\", str);
 -            Py_DECREF(str);
-+         if (array != 0) {
-             return array;
+-            return array;
++         if (offset < 0) {
++           PyObject* str = PyString_FromStringAndSize((char*)feature_buffer, [[function.return_type.length]] * sizeof(feature_t));
++           if (str != 0) {
++              [[# This is pretty expensive, but simple #]]
++              PyObject* array_init = get_ArrayInit();
++              if (array_init == 0)
++                return 0;
++              PyObject* array = PyObject_CallFunction(
++                    array_init, (char *)\"sO\", (char *)\"d\", str);
++              Py_DECREF(str);
++              delete[] feature_buffer;
++              return array;
++           } else {
++             delete[] feature_buffer;
++             return 0;
++           }
           } else {
             Py_INCREF(Py_None);
+            return Py_None;




More information about the Python-modules-commits mailing list