Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 193937 | Differences between
and this patch

Collapse All | Expand All

(-)kombilo05/matchC.cc~ (-8 / +16 lines)
Lines 842-857 Link Here
842
842
843
843
844
static PyObject* sortArray(PyObject* self, PyObject* args) {
844
static PyObject* sortArray(PyObject* self, PyObject* args) {
845
  
845
  PyObject* obj;
846
  long* a;
846
  void* buffer;
847
  Py_ssize_t buffer_len;
847
848
848
  unsigned long adr;
849
  long* a;
849
  long l, r;          // it's important that these are signed!
850
  long l, r;          // it's important that these are signed!
850
851
851
  if (!PyArg_ParseTuple(args, "lii", &adr, &l, &r))
852
  if (!PyArg_ParseTuple(args, "Oii", &obj, &l, &r))
852
    return NULL; 
853
    return NULL; 
854
  if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len))
855
    return NULL;
853
856
854
  a = (long*) adr;
857
  a = (long*) buffer;
855
  
858
  
856
  sortCArray(a, l, r);
859
  sortCArray(a, l, r);
857
  Py_INCREF(Py_None);
860
  Py_INCREF(Py_None);
Lines 860-872 Link Here
860
863
861
864
862
static PyObject* buildOutput(PyObject* self, PyObject* args) {
865
static PyObject* buildOutput(PyObject* self, PyObject* args) {
866
  PyObject* obj;
867
  void* buffer;
868
  Py_ssize_t buffer_len;
863
  
869
  
864
  long* a;
870
  long* a;
865
  unsigned long adr, length;
871
  unsigned long length;
866
  if (!PyArg_ParseTuple(args, "li", &adr, &length))
872
  if (!PyArg_ParseTuple(args, "Oi", &obj, &length))
867
    return NULL; 
873
    return NULL; 
874
  if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len))
875
    return NULL;
868
876
869
  a = (long*) adr;
877
  a = (long*) buffer;
870
878
871
  long *b = new long[length];
879
  long *b = new long[length];
872
  long bIndex = 0;
880
  long bIndex = 0;
(-)kombilo05/kombilo.py (-2 / +2 lines)
Lines 2131-2137 Link Here
2131
    def sort(self):
2131
    def sort(self):
2132
2132
2133
        if CimportSucceeded:
2133
        if CimportSucceeded:
2134
            matchC.sortArray(self.data.buffer_info()[0], 0, self.dataIndex/2-1)
2134
            matchC.sortArray(self.data, 0, self.dataIndex/2-1)
2135
        else:
2135
        else:
2136
            l = 0
2136
            l = 0
2137
            r = self.dataIndex/2 - 1
2137
            r = self.dataIndex/2 - 1
Lines 2179-2185 Link Here
2179
        self.sort()
2179
        self.sort()
2180
2180
2181
        if CimportSucceeded:
2181
        if CimportSucceeded:
2182
            hashT, hash = matchC.buildOutput(self.data.buffer_info()[0], self.dataIndex)
2182
            hashT, hash = matchC.buildOutput(self.data, self.dataIndex)
2183
            file = open(os.path.join(path[0], 'hashT' + path[1] + '.db'), 'wb')
2183
            file = open(os.path.join(path[0], 'hashT' + path[1] + '.db'), 'wb')
2184
            file.write(hashT)
2184
            file.write(hashT)
2185
            file.close()
2185
            file.close()

Return to bug 193937