Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 16, 2024
Changing Decoder_readPyString in context.c to:

   static PyObject* Decoder_readPyString(DecoderObj *self, int len)
   {
       if (self->int_buf) {
          return Buffer_readPyString((BufferObj*)self->buf, len); 
       }

       PyObject *tmp = self->_buf_str;
       PyObject *py_len = PyInt_FromLong((long)len);
       if (!py_len)
           return NULL;
       self->_buf_str = PyObject_CallMethodObjArgs(self->buf, self->read_name, py_len, NULL);

       int buf_len = PyString_Size(self->_buf_str);
       if (buf_len < len){
          char error_str[100];
          sprintf(error_str, "Attempted to read %d bytes. Received %d", len, buf_len);
          PyErr_SetString(amfast_ContextError, error_str);
          return NULL;
       }

       char *buf_str = PyString_AsString(self->_buf_str);

       Py_DECREF(py_len);
       Py_XDECREF(tmp); // Decrement reference to OLD string.
       return self->_buf_str;
   }

May fix the issue. I'm not familiar enough with the code to know about any 
side-effects this may cause.

Original comment by [email protected] on 19 Apr 2012 at 11:05

from amfast.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 16, 2024
thanks for the code submission.

What is the purpose of the following line?

char *buf_str = PyString_AsString(self->_buf_str);

Original comment by [email protected] on 21 Apr 2012 at 3:55

from amfast.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 16, 2024
Hi,

That line is probably an error, I'm not the most proficient c coder

Original comment by [email protected] on 21 Apr 2012 at 4:56

from amfast.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 16, 2024
I made a couple of changes to your code and pushed the change to trunk.

Original comment by [email protected] on 22 Apr 2012 at 9:54

  • Changed state: Fixed

from amfast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.