| /* Generated by Cython 0.14.1 on Mon Feb 28 08:49:13 2011 */ |
| |
| #define PY_SSIZE_T_CLEAN |
| #include "Python.h" |
| #ifndef Py_PYTHON_H |
| #error Python headers needed to compile C extensions, please install development version of Python. |
| #else |
| |
| #include <stddef.h> /* For offsetof */ |
| #ifndef offsetof |
| #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) |
| #endif |
| |
| #if !defined(WIN32) && !defined(MS_WINDOWS) |
| #ifndef __stdcall |
| #define __stdcall |
| #endif |
| #ifndef __cdecl |
| #define __cdecl |
| #endif |
| #ifndef __fastcall |
| #define __fastcall |
| #endif |
| #endif |
| |
| #ifndef DL_IMPORT |
| #define DL_IMPORT(t) t |
| #endif |
| #ifndef DL_EXPORT |
| #define DL_EXPORT(t) t |
| #endif |
| |
| #ifndef PY_LONG_LONG |
| #define PY_LONG_LONG LONG_LONG |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02040000 |
| #define METH_COEXIST 0 |
| #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) |
| #define PyDict_Contains(d,o) PySequence_Contains(d,o) |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02050000 |
| typedef int Py_ssize_t; |
| #define PY_SSIZE_T_MAX INT_MAX |
| #define PY_SSIZE_T_MIN INT_MIN |
| #define PY_FORMAT_SIZE_T "" |
| #define PyInt_FromSsize_t(z) PyInt_FromLong(z) |
| #define PyInt_AsSsize_t(o) PyInt_AsLong(o) |
| #define PyNumber_Index(o) PyNumber_Int(o) |
| #define PyIndex_Check(o) PyNumber_Check(o) |
| #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02060000 |
| #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) |
| #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
| #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) |
| #define PyVarObject_HEAD_INIT(type, size) \ |
| PyObject_HEAD_INIT(type) size, |
| #define PyType_Modified(t) |
| |
| typedef struct { |
| void *buf; |
| PyObject *obj; |
| Py_ssize_t len; |
| Py_ssize_t itemsize; |
| int readonly; |
| int ndim; |
| char *format; |
| Py_ssize_t *shape; |
| Py_ssize_t *strides; |
| Py_ssize_t *suboffsets; |
| void *internal; |
| } Py_buffer; |
| |
| #define PyBUF_SIMPLE 0 |
| #define PyBUF_WRITABLE 0x0001 |
| #define PyBUF_FORMAT 0x0004 |
| #define PyBUF_ND 0x0008 |
| #define PyBUF_STRIDES (0x0010 | PyBUF_ND) |
| #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) |
| #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) |
| #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) |
| #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) |
| |
| #endif |
| |
| #if PY_MAJOR_VERSION < 3 |
| #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" |
| #else |
| #define __Pyx_BUILTIN_MODULE_NAME "builtins" |
| #endif |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define Py_TPFLAGS_CHECKTYPES 0 |
| #define Py_TPFLAGS_HAVE_INDEX 0 |
| #endif |
| |
| #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) |
| #define Py_TPFLAGS_HAVE_NEWBUFFER 0 |
| #endif |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define PyBaseString_Type PyUnicode_Type |
| #define PyStringObject PyUnicodeObject |
| #define PyString_Type PyUnicode_Type |
| #define PyString_Check PyUnicode_Check |
| #define PyString_CheckExact PyUnicode_CheckExact |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02060000 |
| #define PyBytesObject PyStringObject |
| #define PyBytes_Type PyString_Type |
| #define PyBytes_Check PyString_Check |
| #define PyBytes_CheckExact PyString_CheckExact |
| #define PyBytes_FromString PyString_FromString |
| #define PyBytes_FromStringAndSize PyString_FromStringAndSize |
| #define PyBytes_FromFormat PyString_FromFormat |
| #define PyBytes_DecodeEscape PyString_DecodeEscape |
| #define PyBytes_AsString PyString_AsString |
| #define PyBytes_AsStringAndSize PyString_AsStringAndSize |
| #define PyBytes_Size PyString_Size |
| #define PyBytes_AS_STRING PyString_AS_STRING |
| #define PyBytes_GET_SIZE PyString_GET_SIZE |
| #define PyBytes_Repr PyString_Repr |
| #define PyBytes_Concat PyString_Concat |
| #define PyBytes_ConcatAndDel PyString_ConcatAndDel |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02060000 |
| #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) |
| #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) |
| #endif |
| #ifndef PySet_CheckExact |
| #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) |
| #endif |
| |
| #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define PyIntObject PyLongObject |
| #define PyInt_Type PyLong_Type |
| #define PyInt_Check(op) PyLong_Check(op) |
| #define PyInt_CheckExact(op) PyLong_CheckExact(op) |
| #define PyInt_FromString PyLong_FromString |
| #define PyInt_FromUnicode PyLong_FromUnicode |
| #define PyInt_FromLong PyLong_FromLong |
| #define PyInt_FromSize_t PyLong_FromSize_t |
| #define PyInt_FromSsize_t PyLong_FromSsize_t |
| #define PyInt_AsLong PyLong_AsLong |
| #define PyInt_AS_LONG PyLong_AS_LONG |
| #define PyInt_AsSsize_t PyLong_AsSsize_t |
| #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask |
| #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask |
| #endif |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define PyBoolObject PyLongObject |
| #endif |
| |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
| #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
| #else |
| #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
| #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
| #endif |
| |
| #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) |
| #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) |
| #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) |
| #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) |
| #else |
| #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ |
| (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ |
| (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ |
| (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) |
| #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ |
| (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ |
| (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ |
| (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) |
| #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ |
| (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ |
| (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ |
| (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) |
| #endif |
| |
| #if PY_MAJOR_VERSION >= 3 |
| #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02050000 |
| #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) |
| #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) |
| #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) |
| #else |
| #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) |
| #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) |
| #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) |
| #endif |
| |
| #if PY_VERSION_HEX < 0x02050000 |
| #define __Pyx_NAMESTR(n) ((char *)(n)) |
| #define __Pyx_DOCSTR(n) ((char *)(n)) |
| #else |
| #define __Pyx_NAMESTR(n) (n) |
| #define __Pyx_DOCSTR(n) (n) |
| #endif |
| |
| #ifdef __cplusplus |
| #define __PYX_EXTERN_C extern "C" |
| #else |
| #define __PYX_EXTERN_C extern |
| #endif |
| |
| #if defined(WIN32) || defined(MS_WINDOWS) |
| #define _USE_MATH_DEFINES |
| #endif |
| #include <math.h> |
| #define __PYX_HAVE_API__cpyamf__util |
| #include "stdio.h" |
| #include "pythread.h" |
| #include "stdlib.h" |
| #include "string.h" |
| |
| #ifdef PYREX_WITHOUT_ASSERTIONS |
| #define CYTHON_WITHOUT_ASSERTIONS |
| #endif |
| |
| |
| /* inline attribute */ |
| #ifndef CYTHON_INLINE |
| #if defined(__GNUC__) |
| #define CYTHON_INLINE __inline__ |
| #elif defined(_MSC_VER) |
| #define CYTHON_INLINE __inline |
| #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| #define CYTHON_INLINE inline |
| #else |
| #define CYTHON_INLINE |
| #endif |
| #endif |
| |
| /* unused attribute */ |
| #ifndef CYTHON_UNUSED |
| # if defined(__GNUC__) |
| # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) |
| # define CYTHON_UNUSED __attribute__ ((__unused__)) |
| # else |
| # define CYTHON_UNUSED |
| # endif |
| # elif defined(__ICC) || defined(__INTEL_COMPILER) |
| # define CYTHON_UNUSED __attribute__ ((__unused__)) |
| # else |
| # define CYTHON_UNUSED |
| # endif |
| #endif |
| |
| typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ |
| |
| |
| /* Type Conversion Predeclarations */ |
| |
| #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) |
| #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) |
| |
| #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) |
| static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); |
| static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); |
| |
| static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); |
| static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); |
| static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); |
| |
| #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) |
| |
| |
| #ifdef __GNUC__ |
| /* Test for GCC > 2.95 */ |
| #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) |
| #define likely(x) __builtin_expect(!!(x), 1) |
| #define unlikely(x) __builtin_expect(!!(x), 0) |
| #else /* __GNUC__ > 2 ... */ |
| #define likely(x) (x) |
| #define unlikely(x) (x) |
| #endif /* __GNUC__ > 2 ... */ |
| #else /* __GNUC__ */ |
| #define likely(x) (x) |
| #define unlikely(x) (x) |
| #endif /* __GNUC__ */ |
| |
| static PyObject *__pyx_m; |
| static PyObject *__pyx_b; |
| static PyObject *__pyx_empty_tuple; |
| static PyObject *__pyx_empty_bytes; |
| static int __pyx_lineno; |
| static int __pyx_clineno = 0; |
| static const char * __pyx_cfilenm= __FILE__; |
| static const char *__pyx_filename; |
| |
| |
| static const char *__pyx_f[] = { |
| "util.pyx", |
| "bool.pxd", |
| "complex.pxd", |
| }; |
| |
| /* Type declarations */ |
| |
| /* "cpyamf/util.pxd":28 |
| * cpdef bint at_eof(self) except -1 |
| * cpdef inline Py_ssize_t remaining(self) except -1 |
| * cpdef int seek(self, Py_ssize_t pos, int mode=*) except -1 # <<<<<<<<<<<<<< |
| * cpdef object getvalue(self) |
| * cdef Py_ssize_t peek(self, char **buf, Py_ssize_t size) except -1 |
| */ |
| |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek { |
| int __pyx_n; |
| int mode; |
| }; |
| |
| /* "cpyamf/util.pxd":31 |
| * cpdef object getvalue(self) |
| * cdef Py_ssize_t peek(self, char **buf, Py_ssize_t size) except -1 |
| * cpdef int truncate(self, Py_ssize_t size=?) except -1 # <<<<<<<<<<<<<< |
| * cpdef int consume(self) except -1 |
| * cdef int unpack_int(self, unsigned int num_bytes, void *ret) except -1 |
| */ |
| |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_truncate { |
| int __pyx_n; |
| Py_ssize_t size; |
| }; |
| |
| /* "cpyamf/util.pxd":5 |
| * |
| * |
| * cdef class cBufferedByteStream: # <<<<<<<<<<<<<< |
| * """ |
| * The c version of BufferedByteStream. |
| */ |
| |
| struct __pyx_obj_6cpyamf_4util_cBufferedByteStream { |
| PyObject_HEAD |
| struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *__pyx_vtab; |
| char endian; |
| char *buffer; |
| int closed; |
| Py_ssize_t pos; |
| Py_ssize_t size; |
| Py_ssize_t length; |
| Py_ssize_t min_buf_size; |
| }; |
| |
| /* "cpyamf/util.pxd":61 |
| * |
| * |
| * cdef class BufferedByteStream(cBufferedByteStream): # <<<<<<<<<<<<<< |
| * """ |
| * A file like object that mimics StringIO with some extra helper methods. |
| */ |
| |
| struct __pyx_obj_6cpyamf_4util_BufferedByteStream { |
| struct __pyx_obj_6cpyamf_4util_cBufferedByteStream __pyx_base; |
| }; |
| |
| |
| /* "cpyamf/util.pyx":190 |
| * |
| * |
| * cdef class cBufferedByteStream(object): # <<<<<<<<<<<<<< |
| * """ |
| * A file like object that can be read/written to. Supports data type |
| */ |
| |
| struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream { |
| Py_ssize_t (*tell)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| int (*write)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char *, Py_ssize_t); |
| int (*_init_buffer)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *); |
| int (*_actually_increase_buffer)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t); |
| int (*_increase_buffer)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t); |
| int (*has_available)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t); |
| int (*read)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char **, Py_ssize_t); |
| int (*at_eof)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| Py_ssize_t (*remaining)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| int (*seek)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek *__pyx_optional_args); |
| PyObject *(*getvalue)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| Py_ssize_t (*peek)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char **, Py_ssize_t); |
| int (*truncate)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_truncate *__pyx_optional_args); |
| int (*consume)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| int (*unpack_int)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned int, void *); |
| int (*pack_int)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int, long); |
| int (*pack_uint)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int, unsigned long); |
| unsigned char (*read_uchar)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| char (*read_char)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| unsigned short (*read_ushort)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| short (*read_short)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| unsigned long (*read_24bit_uint)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| long (*read_24bit_int)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| unsigned long (*read_ulong)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| long (*read_long)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch); |
| int (*write_uchar)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned char, int __pyx_skip_dispatch); |
| int (*write_char)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char, int __pyx_skip_dispatch); |
| int (*write_ushort)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned short, int __pyx_skip_dispatch); |
| int (*write_short)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, short, int __pyx_skip_dispatch); |
| int (*write_24bit_uint)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned long, int __pyx_skip_dispatch); |
| int (*write_24bit_int)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, long, int __pyx_skip_dispatch); |
| int (*write_ulong)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned long, int __pyx_skip_dispatch); |
| int (*write_long)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, long, int __pyx_skip_dispatch); |
| PyObject *(*read_utf8_string)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t, int __pyx_skip_dispatch); |
| int (*write_utf8_string)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, PyObject *, int __pyx_skip_dispatch); |
| int (*read_double)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, double *); |
| int (*write_double)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, double, int __pyx_skip_dispatch); |
| int (*read_float)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, float *); |
| int (*write_float)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, float, int __pyx_skip_dispatch); |
| int (*append)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, PyObject *, int __pyx_skip_dispatch); |
| }; |
| static struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *__pyx_vtabptr_6cpyamf_4util_cBufferedByteStream; |
| |
| |
| /* "cpyamf/util.pyx":907 |
| * |
| * |
| * cdef class BufferedByteStream(cBufferedByteStream): # <<<<<<<<<<<<<< |
| * """ |
| * A Python exposed version of cBufferedByteStream. This exists because of |
| */ |
| |
| struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream { |
| struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream __pyx_base; |
| }; |
| static struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *__pyx_vtabptr_6cpyamf_4util_BufferedByteStream; |
| |
| #ifndef CYTHON_REFNANNY |
| #define CYTHON_REFNANNY 0 |
| #endif |
| |
| #if CYTHON_REFNANNY |
| typedef struct { |
| void (*INCREF)(void*, PyObject*, int); |
| void (*DECREF)(void*, PyObject*, int); |
| void (*GOTREF)(void*, PyObject*, int); |
| void (*GIVEREF)(void*, PyObject*, int); |
| void* (*SetupContext)(const char*, int, const char*); |
| void (*FinishContext)(void**); |
| } __Pyx_RefNannyAPIStruct; |
| static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; |
| static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { |
| PyObject *m = NULL, *p = NULL; |
| void *r = NULL; |
| m = PyImport_ImportModule((char *)modname); |
| if (!m) goto end; |
| p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); |
| if (!p) goto end; |
| r = PyLong_AsVoidPtr(p); |
| end: |
| Py_XDECREF(p); |
| Py_XDECREF(m); |
| return (__Pyx_RefNannyAPIStruct *)r; |
| } |
| #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) |
| #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
| #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) |
| #else |
| #define __Pyx_RefNannySetupContext(name) |
| #define __Pyx_RefNannyFinishContext() |
| #define __Pyx_INCREF(r) Py_INCREF(r) |
| #define __Pyx_DECREF(r) Py_DECREF(r) |
| #define __Pyx_GOTREF(r) |
| #define __Pyx_GIVEREF(r) |
| #define __Pyx_XDECREF(r) Py_XDECREF(r) |
| #endif /* CYTHON_REFNANNY */ |
| #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) |
| #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) |
| |
| static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ |
| |
| static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ |
| |
| static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, |
| Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ |
| |
| static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, |
| const char* function_name, int kw_allowed); /*proto*/ |
| |
| static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ |
| static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ |
| |
| static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ |
| |
| static void __Pyx_RaiseDoubleKeywordsError( |
| const char* func_name, PyObject* kw_name); /*proto*/ |
| |
| static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ |
| |
| static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ |
| static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ |
| |
| static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ |
| |
| static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); |
| |
| static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); |
| |
| static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); |
| |
| static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); |
| |
| static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); |
| |
| static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); |
| |
| static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); |
| |
| static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); |
| |
| static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); |
| |
| static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); |
| |
| static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); |
| |
| static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); |
| |
| static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); |
| |
| static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); |
| |
| static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); |
| |
| static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); |
| |
| static void __Pyx_WriteUnraisable(const char *name); /*proto*/ |
| |
| static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ |
| |
| static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ |
| |
| static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ |
| |
| static void __Pyx_AddTraceback(const char *funcname); /*proto*/ |
| |
| static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ |
| /* Module declarations from cpython.version */ |
| |
| /* Module declarations from cpython.ref */ |
| |
| /* Module declarations from cpython.exc */ |
| |
| /* Module declarations from cpython.module */ |
| |
| /* Module declarations from cpython.mem */ |
| |
| /* Module declarations from cpython.tuple */ |
| |
| /* Module declarations from cpython.list */ |
| |
| /* Module declarations from libc.stdio */ |
| |
| /* Module declarations from cpython.object */ |
| |
| /* Module declarations from cpython.sequence */ |
| |
| /* Module declarations from cpython.mapping */ |
| |
| /* Module declarations from cpython.iterator */ |
| |
| /* Module declarations from cpython.type */ |
| |
| /* Module declarations from cpython.number */ |
| |
| /* Module declarations from cpython.int */ |
| |
| /* Module declarations from __builtin__ */ |
| |
| /* Module declarations from cpython.bool */ |
| |
| static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; |
| /* Module declarations from cpython.long */ |
| |
| /* Module declarations from cpython.float */ |
| |
| /* Module declarations from __builtin__ */ |
| |
| /* Module declarations from cpython.complex */ |
| |
| static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; |
| /* Module declarations from cpython.string */ |
| |
| /* Module declarations from cpython.unicode */ |
| |
| /* Module declarations from cpython.dict */ |
| |
| /* Module declarations from cpython.instance */ |
| |
| /* Module declarations from cpython.function */ |
| |
| /* Module declarations from cpython.method */ |
| |
| /* Module declarations from cpython.weakref */ |
| |
| /* Module declarations from cpython.getargs */ |
| |
| /* Module declarations from cpython.pythread */ |
| |
| /* Module declarations from cpython.cobject */ |
| |
| /* Module declarations from cpython.oldbuffer */ |
| |
| /* Module declarations from cpython.set */ |
| |
| /* Module declarations from cpython.buffer */ |
| |
| /* Module declarations from cpython.bytes */ |
| |
| /* Module declarations from cpython.pycapsule */ |
| |
| /* Module declarations from cpython */ |
| |
| /* Module declarations from libc.stdlib */ |
| |
| /* Module declarations from libc.string */ |
| |
| /* Module declarations from cython */ |
| |
| /* Module declarations from cpyamf.util */ |
| |
| static PyTypeObject *__pyx_ptype_6cpyamf_4util_cBufferedByteStream = 0; |
| static PyTypeObject *__pyx_ptype_6cpyamf_4util_BufferedByteStream = 0; |
| static char __pyx_v_6cpyamf_4util_SYSTEM_ENDIAN; |
| static int __pyx_v_6cpyamf_4util_float_broken; |
| static unsigned char *__pyx_v_6cpyamf_4util_NaN; |
| static unsigned char *__pyx_v_6cpyamf_4util_NegInf; |
| static unsigned char *__pyx_v_6cpyamf_4util_PosInf; |
| static double __pyx_v_6cpyamf_4util_platform_nan; |
| static double __pyx_v_6cpyamf_4util_platform_posinf; |
| static double __pyx_v_6cpyamf_4util_platform_neginf; |
| static double __pyx_v_6cpyamf_4util_system_nan; |
| static double __pyx_v_6cpyamf_4util_system_posinf; |
| static double __pyx_v_6cpyamf_4util_system_neginf; |
| static PyObject *__pyx_v_6cpyamf_4util_pyamf_NaN = 0; |
| static PyObject *__pyx_v_6cpyamf_4util_pyamf_NegInf = 0; |
| static PyObject *__pyx_v_6cpyamf_4util_pyamf_PosInf = 0; |
| static PyObject *__pyx_v_6cpyamf_4util_empty_unicode = 0; |
| static int __pyx_f_6cpyamf_4util__memcpy_ensure_endian(void *, void *, unsigned int); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_build_platform_exceptional_floats(void); /*proto*/ |
| static char __pyx_f_6cpyamf_4util_get_native_endian(void); /*proto*/ |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_is_big_endian(char); /*proto*/ |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_is_native_endian(char); /*proto*/ |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_swap_bytes(unsigned char *, Py_ssize_t); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_is_broken_float(void); /*proto*/ |
| #define __Pyx_MODULE_NAME "cpyamf.util" |
| static int __pyx_module_is_main_cpyamf__util = 0; |
| |
| /* Implementation of cpyamf.util */ |
| static PyObject *__pyx_builtin_SystemError; |
| static PyObject *__pyx_builtin_IOError; |
| static PyObject *__pyx_builtin_ValueError; |
| static PyObject *__pyx_builtin_OverflowError; |
| static PyObject *__pyx_builtin_TypeError; |
| static char __pyx_k_1[] = "_actually_increase_buffer"; |
| static char __pyx_k_2[] = "buf cannot be NULL"; |
| static char __pyx_k_3[] = "Bad value for mode"; |
| static char __pyx_k_5[] = "Max 4 bytes to unpack"; |
| static char __pyx_k_7[] = "integer out of range"; |
| static char __pyx_k_10[] = "value must be Unicode or str"; |
| static char __pyx_k_13[] = "Unable to coerce buf->StringIO"; |
| static char __pyx_k_15[] = "String value expected"; |
| static char __pyx_k_17[] = "!"; |
| static char __pyx_k_18[] = "@"; |
| static char __pyx_k_19[] = "<"; |
| static char __pyx_k_20[] = ">"; |
| static char __pyx_k_21[] = "Not a valid endian type"; |
| static char __pyx_k_23[] = "expected int for x"; |
| static char __pyx_k_28[] = "Expecting float for val"; |
| static char __pyx_k_31[] = "\nC-extension for L{pyamf.util} Python module in L{PyAMF<pyamf>}.\n\n@since: 0.4\n"; |
| static char __pyx_k_32[] = "\377\370\000\000\000\000\000\000"; |
| static char __pyx_k_33[] = "\377\360\000\000\000\000\000\000"; |
| static char __pyx_k_34[] = "\360\000\000\000\000\000\000"; |
| static char __pyx_k_35[] = ""; |
| static char __pyx_k_37[] = "Unable to initialise cpyamf.util"; |
| static char __pyx_k__x[] = "x"; |
| static char __pyx_k__NaN[] = "NaN"; |
| static char __pyx_k__buf[] = "buf"; |
| static char __pyx_k__pos[] = "pos"; |
| static char __pyx_k__mode[] = "mode"; |
| static char __pyx_k__peek[] = "peek"; |
| static char __pyx_k__read[] = "read"; |
| static char __pyx_k__seek[] = "seek"; |
| static char __pyx_k__size[] = "size"; |
| static char __pyx_k__tell[] = "tell"; |
| static char __pyx_k__pyamf[] = "pyamf"; |
| static char __pyx_k__write[] = "write"; |
| static char __pyx_k__NegInf[] = "NegInf"; |
| static char __pyx_k__PosInf[] = "PosInf"; |
| static char __pyx_k__append[] = "append"; |
| static char __pyx_k__at_eof[] = "at_eof"; |
| static char __pyx_k__buffer[] = "buffer"; |
| static char __pyx_k__endian[] = "endian"; |
| static char __pyx_k__length[] = "length"; |
| static char __pyx_k__python[] = "python"; |
| static char __pyx_k__strict[] = "strict"; |
| static char __pyx_k__IOError[] = "IOError"; |
| static char __pyx_k__consume[] = "consume"; |
| static char __pyx_k____main__[] = "__main__"; |
| static char __pyx_k____test__[] = "__test__"; |
| static char __pyx_k__getvalue[] = "getvalue"; |
| static char __pyx_k__pack_int[] = "pack_int"; |
| static char __pyx_k__truncate[] = "truncate"; |
| static char __pyx_k__TypeError[] = "TypeError"; |
| static char __pyx_k__pack_uint[] = "pack_uint"; |
| static char __pyx_k__read_char[] = "read_char"; |
| static char __pyx_k__read_long[] = "read_long"; |
| static char __pyx_k__remaining[] = "remaining"; |
| static char __pyx_k__ValueError[] = "ValueError"; |
| static char __pyx_k__read_short[] = "read_short"; |
| static char __pyx_k__read_uchar[] = "read_uchar"; |
| static char __pyx_k__read_ulong[] = "read_ulong"; |
| static char __pyx_k__unpack_int[] = "unpack_int"; |
| static char __pyx_k__write_char[] = "write_char"; |
| static char __pyx_k__write_long[] = "write_long"; |
| static char __pyx_k__SystemError[] = "SystemError"; |
| static char __pyx_k__read_ushort[] = "read_ushort"; |
| static char __pyx_k__write_float[] = "write_float"; |
| static char __pyx_k__write_short[] = "write_short"; |
| static char __pyx_k__write_uchar[] = "write_uchar"; |
| static char __pyx_k__write_ulong[] = "write_ulong"; |
| static char __pyx_k___init_buffer[] = "_init_buffer"; |
| static char __pyx_k__min_buf_size[] = "min_buf_size"; |
| static char __pyx_k__write_double[] = "write_double"; |
| static char __pyx_k__write_ushort[] = "write_ushort"; |
| static char __pyx_k__OverflowError[] = "OverflowError"; |
| static char __pyx_k__has_available[] = "has_available"; |
| static char __pyx_k__read_24bit_int[] = "read_24bit_int"; |
| static char __pyx_k__read_24bit_uint[] = "read_24bit_uint"; |
| static char __pyx_k__write_24bit_int[] = "write_24bit_int"; |
| static char __pyx_k___increase_buffer[] = "_increase_buffer"; |
| static char __pyx_k__read_utf8_string[] = "read_utf8_string"; |
| static char __pyx_k__write_24bit_uint[] = "write_24bit_uint"; |
| static char __pyx_k__write_utf8_string[] = "write_utf8_string"; |
| static PyObject *__pyx_n_s_1; |
| static PyObject *__pyx_kp_s_10; |
| static PyObject *__pyx_kp_s_13; |
| static PyObject *__pyx_kp_s_15; |
| static PyObject *__pyx_kp_b_17; |
| static PyObject *__pyx_kp_b_18; |
| static PyObject *__pyx_kp_b_19; |
| static PyObject *__pyx_kp_s_2; |
| static PyObject *__pyx_kp_b_20; |
| static PyObject *__pyx_kp_s_21; |
| static PyObject *__pyx_kp_s_23; |
| static PyObject *__pyx_kp_s_28; |
| static PyObject *__pyx_kp_s_3; |
| static PyObject *__pyx_kp_s_35; |
| static PyObject *__pyx_kp_s_37; |
| static PyObject *__pyx_kp_s_5; |
| static PyObject *__pyx_kp_s_7; |
| static PyObject *__pyx_n_s__IOError; |
| static PyObject *__pyx_n_s__NaN; |
| static PyObject *__pyx_n_s__NegInf; |
| static PyObject *__pyx_n_s__OverflowError; |
| static PyObject *__pyx_n_s__PosInf; |
| static PyObject *__pyx_n_s__SystemError; |
| static PyObject *__pyx_n_s__TypeError; |
| static PyObject *__pyx_n_s__ValueError; |
| static PyObject *__pyx_n_s____main__; |
| static PyObject *__pyx_n_s____test__; |
| static PyObject *__pyx_n_s___increase_buffer; |
| static PyObject *__pyx_n_s___init_buffer; |
| static PyObject *__pyx_n_s__append; |
| static PyObject *__pyx_n_s__at_eof; |
| static PyObject *__pyx_n_s__buf; |
| static PyObject *__pyx_n_s__buffer; |
| static PyObject *__pyx_n_s__consume; |
| static PyObject *__pyx_n_s__endian; |
| static PyObject *__pyx_n_s__getvalue; |
| static PyObject *__pyx_n_s__has_available; |
| static PyObject *__pyx_n_s__length; |
| static PyObject *__pyx_n_s__min_buf_size; |
| static PyObject *__pyx_n_s__mode; |
| static PyObject *__pyx_n_s__pack_int; |
| static PyObject *__pyx_n_s__pack_uint; |
| static PyObject *__pyx_n_s__peek; |
| static PyObject *__pyx_n_s__pos; |
| static PyObject *__pyx_n_s__pyamf; |
| static PyObject *__pyx_n_s__python; |
| static PyObject *__pyx_n_s__read; |
| static PyObject *__pyx_n_s__read_24bit_int; |
| static PyObject *__pyx_n_s__read_24bit_uint; |
| static PyObject *__pyx_n_s__read_char; |
| static PyObject *__pyx_n_s__read_long; |
| static PyObject *__pyx_n_s__read_short; |
| static PyObject *__pyx_n_s__read_uchar; |
| static PyObject *__pyx_n_s__read_ulong; |
| static PyObject *__pyx_n_s__read_ushort; |
| static PyObject *__pyx_n_s__read_utf8_string; |
| static PyObject *__pyx_n_s__remaining; |
| static PyObject *__pyx_n_s__seek; |
| static PyObject *__pyx_n_s__size; |
| static PyObject *__pyx_n_s__tell; |
| static PyObject *__pyx_n_s__truncate; |
| static PyObject *__pyx_n_s__unpack_int; |
| static PyObject *__pyx_n_s__write; |
| static PyObject *__pyx_n_s__write_24bit_int; |
| static PyObject *__pyx_n_s__write_24bit_uint; |
| static PyObject *__pyx_n_s__write_char; |
| static PyObject *__pyx_n_s__write_double; |
| static PyObject *__pyx_n_s__write_float; |
| static PyObject *__pyx_n_s__write_long; |
| static PyObject *__pyx_n_s__write_short; |
| static PyObject *__pyx_n_s__write_uchar; |
| static PyObject *__pyx_n_s__write_ulong; |
| static PyObject *__pyx_n_s__write_ushort; |
| static PyObject *__pyx_n_s__write_utf8_string; |
| static PyObject *__pyx_n_s__x; |
| static PyObject *__pyx_int_0; |
| static PyObject *__pyx_int_neg_1; |
| static PyObject *__pyx_int_512; |
| static PyObject *__pyx_int_2147483648; |
| static PyObject *__pyx_int_4294967295L; |
| static PyObject *__pyx_k_tuple_4; |
| static PyObject *__pyx_k_tuple_6; |
| static PyObject *__pyx_k_tuple_8; |
| static PyObject *__pyx_k_tuple_9; |
| static PyObject *__pyx_k_tuple_11; |
| static PyObject *__pyx_k_tuple_12; |
| static PyObject *__pyx_k_tuple_14; |
| static PyObject *__pyx_k_tuple_16; |
| static PyObject *__pyx_k_tuple_22; |
| static PyObject *__pyx_k_tuple_24; |
| static PyObject *__pyx_k_tuple_25; |
| static PyObject *__pyx_k_tuple_26; |
| static PyObject *__pyx_k_tuple_27; |
| static PyObject *__pyx_k_tuple_29; |
| static PyObject *__pyx_k_tuple_30; |
| static PyObject *__pyx_k_tuple_36; |
| static PyObject *__pyx_k_tuple_38; |
| |
| /* "cpyamf/util.pyx":59 |
| * |
| * @cython.profile(False) |
| * cdef int _memcpy_ensure_endian(void *src, void *dest, unsigned int size) nogil: # <<<<<<<<<<<<<< |
| * """ |
| * """ |
| */ |
| |
| static int __pyx_f_6cpyamf_4util__memcpy_ensure_endian(void *__pyx_v_src, void *__pyx_v_dest, unsigned int __pyx_v_size) { |
| unsigned char *__pyx_v_buf; |
| int __pyx_r; |
| int __pyx_t_1; |
| |
| /* "cpyamf/util.pyx":62 |
| * """ |
| * """ |
| * cdef unsigned char *buf = <unsigned char *>malloc(size) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((unsigned char *)malloc(__pyx_v_size)); |
| |
| /* "cpyamf/util.pyx":64 |
| * cdef unsigned char *buf = <unsigned char *>malloc(size) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * return -1 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_buf == NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":65 |
| * |
| * if buf == NULL: |
| * return -1 # <<<<<<<<<<<<<< |
| * |
| * memcpy(buf, src, size) |
| */ |
| __pyx_r = -1; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":67 |
| * return -1 |
| * |
| * memcpy(buf, src, size) # <<<<<<<<<<<<<< |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| */ |
| memcpy(__pyx_v_buf, __pyx_v_src, __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":69 |
| * memcpy(buf, src, size) |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, size) == -1: |
| * free(buf) |
| */ |
| __pyx_t_1 = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN)); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":70 |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| * if swap_bytes(buf, size) == -1: # <<<<<<<<<<<<<< |
| * free(buf) |
| * |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, __pyx_v_size) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":71 |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| * if swap_bytes(buf, size) == -1: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return -1 |
| */ |
| free(__pyx_v_buf); |
| |
| /* "cpyamf/util.pyx":73 |
| * free(buf) |
| * |
| * return -1 # <<<<<<<<<<<<<< |
| * |
| * memcpy(dest, buf, size) |
| */ |
| __pyx_r = -1; |
| goto __pyx_L0; |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":75 |
| * return -1 |
| * |
| * memcpy(dest, buf, size) # <<<<<<<<<<<<<< |
| * free(buf) |
| * |
| */ |
| memcpy(__pyx_v_dest, __pyx_v_buf, __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":76 |
| * |
| * memcpy(dest, buf, size) |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| free(__pyx_v_buf); |
| |
| /* "cpyamf/util.pyx":78 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":81 |
| * |
| * |
| * cdef int build_platform_exceptional_floats() except -1: # <<<<<<<<<<<<<< |
| * global platform_nan, platform_posinf, platform_neginf |
| * global system_nan, system_posinf, system_neginf |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_build_platform_exceptional_floats(void) { |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2; |
| double __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| PyObject *__pyx_t_5 = NULL; |
| PyObject *__pyx_t_6 = NULL; |
| __Pyx_RefNannySetupContext("build_platform_exceptional_floats"); |
| |
| /* "cpyamf/util.pyx":85 |
| * global system_nan, system_posinf, system_neginf |
| * |
| * if _memcpy_ensure_endian(NaN, &system_nan, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util__memcpy_ensure_endian(__pyx_v_6cpyamf_4util_NaN, (&__pyx_v_6cpyamf_4util_system_nan), 8) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":86 |
| * |
| * if _memcpy_ensure_endian(NaN, &system_nan, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * if _memcpy_ensure_endian(NegInf, &system_neginf, 8) == -1: |
| */ |
| __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":88 |
| * PyErr_NoMemory() |
| * |
| * if _memcpy_ensure_endian(NegInf, &system_neginf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util__memcpy_ensure_endian(__pyx_v_6cpyamf_4util_NegInf, (&__pyx_v_6cpyamf_4util_system_neginf), 8) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":89 |
| * |
| * if _memcpy_ensure_endian(NegInf, &system_neginf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * if _memcpy_ensure_endian(PosInf, &system_posinf, 8) == -1: |
| */ |
| __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":91 |
| * PyErr_NoMemory() |
| * |
| * if _memcpy_ensure_endian(PosInf, &system_posinf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util__memcpy_ensure_endian(__pyx_v_6cpyamf_4util_PosInf, (&__pyx_v_6cpyamf_4util_system_posinf), 8) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":92 |
| * |
| * if _memcpy_ensure_endian(PosInf, &system_posinf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * if float_broken == 1: |
| */ |
| __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":94 |
| * PyErr_NoMemory() |
| * |
| * if float_broken == 1: # <<<<<<<<<<<<<< |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&NaN, not is_big_endian(SYSTEM_ENDIAN)) |
| */ |
| __pyx_t_1 = (__pyx_v_6cpyamf_4util_float_broken == 1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":95 |
| * |
| * if float_broken == 1: |
| * try: # <<<<<<<<<<<<<< |
| * _PyFloat_Unpack8(<unsigned char *>&NaN, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| */ |
| { |
| PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; |
| __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); |
| __Pyx_XGOTREF(__pyx_save_exc_type); |
| __Pyx_XGOTREF(__pyx_save_exc_value); |
| __Pyx_XGOTREF(__pyx_save_exc_tb); |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":96 |
| * if float_broken == 1: |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&NaN, not is_big_endian(SYSTEM_ENDIAN)) # <<<<<<<<<<<<<< |
| * except: |
| * raise |
| */ |
| __pyx_t_3 = _PyFloat_Unpack8(((unsigned char *)(&__pyx_v_6cpyamf_4util_NaN)), (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN))); if (unlikely(__pyx_t_3 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;} |
| } |
| /*else:*/ { |
| |
| /* "cpyamf/util.pyx":100 |
| * raise |
| * else: |
| * memcpy(&platform_nan, &system_nan, 8) # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| memcpy((&__pyx_v_6cpyamf_4util_platform_nan), (&__pyx_v_6cpyamf_4util_system_nan), 8); |
| } |
| __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; |
| __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; |
| __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; |
| goto __pyx_L14_try_end; |
| __pyx_L7_error:; |
| |
| /* "cpyamf/util.pyx":97 |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&NaN, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: # <<<<<<<<<<<<<< |
| * raise |
| * else: |
| */ |
| /*except:*/ { |
| __Pyx_AddTraceback("cpyamf.util.build_platform_exceptional_floats"); |
| if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_GOTREF(__pyx_t_5); |
| __Pyx_GOTREF(__pyx_t_6); |
| |
| /* "cpyamf/util.pyx":98 |
| * _PyFloat_Unpack8(<unsigned char *>&NaN, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| * raise # <<<<<<<<<<<<<< |
| * else: |
| * memcpy(&platform_nan, &system_nan, 8) |
| */ |
| __Pyx_GIVEREF(__pyx_t_4); |
| __Pyx_GIVEREF(__pyx_t_5); |
| __Pyx_GIVEREF(__pyx_t_6); |
| __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6); |
| __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| goto __pyx_L8_exception_handled; |
| } |
| __pyx_L9_except_error:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| goto __pyx_L1_error; |
| __pyx_L8_exception_handled:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| __pyx_L14_try_end:; |
| } |
| |
| /* "cpyamf/util.pyx":102 |
| * memcpy(&platform_nan, &system_nan, 8) |
| * |
| * try: # <<<<<<<<<<<<<< |
| * _PyFloat_Unpack8(<unsigned char *>&PosInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| */ |
| { |
| PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; |
| __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); |
| __Pyx_XGOTREF(__pyx_save_exc_type); |
| __Pyx_XGOTREF(__pyx_save_exc_value); |
| __Pyx_XGOTREF(__pyx_save_exc_tb); |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":103 |
| * |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&PosInf, not is_big_endian(SYSTEM_ENDIAN)) # <<<<<<<<<<<<<< |
| * except: |
| * raise |
| */ |
| __pyx_t_3 = _PyFloat_Unpack8(((unsigned char *)(&__pyx_v_6cpyamf_4util_PosInf)), (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN))); if (unlikely(__pyx_t_3 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L17_error;} |
| } |
| /*else:*/ { |
| |
| /* "cpyamf/util.pyx":107 |
| * raise |
| * else: |
| * memcpy(&platform_posinf, &system_posinf, 8) # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| memcpy((&__pyx_v_6cpyamf_4util_platform_posinf), (&__pyx_v_6cpyamf_4util_system_posinf), 8); |
| } |
| __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; |
| __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; |
| __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; |
| goto __pyx_L24_try_end; |
| __pyx_L17_error:; |
| __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; |
| |
| /* "cpyamf/util.pyx":104 |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&PosInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: # <<<<<<<<<<<<<< |
| * raise |
| * else: |
| */ |
| /*except:*/ { |
| __Pyx_AddTraceback("cpyamf.util.build_platform_exceptional_floats"); |
| if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} |
| __Pyx_GOTREF(__pyx_t_6); |
| __Pyx_GOTREF(__pyx_t_5); |
| __Pyx_GOTREF(__pyx_t_4); |
| |
| /* "cpyamf/util.pyx":105 |
| * _PyFloat_Unpack8(<unsigned char *>&PosInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| * raise # <<<<<<<<<<<<<< |
| * else: |
| * memcpy(&platform_posinf, &system_posinf, 8) |
| */ |
| __Pyx_GIVEREF(__pyx_t_6); |
| __Pyx_GIVEREF(__pyx_t_5); |
| __Pyx_GIVEREF(__pyx_t_4); |
| __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_4); |
| __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} |
| __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| goto __pyx_L18_exception_handled; |
| } |
| __pyx_L19_except_error:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| goto __pyx_L1_error; |
| __pyx_L18_exception_handled:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| __pyx_L24_try_end:; |
| } |
| |
| /* "cpyamf/util.pyx":109 |
| * memcpy(&platform_posinf, &system_posinf, 8) |
| * |
| * try: # <<<<<<<<<<<<<< |
| * _PyFloat_Unpack8(<unsigned char *>&NegInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| */ |
| { |
| PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; |
| __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); |
| __Pyx_XGOTREF(__pyx_save_exc_type); |
| __Pyx_XGOTREF(__pyx_save_exc_value); |
| __Pyx_XGOTREF(__pyx_save_exc_tb); |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":110 |
| * |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&NegInf, not is_big_endian(SYSTEM_ENDIAN)) # <<<<<<<<<<<<<< |
| * except: |
| * raise |
| */ |
| __pyx_t_3 = _PyFloat_Unpack8(((unsigned char *)(&__pyx_v_6cpyamf_4util_NegInf)), (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN))); if (unlikely(__pyx_t_3 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L27_error;} |
| } |
| /*else:*/ { |
| |
| /* "cpyamf/util.pyx":114 |
| * raise |
| * else: |
| * memcpy(&platform_neginf, &system_neginf, 8) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| memcpy((&__pyx_v_6cpyamf_4util_platform_neginf), (&__pyx_v_6cpyamf_4util_system_neginf), 8); |
| } |
| __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; |
| __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; |
| __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; |
| goto __pyx_L34_try_end; |
| __pyx_L27_error:; |
| __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; |
| __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; |
| |
| /* "cpyamf/util.pyx":111 |
| * try: |
| * _PyFloat_Unpack8(<unsigned char *>&NegInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: # <<<<<<<<<<<<<< |
| * raise |
| * else: |
| */ |
| /*except:*/ { |
| __Pyx_AddTraceback("cpyamf.util.build_platform_exceptional_floats"); |
| if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_GOTREF(__pyx_t_5); |
| __Pyx_GOTREF(__pyx_t_6); |
| |
| /* "cpyamf/util.pyx":112 |
| * _PyFloat_Unpack8(<unsigned char *>&NegInf, not is_big_endian(SYSTEM_ENDIAN)) |
| * except: |
| * raise # <<<<<<<<<<<<<< |
| * else: |
| * memcpy(&platform_neginf, &system_neginf, 8) |
| */ |
| __Pyx_GIVEREF(__pyx_t_4); |
| __Pyx_GIVEREF(__pyx_t_5); |
| __Pyx_GIVEREF(__pyx_t_6); |
| __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6); |
| __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;} |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| goto __pyx_L28_exception_handled; |
| } |
| __pyx_L29_except_error:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| goto __pyx_L1_error; |
| __pyx_L28_exception_handled:; |
| __Pyx_XGIVEREF(__pyx_save_exc_type); |
| __Pyx_XGIVEREF(__pyx_save_exc_value); |
| __Pyx_XGIVEREF(__pyx_save_exc_tb); |
| __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); |
| __pyx_L34_try_end:; |
| } |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":116 |
| * memcpy(&platform_neginf, &system_neginf, 8) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_XDECREF(__pyx_t_5); |
| __Pyx_XDECREF(__pyx_t_6); |
| __Pyx_AddTraceback("cpyamf.util.build_platform_exceptional_floats"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":120 |
| * |
| * @cython.profile(False) |
| * cdef char get_native_endian() nogil: # <<<<<<<<<<<<<< |
| * """ |
| * A quick hack to determine the system's endian-ness ... |
| */ |
| |
| static char __pyx_f_6cpyamf_4util_get_native_endian(void) { |
| unsigned int __pyx_v_one; |
| int __pyx_v_big_endian; |
| char __pyx_r; |
| int __pyx_t_1; |
| |
| /* "cpyamf/util.pyx":126 |
| * @return: Either L{ENDIAN_LITTLE} or L{ENDIAN_BIG} |
| * """ |
| * cdef unsigned int one = 1 # <<<<<<<<<<<<<< |
| * cdef int big_endian = (<char*>&one)[0] != 1 |
| * |
| */ |
| __pyx_v_one = 1; |
| |
| /* "cpyamf/util.pyx":127 |
| * """ |
| * cdef unsigned int one = 1 |
| * cdef int big_endian = (<char*>&one)[0] != 1 # <<<<<<<<<<<<<< |
| * |
| * if big_endian == 1: |
| */ |
| __pyx_v_big_endian = ((((char *)(&__pyx_v_one))[0]) != 1); |
| |
| /* "cpyamf/util.pyx":129 |
| * cdef int big_endian = (<char*>&one)[0] != 1 |
| * |
| * if big_endian == 1: # <<<<<<<<<<<<<< |
| * return ENDIAN_BIG |
| * else: |
| */ |
| __pyx_t_1 = (__pyx_v_big_endian == 1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":130 |
| * |
| * if big_endian == 1: |
| * return ENDIAN_BIG # <<<<<<<<<<<<<< |
| * else: |
| * return ENDIAN_LITTLE |
| */ |
| __pyx_r = '>'; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":132 |
| * return ENDIAN_BIG |
| * else: |
| * return ENDIAN_LITTLE # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = '<'; |
| goto __pyx_L0; |
| } |
| __pyx_L3:; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":136 |
| * |
| * @cython.profile(False) |
| * cdef inline bint is_big_endian(char endian) nogil: # <<<<<<<<<<<<<< |
| * """ |
| * Returns a boolean value whether the supplied C{endian} is big. |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_is_big_endian(char __pyx_v_endian) { |
| int __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| |
| /* "cpyamf/util.pyx":140 |
| * Returns a boolean value whether the supplied C{endian} is big. |
| * """ |
| * if endian == ENDIAN_NATIVE: # <<<<<<<<<<<<<< |
| * return SYSTEM_ENDIAN == ENDIAN_BIG |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_endian == '@'); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":141 |
| * """ |
| * if endian == ENDIAN_NATIVE: |
| * return SYSTEM_ENDIAN == ENDIAN_BIG # <<<<<<<<<<<<<< |
| * |
| * return endian == ENDIAN_NETWORK or endian == ENDIAN_BIG |
| */ |
| __pyx_r = (__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN == '>'); |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":143 |
| * return SYSTEM_ENDIAN == ENDIAN_BIG |
| * |
| * return endian == ENDIAN_NETWORK or endian == ENDIAN_BIG # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_endian == '!'); |
| if (!__pyx_t_1) { |
| __pyx_t_2 = (__pyx_v_endian == '>'); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| __pyx_r = __pyx_t_3; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":147 |
| * |
| * @cython.profile(False) |
| * cdef inline int is_native_endian(char endian) nogil: # <<<<<<<<<<<<<< |
| * if endian == ENDIAN_NATIVE: |
| * return 1 |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_is_native_endian(char __pyx_v_endian) { |
| int __pyx_r; |
| int __pyx_t_1; |
| |
| /* "cpyamf/util.pyx":148 |
| * @cython.profile(False) |
| * cdef inline int is_native_endian(char endian) nogil: |
| * if endian == ENDIAN_NATIVE: # <<<<<<<<<<<<<< |
| * return 1 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_endian == '@'); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":149 |
| * cdef inline int is_native_endian(char endian) nogil: |
| * if endian == ENDIAN_NATIVE: |
| * return 1 # <<<<<<<<<<<<<< |
| * |
| * if endian == ENDIAN_NETWORK: |
| */ |
| __pyx_r = 1; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":151 |
| * return 1 |
| * |
| * if endian == ENDIAN_NETWORK: # <<<<<<<<<<<<<< |
| * endian = ENDIAN_BIG |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_endian == '!'); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":152 |
| * |
| * if endian == ENDIAN_NETWORK: |
| * endian = ENDIAN_BIG # <<<<<<<<<<<<<< |
| * |
| * return endian == SYSTEM_ENDIAN |
| */ |
| __pyx_v_endian = '>'; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":154 |
| * endian = ENDIAN_BIG |
| * |
| * return endian == SYSTEM_ENDIAN # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = (__pyx_v_endian == __pyx_v_6cpyamf_4util_SYSTEM_ENDIAN); |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":158 |
| * |
| * @cython.profile(False) |
| * cdef inline int swap_bytes(unsigned char *buffer, Py_ssize_t size) nogil: # <<<<<<<<<<<<<< |
| * cdef unsigned char *buf = <unsigned char *>malloc(size) |
| * |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_swap_bytes(unsigned char *__pyx_v_buffer, Py_ssize_t __pyx_v_size) { |
| unsigned char *__pyx_v_buf; |
| Py_ssize_t __pyx_v_i; |
| int __pyx_r; |
| int __pyx_t_1; |
| Py_ssize_t __pyx_t_2; |
| |
| /* "cpyamf/util.pyx":159 |
| * @cython.profile(False) |
| * cdef inline int swap_bytes(unsigned char *buffer, Py_ssize_t size) nogil: |
| * cdef unsigned char *buf = <unsigned char *>malloc(size) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((unsigned char *)malloc(__pyx_v_size)); |
| |
| /* "cpyamf/util.pyx":161 |
| * cdef unsigned char *buf = <unsigned char *>malloc(size) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * return -1 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_buf == NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":162 |
| * |
| * if buf == NULL: |
| * return -1 # <<<<<<<<<<<<<< |
| * |
| * cdef Py_ssize_t i |
| */ |
| __pyx_r = -1; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":166 |
| * cdef Py_ssize_t i |
| * |
| * for i from 0 <= i < size: # <<<<<<<<<<<<<< |
| * buf[i] = buffer[size - i - 1] |
| * |
| */ |
| __pyx_t_2 = __pyx_v_size; |
| for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { |
| |
| /* "cpyamf/util.pyx":167 |
| * |
| * for i from 0 <= i < size: |
| * buf[i] = buffer[size - i - 1] # <<<<<<<<<<<<<< |
| * |
| * memcpy(buffer, buf, size) |
| */ |
| (__pyx_v_buf[__pyx_v_i]) = (__pyx_v_buffer[((__pyx_v_size - __pyx_v_i) - 1)]); |
| } |
| |
| /* "cpyamf/util.pyx":169 |
| * buf[i] = buffer[size - i - 1] |
| * |
| * memcpy(buffer, buf, size) # <<<<<<<<<<<<<< |
| * free(buf) |
| * |
| */ |
| memcpy(__pyx_v_buffer, __pyx_v_buf, __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":170 |
| * |
| * memcpy(buffer, buf, size) |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| free(__pyx_v_buf); |
| |
| /* "cpyamf/util.pyx":172 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":175 |
| * |
| * |
| * cdef bint is_broken_float() except -1: # <<<<<<<<<<<<<< |
| * cdef double test = _PyFloat_Unpack8(NaN, 0) |
| * |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_is_broken_float(void) { |
| double __pyx_v_test; |
| int __pyx_v_result; |
| unsigned char *__pyx_v_buf; |
| int __pyx_r; |
| double __pyx_t_1; |
| int __pyx_t_2; |
| PyObject *__pyx_t_3; |
| __Pyx_RefNannySetupContext("is_broken_float"); |
| |
| /* "cpyamf/util.pyx":176 |
| * |
| * cdef bint is_broken_float() except -1: |
| * cdef double test = _PyFloat_Unpack8(NaN, 0) # <<<<<<<<<<<<<< |
| * |
| * cdef int result |
| */ |
| __pyx_t_1 = _PyFloat_Unpack8(__pyx_v_6cpyamf_4util_NaN, 0); if (unlikely(__pyx_t_1 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_test = __pyx_t_1; |
| |
| /* "cpyamf/util.pyx":179 |
| * |
| * cdef int result |
| * cdef unsigned char *buf = <unsigned char *>&test # <<<<<<<<<<<<<< |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| */ |
| __pyx_v_buf = ((unsigned char *)(&__pyx_v_test)); |
| |
| /* "cpyamf/util.pyx":181 |
| * cdef unsigned char *buf = <unsigned char *>&test |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_2 = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN)); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":182 |
| * |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_2 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":183 |
| * if not is_big_endian(SYSTEM_ENDIAN): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * result = memcmp(NaN, buf, 8) |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":185 |
| * PyErr_NoMemory() |
| * |
| * result = memcmp(NaN, buf, 8) # <<<<<<<<<<<<<< |
| * |
| * return result != 0 |
| */ |
| __pyx_v_result = memcmp(__pyx_v_6cpyamf_4util_NaN, __pyx_v_buf, 8); |
| |
| /* "cpyamf/util.pyx":187 |
| * result = memcmp(NaN, buf, 8) |
| * |
| * return result != 0 # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = (__pyx_v_result != 0); |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.is_broken_float"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":198 |
| * """ |
| * |
| * def __cinit__(self): # <<<<<<<<<<<<<< |
| * self.endian = ENDIAN_NETWORK |
| * self.buffer = NULL |
| */ |
| |
| static int __pyx_pf_6cpyamf_4util_19cBufferedByteStream___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static int __pyx_pf_6cpyamf_4util_19cBufferedByteStream___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| int __pyx_r; |
| __Pyx_RefNannySetupContext("__cinit__"); |
| if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { |
| __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} |
| if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; |
| |
| /* "cpyamf/util.pyx":199 |
| * |
| * def __cinit__(self): |
| * self.endian = ENDIAN_NETWORK # <<<<<<<<<<<<<< |
| * self.buffer = NULL |
| * self.min_buf_size = 512 |
| */ |
| ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->endian = '!'; |
| |
| /* "cpyamf/util.pyx":200 |
| * def __cinit__(self): |
| * self.endian = ENDIAN_NETWORK |
| * self.buffer = NULL # <<<<<<<<<<<<<< |
| * self.min_buf_size = 512 |
| * self.size = 0 |
| */ |
| ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->buffer = NULL; |
| |
| /* "cpyamf/util.pyx":201 |
| * self.endian = ENDIAN_NETWORK |
| * self.buffer = NULL |
| * self.min_buf_size = 512 # <<<<<<<<<<<<<< |
| * self.size = 0 |
| * |
| */ |
| ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->min_buf_size = 512; |
| |
| /* "cpyamf/util.pyx":202 |
| * self.buffer = NULL |
| * self.min_buf_size = 512 |
| * self.size = 0 # <<<<<<<<<<<<<< |
| * |
| * def __dealloc__(self): |
| */ |
| ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->size = 0; |
| |
| __pyx_r = 0; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":204 |
| * self.size = 0 |
| * |
| * def __dealloc__(self): # <<<<<<<<<<<<<< |
| * if self.buffer != NULL: |
| * free(self.buffer) |
| */ |
| |
| static void __pyx_pf_6cpyamf_4util_19cBufferedByteStream_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ |
| static void __pyx_pf_6cpyamf_4util_19cBufferedByteStream_1__dealloc__(PyObject *__pyx_v_self) { |
| int __pyx_t_1; |
| __Pyx_RefNannySetupContext("__dealloc__"); |
| |
| /* "cpyamf/util.pyx":205 |
| * |
| * def __dealloc__(self): |
| * if self.buffer != NULL: # <<<<<<<<<<<<<< |
| * free(self.buffer) |
| * |
| */ |
| __pyx_t_1 = (((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->buffer != NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":206 |
| * def __dealloc__(self): |
| * if self.buffer != NULL: |
| * free(self.buffer) # <<<<<<<<<<<<<< |
| * |
| * self.buffer = NULL |
| */ |
| free(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->buffer); |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":208 |
| * free(self.buffer) |
| * |
| * self.buffer = NULL # <<<<<<<<<<<<<< |
| * |
| * cdef inline int _init_buffer(self) except -1: |
| */ |
| ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->buffer = NULL; |
| |
| __Pyx_RefNannyFinishContext(); |
| } |
| |
| /* "cpyamf/util.pyx":210 |
| * self.buffer = NULL |
| * |
| * cdef inline int _init_buffer(self) except -1: # <<<<<<<<<<<<<< |
| * if self.buffer != NULL: |
| * free(self.buffer) |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_19cBufferedByteStream__init_buffer(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self) { |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2; |
| __Pyx_RefNannySetupContext("_init_buffer"); |
| |
| /* "cpyamf/util.pyx":211 |
| * |
| * cdef inline int _init_buffer(self) except -1: |
| * if self.buffer != NULL: # <<<<<<<<<<<<<< |
| * free(self.buffer) |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_self->buffer != NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":212 |
| * cdef inline int _init_buffer(self) except -1: |
| * if self.buffer != NULL: |
| * free(self.buffer) # <<<<<<<<<<<<<< |
| * |
| * self.buffer = NULL |
| */ |
| free(__pyx_v_self->buffer); |
| |
| /* "cpyamf/util.pyx":214 |
| * free(self.buffer) |
| * |
| * self.buffer = NULL # <<<<<<<<<<<<<< |
| * |
| * self.pos = 0 |
| */ |
| __pyx_v_self->buffer = NULL; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":216 |
| * self.buffer = NULL |
| * |
| * self.pos = 0 # <<<<<<<<<<<<<< |
| * self.length = 0 |
| * self.size = self.min_buf_size |
| */ |
| __pyx_v_self->pos = 0; |
| |
| /* "cpyamf/util.pyx":217 |
| * |
| * self.pos = 0 |
| * self.length = 0 # <<<<<<<<<<<<<< |
| * self.size = self.min_buf_size |
| * |
| */ |
| __pyx_v_self->length = 0; |
| |
| /* "cpyamf/util.pyx":218 |
| * self.pos = 0 |
| * self.length = 0 |
| * self.size = self.min_buf_size # <<<<<<<<<<<<<< |
| * |
| * self.buffer = <char *>malloc(self.size) |
| */ |
| __pyx_v_self->size = __pyx_v_self->min_buf_size; |
| |
| /* "cpyamf/util.pyx":220 |
| * self.size = self.min_buf_size |
| * |
| * self.buffer = <char *>malloc(self.size) # <<<<<<<<<<<<<< |
| * |
| * if self.buffer == NULL: |
| */ |
| __pyx_v_self->buffer = ((char *)malloc(__pyx_v_self->size)); |
| |
| /* "cpyamf/util.pyx":222 |
| * self.buffer = <char *>malloc(self.size) |
| * |
| * if self.buffer == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_self->buffer == NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":223 |
| * |
| * if self.buffer == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":225 |
| * PyErr_NoMemory() |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef inline Py_ssize_t tell(self): |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_WriteUnraisable("cpyamf.util.cBufferedByteStream._init_buffer"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":227 |
| * return 0 |
| * |
| * cpdef inline Py_ssize_t tell(self): # <<<<<<<<<<<<<< |
| * """ |
| * Returns the position of the stream pointer. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_2tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static CYTHON_INLINE Py_ssize_t __pyx_f_6cpyamf_4util_19cBufferedByteStream_tell(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| Py_ssize_t __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| Py_ssize_t __pyx_t_3; |
| __Pyx_RefNannySetupContext("tell"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_2tell)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":231 |
| * Returns the position of the stream pointer. |
| * """ |
| * return self.pos # <<<<<<<<<<<<<< |
| * |
| * cdef int _actually_increase_buffer(self, Py_ssize_t new_size) except -1: |
| */ |
| __pyx_r = __pyx_v_self->pos; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.tell"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":227 |
| * return 0 |
| * |
| * cpdef inline Py_ssize_t tell(self): # <<<<<<<<<<<<<< |
| * """ |
| * Returns the position of the stream pointer. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_2tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_2tell[] = "\n Returns the position of the stream pointer.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_2tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| Py_ssize_t __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("tell"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->tell(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.tell"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":233 |
| * return self.pos |
| * |
| * cdef int _actually_increase_buffer(self, Py_ssize_t new_size) except -1: # <<<<<<<<<<<<<< |
| * if self.size == 0: |
| * self._init_buffer() |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream__actually_increase_buffer(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, Py_ssize_t __pyx_v_new_size) { |
| Py_ssize_t __pyx_v_requested_size; |
| char *__pyx_v_buf; |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2; |
| __Pyx_RefNannySetupContext("_actually_increase_buffer"); |
| |
| /* "cpyamf/util.pyx":234 |
| * |
| * cdef int _actually_increase_buffer(self, Py_ssize_t new_size) except -1: |
| * if self.size == 0: # <<<<<<<<<<<<<< |
| * self._init_buffer() |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_self->size == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":235 |
| * cdef int _actually_increase_buffer(self, Py_ssize_t new_size) except -1: |
| * if self.size == 0: |
| * self._init_buffer() # <<<<<<<<<<<<<< |
| * |
| * cdef Py_ssize_t requested_size = self.size |
| */ |
| ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_init_buffer(__pyx_v_self); |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":237 |
| * self._init_buffer() |
| * |
| * cdef Py_ssize_t requested_size = self.size # <<<<<<<<<<<<<< |
| * cdef char *buf |
| * |
| */ |
| __pyx_v_requested_size = __pyx_v_self->size; |
| |
| /* "cpyamf/util.pyx":240 |
| * cdef char *buf |
| * |
| * while new_size > requested_size: # <<<<<<<<<<<<<< |
| * requested_size *= 2 |
| * |
| */ |
| while (1) { |
| __pyx_t_1 = (__pyx_v_new_size > __pyx_v_requested_size); |
| if (!__pyx_t_1) break; |
| |
| /* "cpyamf/util.pyx":241 |
| * |
| * while new_size > requested_size: |
| * requested_size *= 2 # <<<<<<<<<<<<<< |
| * |
| * if requested_size > new_size + MAX_BUFFER_EXTENSION: |
| */ |
| __pyx_v_requested_size = (__pyx_v_requested_size * 2); |
| } |
| |
| /* "cpyamf/util.pyx":243 |
| * requested_size *= 2 |
| * |
| * if requested_size > new_size + MAX_BUFFER_EXTENSION: # <<<<<<<<<<<<<< |
| * requested_size = new_size + MAX_BUFFER_EXTENSION |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_requested_size > (__pyx_v_new_size + 16384)); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":244 |
| * |
| * if requested_size > new_size + MAX_BUFFER_EXTENSION: |
| * requested_size = new_size + MAX_BUFFER_EXTENSION # <<<<<<<<<<<<<< |
| * |
| * buf = <char *>realloc(self.buffer, sizeof(char *) * requested_size) |
| */ |
| __pyx_v_requested_size = (__pyx_v_new_size + 16384); |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":246 |
| * requested_size = new_size + MAX_BUFFER_EXTENSION |
| * |
| * buf = <char *>realloc(self.buffer, sizeof(char *) * requested_size) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((char *)realloc(__pyx_v_self->buffer, ((sizeof(char *)) * __pyx_v_requested_size))); |
| |
| /* "cpyamf/util.pyx":248 |
| * buf = <char *>realloc(self.buffer, sizeof(char *) * requested_size) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_buf == NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":249 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * self.buffer = buf |
| */ |
| __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| |
| /* "cpyamf/util.pyx":251 |
| * PyErr_NoMemory() |
| * |
| * self.buffer = buf # <<<<<<<<<<<<<< |
| * self.size = requested_size |
| * |
| */ |
| __pyx_v_self->buffer = __pyx_v_buf; |
| |
| /* "cpyamf/util.pyx":252 |
| * |
| * self.buffer = buf |
| * self.size = requested_size # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_v_self->size = __pyx_v_requested_size; |
| |
| /* "cpyamf/util.pyx":254 |
| * self.size = requested_size |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef inline int _increase_buffer(self, Py_ssize_t size) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream._actually_increase_buffer"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":256 |
| * return 0 |
| * |
| * cdef inline int _increase_buffer(self, Py_ssize_t size) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Request to increase the buffer by C{size} |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_19cBufferedByteStream__increase_buffer(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, Py_ssize_t __pyx_v_size) { |
| Py_ssize_t __pyx_v_new_len; |
| int __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| __Pyx_RefNannySetupContext("_increase_buffer"); |
| |
| /* "cpyamf/util.pyx":260 |
| * Request to increase the buffer by C{size} |
| * """ |
| * cdef Py_ssize_t new_len = self.length + size # <<<<<<<<<<<<<< |
| * |
| * if new_len <= self.size: |
| */ |
| __pyx_v_new_len = (__pyx_v_self->length + __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":262 |
| * cdef Py_ssize_t new_len = self.length + size |
| * |
| * if new_len <= self.size: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_new_len <= __pyx_v_self->size); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":263 |
| * |
| * if new_len <= self.size: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * return self._actually_increase_buffer(new_len) |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":265 |
| * return 0 |
| * |
| * return self._actually_increase_buffer(new_len) # <<<<<<<<<<<<<< |
| * |
| * cdef int write(self, char *buf, Py_ssize_t size) except -1: |
| */ |
| __pyx_t_2 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_actually_increase_buffer(__pyx_v_self, __pyx_v_new_len); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_2; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream._increase_buffer"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":267 |
| * return self._actually_increase_buffer(new_len) |
| * |
| * cdef int write(self, char *buf, Py_ssize_t size) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes the content of the specified C{buf} into this buffer. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, char *__pyx_v_buf, Py_ssize_t __pyx_v_size) { |
| int __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| __Pyx_RefNannySetupContext("write"); |
| |
| /* "cpyamf/util.pyx":271 |
| * Writes the content of the specified C{buf} into this buffer. |
| * """ |
| * assert buf != NULL, 'buf cannot be NULL' # <<<<<<<<<<<<<< |
| * |
| * if size == 0: |
| */ |
| #ifndef CYTHON_WITHOUT_ASSERTIONS |
| if (unlikely(!(__pyx_v_buf != NULL))) { |
| PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_2)); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| #endif |
| |
| /* "cpyamf/util.pyx":273 |
| * assert buf != NULL, 'buf cannot be NULL' |
| * |
| * if size == 0: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_size == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":274 |
| * |
| * if size == 0: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * self._increase_buffer(size) |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":276 |
| * return 0 |
| * |
| * self._increase_buffer(size) # <<<<<<<<<<<<<< |
| * |
| * memcpy(self.buffer + self.pos, buf, size) |
| */ |
| __pyx_t_2 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_increase_buffer(__pyx_v_self, __pyx_v_size); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":278 |
| * self._increase_buffer(size) |
| * |
| * memcpy(self.buffer + self.pos, buf, size) # <<<<<<<<<<<<<< |
| * |
| * self.pos += size |
| */ |
| memcpy((__pyx_v_self->buffer + __pyx_v_self->pos), __pyx_v_buf, __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":280 |
| * memcpy(self.buffer + self.pos, buf, size) |
| * |
| * self.pos += size # <<<<<<<<<<<<<< |
| * |
| * if self.pos > self.length: |
| */ |
| __pyx_v_self->pos = (__pyx_v_self->pos + __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":282 |
| * self.pos += size |
| * |
| * if self.pos > self.length: # <<<<<<<<<<<<<< |
| * self.length = self.pos |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_self->pos > __pyx_v_self->length); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":283 |
| * |
| * if self.pos > self.length: |
| * self.length = self.pos # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_v_self->length = __pyx_v_self->pos; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":285 |
| * self.length = self.pos |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef inline bint has_available(self, Py_ssize_t size): |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":287 |
| * return 0 |
| * |
| * cdef inline bint has_available(self, Py_ssize_t size): # <<<<<<<<<<<<<< |
| * if size == 0: |
| * return 1 |
| */ |
| |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_19cBufferedByteStream_has_available(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, Py_ssize_t __pyx_v_size) { |
| int __pyx_r; |
| int __pyx_t_1; |
| __Pyx_RefNannySetupContext("has_available"); |
| |
| /* "cpyamf/util.pyx":288 |
| * |
| * cdef inline bint has_available(self, Py_ssize_t size): |
| * if size == 0: # <<<<<<<<<<<<<< |
| * return 1 |
| * elif size < 0: |
| */ |
| __pyx_t_1 = (__pyx_v_size == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":289 |
| * cdef inline bint has_available(self, Py_ssize_t size): |
| * if size == 0: |
| * return 1 # <<<<<<<<<<<<<< |
| * elif size < 0: |
| * return 0 |
| */ |
| __pyx_r = 1; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| |
| /* "cpyamf/util.pyx":290 |
| * if size == 0: |
| * return 1 |
| * elif size < 0: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_size < 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":291 |
| * return 1 |
| * elif size < 0: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * if self.length == self.pos: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":293 |
| * return 0 |
| * |
| * if self.length == self.pos: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_self->length == __pyx_v_self->pos); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":294 |
| * |
| * if self.length == self.pos: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * if self.pos + size > self.length: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":296 |
| * return 0 |
| * |
| * if self.pos + size > self.length: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_1 = ((__pyx_v_self->pos + __pyx_v_size) > __pyx_v_self->length); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":297 |
| * |
| * if self.pos + size > self.length: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * return 1 |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":299 |
| * return 0 |
| * |
| * return 1 # <<<<<<<<<<<<<< |
| * |
| * cdef int read(self, char **buf, Py_ssize_t size) except -1: |
| */ |
| __pyx_r = 1; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":301 |
| * return 1 |
| * |
| * cdef int read(self, char **buf, Py_ssize_t size) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Reads up to the specified number of bytes from the stream into |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_read(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, char **__pyx_v_buf, Py_ssize_t __pyx_v_size) { |
| int __pyx_r; |
| int __pyx_t_1; |
| Py_ssize_t __pyx_t_2; |
| int __pyx_t_3; |
| __Pyx_RefNannySetupContext("read"); |
| |
| /* "cpyamf/util.pyx":308 |
| * Do not free the results or bad things will happen |
| * """ |
| * if size == -1: # <<<<<<<<<<<<<< |
| * size = self.remaining() |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_size == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":309 |
| * """ |
| * if size == -1: |
| * size = self.remaining() # <<<<<<<<<<<<<< |
| * |
| * if size == 0: |
| */ |
| __pyx_t_2 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->remaining(__pyx_v_self, 0); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_size = __pyx_t_2; |
| |
| /* "cpyamf/util.pyx":311 |
| * size = self.remaining() |
| * |
| * if size == 0: # <<<<<<<<<<<<<< |
| * size = 1 |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_size == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":312 |
| * |
| * if size == 0: |
| * size = 1 # <<<<<<<<<<<<<< |
| * |
| * if not self.has_available(size): |
| */ |
| __pyx_v_size = 1; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":314 |
| * size = 1 |
| * |
| * if not self.has_available(size): # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->has_available(__pyx_v_self, __pyx_v_size); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = (!__pyx_t_1); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":315 |
| * |
| * if not self.has_available(size): |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * buf[0] = self.buffer + self.pos |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":317 |
| * raise IOError |
| * |
| * buf[0] = self.buffer + self.pos # <<<<<<<<<<<<<< |
| * |
| * self.pos += size |
| */ |
| (__pyx_v_buf[0]) = (__pyx_v_self->buffer + __pyx_v_self->pos); |
| |
| /* "cpyamf/util.pyx":319 |
| * buf[0] = self.buffer + self.pos |
| * |
| * self.pos += size # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_v_self->pos = (__pyx_v_self->pos + __pyx_v_size); |
| |
| /* "cpyamf/util.pyx":321 |
| * self.pos += size |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef inline bint at_eof(self) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":323 |
| * return 0 |
| * |
| * cpdef inline bint at_eof(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Returns C{True} if the internal pointer is at the end of the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_3at_eof(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static CYTHON_INLINE int __pyx_f_6cpyamf_4util_19cBufferedByteStream_at_eof(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| int __pyx_t_3; |
| __Pyx_RefNannySetupContext("at_eof"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__at_eof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_3at_eof)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":329 |
| * @rtype: C{bool} |
| * """ |
| * return self.length == self.pos # <<<<<<<<<<<<<< |
| * |
| * cpdef inline Py_ssize_t remaining(self) except -1: |
| */ |
| __pyx_r = (__pyx_v_self->length == __pyx_v_self->pos); |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.at_eof"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":323 |
| * return 0 |
| * |
| * cpdef inline bint at_eof(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Returns C{True} if the internal pointer is at the end of the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_3at_eof(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_3at_eof[] = "\n Returns C{True} if the internal pointer is at the end of the stream.\n\n @rtype: C{bool}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_3at_eof(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("at_eof"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->at_eof(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.at_eof"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":331 |
| * return self.length == self.pos |
| * |
| * cpdef inline Py_ssize_t remaining(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Returns number of remaining bytes. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_4remaining(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static CYTHON_INLINE Py_ssize_t __pyx_f_6cpyamf_4util_19cBufferedByteStream_remaining(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| Py_ssize_t __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| Py_ssize_t __pyx_t_3; |
| __Pyx_RefNannySetupContext("remaining"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__remaining); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_4remaining)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":335 |
| * Returns number of remaining bytes. |
| * """ |
| * return self.length - self.pos # <<<<<<<<<<<<<< |
| * |
| * cpdef int seek(self, Py_ssize_t pos, int mode=0) except -1: |
| */ |
| __pyx_r = (__pyx_v_self->length - __pyx_v_self->pos); |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.remaining"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":331 |
| * return self.length == self.pos |
| * |
| * cpdef inline Py_ssize_t remaining(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Returns number of remaining bytes. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_4remaining(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_4remaining[] = "\n Returns number of remaining bytes.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_4remaining(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| Py_ssize_t __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("remaining"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->remaining(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.remaining"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":337 |
| * return self.length - self.pos |
| * |
| * cpdef int seek(self, Py_ssize_t pos, int mode=0) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Sets the file-pointer offset, measured from the beginning of this stream, |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_5seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_seek(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, Py_ssize_t __pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek *__pyx_optional_args) { |
| int __pyx_v_mode = ((int)0); |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| PyObject *__pyx_t_4 = NULL; |
| int __pyx_t_5; |
| int __pyx_t_6; |
| int __pyx_t_7; |
| int __pyx_t_8; |
| __Pyx_RefNannySetupContext("seek"); |
| if (__pyx_optional_args) { |
| if (__pyx_optional_args->__pyx_n > 0) { |
| __pyx_v_mode = __pyx_optional_args->mode; |
| } |
| } |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_5seek)) { |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyInt_FromLong(__pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); |
| __Pyx_GIVEREF(__pyx_t_3); |
| __pyx_t_2 = 0; |
| __pyx_t_3 = 0; |
| __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_r = __pyx_t_5; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":354 |
| * |
| * self.pos += pos |
| * elif mode == 2: # <<<<<<<<<<<<<< |
| * if pos + self.length < 0 or pos + self.length > self.length: |
| * raise IOError |
| */ |
| switch (__pyx_v_mode) { |
| |
| /* "cpyamf/util.pyx":344 |
| * @param mode: mode 0: absolute; 1: relative; 2: relative to EOF |
| * """ |
| * if mode == 0: # <<<<<<<<<<<<<< |
| * if pos < 0 or pos > self.length: |
| * raise IOError |
| */ |
| case 0: |
| |
| /* "cpyamf/util.pyx":345 |
| * """ |
| * if mode == 0: |
| * if pos < 0 or pos > self.length: # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_6 = (__pyx_v_pos < 0); |
| if (!__pyx_t_6) { |
| __pyx_t_7 = (__pyx_v_pos > __pyx_v_self->length); |
| __pyx_t_8 = __pyx_t_7; |
| } else { |
| __pyx_t_8 = __pyx_t_6; |
| } |
| if (__pyx_t_8) { |
| |
| /* "cpyamf/util.pyx":346 |
| * if mode == 0: |
| * if pos < 0 or pos > self.length: |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * self.pos = pos |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":348 |
| * raise IOError |
| * |
| * self.pos = pos # <<<<<<<<<<<<<< |
| * elif mode == 1: |
| * if pos + self.pos < 0 or pos + self.pos > self.length: |
| */ |
| __pyx_v_self->pos = __pyx_v_pos; |
| break; |
| |
| /* "cpyamf/util.pyx":349 |
| * |
| * self.pos = pos |
| * elif mode == 1: # <<<<<<<<<<<<<< |
| * if pos + self.pos < 0 or pos + self.pos > self.length: |
| * raise IOError |
| */ |
| case 1: |
| |
| /* "cpyamf/util.pyx":350 |
| * self.pos = pos |
| * elif mode == 1: |
| * if pos + self.pos < 0 or pos + self.pos > self.length: # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_8 = ((__pyx_v_pos + __pyx_v_self->pos) < 0); |
| if (!__pyx_t_8) { |
| __pyx_t_6 = ((__pyx_v_pos + __pyx_v_self->pos) > __pyx_v_self->length); |
| __pyx_t_7 = __pyx_t_6; |
| } else { |
| __pyx_t_7 = __pyx_t_8; |
| } |
| if (__pyx_t_7) { |
| |
| /* "cpyamf/util.pyx":351 |
| * elif mode == 1: |
| * if pos + self.pos < 0 or pos + self.pos > self.length: |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * self.pos += pos |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":353 |
| * raise IOError |
| * |
| * self.pos += pos # <<<<<<<<<<<<<< |
| * elif mode == 2: |
| * if pos + self.length < 0 or pos + self.length > self.length: |
| */ |
| __pyx_v_self->pos = (__pyx_v_self->pos + __pyx_v_pos); |
| break; |
| |
| /* "cpyamf/util.pyx":354 |
| * |
| * self.pos += pos |
| * elif mode == 2: # <<<<<<<<<<<<<< |
| * if pos + self.length < 0 or pos + self.length > self.length: |
| * raise IOError |
| */ |
| case 2: |
| |
| /* "cpyamf/util.pyx":355 |
| * self.pos += pos |
| * elif mode == 2: |
| * if pos + self.length < 0 or pos + self.length > self.length: # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_7 = ((__pyx_v_pos + __pyx_v_self->length) < 0); |
| if (!__pyx_t_7) { |
| __pyx_t_8 = ((__pyx_v_pos + __pyx_v_self->length) > __pyx_v_self->length); |
| __pyx_t_6 = __pyx_t_8; |
| } else { |
| __pyx_t_6 = __pyx_t_7; |
| } |
| if (__pyx_t_6) { |
| |
| /* "cpyamf/util.pyx":356 |
| * elif mode == 2: |
| * if pos + self.length < 0 or pos + self.length > self.length: |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * self.pos = self.length + pos |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":358 |
| * raise IOError |
| * |
| * self.pos = self.length + pos # <<<<<<<<<<<<<< |
| * else: |
| * raise ValueError('Bad value for mode') |
| */ |
| __pyx_v_self->pos = (__pyx_v_self->length + __pyx_v_pos); |
| break; |
| default: |
| |
| /* "cpyamf/util.pyx":360 |
| * self.pos = self.length + pos |
| * else: |
| * raise ValueError('Bad value for mode') # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_Raise(__pyx_t_1, 0, 0); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| break; |
| } |
| |
| /* "cpyamf/util.pyx":362 |
| * raise ValueError('Bad value for mode') |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef object getvalue(self): |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.seek"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":337 |
| * return self.length - self.pos |
| * |
| * cpdef int seek(self, Py_ssize_t pos, int mode=0) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Sets the file-pointer offset, measured from the beginning of this stream, |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_5seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_5seek[] = "\n Sets the file-pointer offset, measured from the beginning of this stream,\n at which the next write operation will occur.\n\n @param mode: mode 0: absolute; 1: relative; 2: relative to EOF\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_5seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| Py_ssize_t __pyx_v_pos; |
| int __pyx_v_mode; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek __pyx_t_2; |
| PyObject *__pyx_t_3 = NULL; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__mode,0}; |
| __Pyx_RefNannySetupContext("seek"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[2] = {0,0}; |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); |
| if (likely(values[0])) kw_args--; |
| else goto __pyx_L5_argtuple_error; |
| case 1: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); |
| if (value) { values[1] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| __pyx_v_pos = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| if (values[1]) { |
| __pyx_v_mode = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } else { |
| __pyx_v_mode = ((int)0); |
| } |
| } else { |
| __pyx_v_mode = ((int)0); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: __pyx_v_mode = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| case 1: __pyx_v_pos = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_pos == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.seek"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_2.__pyx_n = 1; |
| __pyx_t_2.mode = __pyx_v_mode; |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->seek(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_pos, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_r = __pyx_t_3; |
| __pyx_t_3 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.seek"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":364 |
| * return 0 |
| * |
| * cpdef object getvalue(self): # <<<<<<<<<<<<<< |
| * """ |
| * Get raw data from buffer. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_6getvalue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static PyObject *__pyx_f_6cpyamf_4util_19cBufferedByteStream_getvalue(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("getvalue"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__getvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_6getvalue)) { |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":368 |
| * Get raw data from buffer. |
| * """ |
| * return PyString_FromStringAndSize(self.buffer, self.length) # <<<<<<<<<<<<<< |
| * |
| * cdef Py_ssize_t peek(self, char **buf, Py_ssize_t size) except -1: |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = PyString_FromStringAndSize(__pyx_v_self->buffer, __pyx_v_self->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.getvalue"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":364 |
| * return 0 |
| * |
| * cpdef object getvalue(self): # <<<<<<<<<<<<<< |
| * """ |
| * Get raw data from buffer. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_6getvalue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_6getvalue[] = "\n Get raw data from buffer.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_6getvalue(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| __Pyx_RefNannySetupContext("getvalue"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->getvalue(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.getvalue"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":370 |
| * return PyString_FromStringAndSize(self.buffer, self.length) |
| * |
| * cdef Py_ssize_t peek(self, char **buf, Py_ssize_t size) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Makes a pointer reference to the underlying buffer. Do NOT modify the |
| */ |
| |
| static Py_ssize_t __pyx_f_6cpyamf_4util_19cBufferedByteStream_peek(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, char **__pyx_v_buf, Py_ssize_t __pyx_v_size) { |
| Py_ssize_t __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| __Pyx_RefNannySetupContext("peek"); |
| |
| /* "cpyamf/util.pyx":375 |
| * returned value or free its contents. That would be seriously bad. |
| * """ |
| * if not self.has_available(size): # <<<<<<<<<<<<<< |
| * size = self.length - self.pos |
| * |
| */ |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->has_available(__pyx_v_self, __pyx_v_size); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = (!__pyx_t_1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":376 |
| * """ |
| * if not self.has_available(size): |
| * size = self.length - self.pos # <<<<<<<<<<<<<< |
| * |
| * buf[0] = self.buffer + self.pos |
| */ |
| __pyx_v_size = (__pyx_v_self->length - __pyx_v_self->pos); |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":378 |
| * size = self.length - self.pos |
| * |
| * buf[0] = self.buffer + self.pos # <<<<<<<<<<<<<< |
| * |
| * return size |
| */ |
| (__pyx_v_buf[0]) = (__pyx_v_self->buffer + __pyx_v_self->pos); |
| |
| /* "cpyamf/util.pyx":380 |
| * buf[0] = self.buffer + self.pos |
| * |
| * return size # <<<<<<<<<<<<<< |
| * |
| * cpdef int truncate(self, Py_ssize_t size=0) except -1: |
| */ |
| __pyx_r = __pyx_v_size; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.peek"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":382 |
| * return size |
| * |
| * cpdef int truncate(self, Py_ssize_t size=0) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Truncates the stream to the specified length. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_7truncate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_truncate(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_truncate *__pyx_optional_args) { |
| Py_ssize_t __pyx_v_size = ((Py_ssize_t)0); |
| char *__pyx_v_buf; |
| Py_ssize_t __pyx_v_cur_pos; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| PyObject *__pyx_t_6; |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek __pyx_t_7; |
| __Pyx_RefNannySetupContext("truncate"); |
| if (__pyx_optional_args) { |
| if (__pyx_optional_args->__pyx_n > 0) { |
| __pyx_v_size = __pyx_optional_args->size; |
| } |
| } |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__truncate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_7truncate)) { |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":389 |
| * @type size: C{int} |
| * """ |
| * if size > self.length: # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_size > __pyx_v_self->length); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":390 |
| * """ |
| * if size > self.length: |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * if size == 0: |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":392 |
| * raise IOError |
| * |
| * if size == 0: # <<<<<<<<<<<<<< |
| * return self._init_buffer() |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_size == 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":393 |
| * |
| * if size == 0: |
| * return self._init_buffer() # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = NULL |
| */ |
| __pyx_r = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_init_buffer(__pyx_v_self); |
| goto __pyx_L0; |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":395 |
| * return self._init_buffer() |
| * |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * cdef Py_ssize_t cur_pos = self.pos |
| * |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":396 |
| * |
| * cdef char *buf = NULL |
| * cdef Py_ssize_t cur_pos = self.pos # <<<<<<<<<<<<<< |
| * |
| * buf = <char *>malloc(self.length) |
| */ |
| __pyx_v_cur_pos = __pyx_v_self->pos; |
| |
| /* "cpyamf/util.pyx":398 |
| * cdef Py_ssize_t cur_pos = self.pos |
| * |
| * buf = <char *>malloc(self.length) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((char *)malloc(__pyx_v_self->length)); |
| |
| /* "cpyamf/util.pyx":400 |
| * buf = <char *>malloc(self.length) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_buf == NULL); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":401 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * memcpy(buf, self.buffer, self.length) |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":403 |
| * PyErr_NoMemory() |
| * |
| * memcpy(buf, self.buffer, self.length) # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| memcpy(__pyx_v_buf, __pyx_v_self->buffer, __pyx_v_self->length); |
| |
| /* "cpyamf/util.pyx":405 |
| * memcpy(buf, self.buffer, self.length) |
| * |
| * try: # <<<<<<<<<<<<<< |
| * self._init_buffer() |
| * |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":406 |
| * |
| * try: |
| * self._init_buffer() # <<<<<<<<<<<<<< |
| * |
| * self.write(buf, size) |
| */ |
| ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_init_buffer(__pyx_v_self); |
| |
| /* "cpyamf/util.pyx":408 |
| * self._init_buffer() |
| * |
| * self.write(buf, size) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_buf, __pyx_v_size); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7;} |
| } |
| |
| /* "cpyamf/util.pyx":410 |
| * self.write(buf, size) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * if self.length > cur_pos: |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L8; |
| __pyx_L7: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L8; |
| } |
| __pyx_L8:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":412 |
| * free(buf) |
| * |
| * if self.length > cur_pos: # <<<<<<<<<<<<<< |
| * self.pos = self.length |
| * else: |
| */ |
| __pyx_t_5 = (__pyx_v_self->length > __pyx_v_cur_pos); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":413 |
| * |
| * if self.length > cur_pos: |
| * self.pos = self.length # <<<<<<<<<<<<<< |
| * else: |
| * self.seek(cur_pos, 0) |
| */ |
| __pyx_v_self->pos = __pyx_v_self->length; |
| goto __pyx_L10; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":415 |
| * self.pos = self.length |
| * else: |
| * self.seek(cur_pos, 0) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_7.__pyx_n = 1; |
| __pyx_t_7.mode = 0; |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->seek(__pyx_v_self, __pyx_v_cur_pos, 0, &__pyx_t_7); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| __pyx_L10:; |
| |
| /* "cpyamf/util.pyx":417 |
| * self.seek(cur_pos, 0) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef int consume(self) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.truncate"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":382 |
| * return size |
| * |
| * cpdef int truncate(self, Py_ssize_t size=0) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Truncates the stream to the specified length. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_7truncate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_7truncate[] = "\n Truncates the stream to the specified length.\n\n @param size: The length of the stream, in bytes.\n @type size: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_7truncate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| Py_ssize_t __pyx_v_size; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_truncate __pyx_t_2; |
| PyObject *__pyx_t_3 = NULL; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| __Pyx_RefNannySetupContext("truncate"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[1] = {0}; |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| if (value) { values[0] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "truncate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| if (values[0]) { |
| __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } else { |
| __pyx_v_size = ((Py_ssize_t)0); |
| } |
| } else { |
| __pyx_v_size = ((Py_ssize_t)0); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: __pyx_v_size = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("truncate", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.truncate"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_2.__pyx_n = 1; |
| __pyx_t_2.size = __pyx_v_size; |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->truncate(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_r = __pyx_t_3; |
| __pyx_t_3 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.truncate"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":419 |
| * return 0 |
| * |
| * cpdef int consume(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Chops the tail off the stream starting at 0 and ending at C{tell()}. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_8consume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_consume(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| char *__pyx_v_buf; |
| char *__pyx_v_peek_buf; |
| Py_ssize_t __pyx_v_size; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| int __pyx_t_3; |
| Py_ssize_t __pyx_t_4; |
| int __pyx_t_5; |
| PyObject *__pyx_t_6; |
| __Pyx_RefNannySetupContext("consume"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__consume); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_8consume)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":424 |
| * The stream pointer is set to 0 at the end of this function. |
| * """ |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * cdef char *peek_buf |
| * cdef Py_ssize_t size = self.remaining() |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":426 |
| * cdef char *buf = NULL |
| * cdef char *peek_buf |
| * cdef Py_ssize_t size = self.remaining() # <<<<<<<<<<<<<< |
| * |
| * if size > 0: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->remaining(__pyx_v_self, 0); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_size = __pyx_t_4; |
| |
| /* "cpyamf/util.pyx":428 |
| * cdef Py_ssize_t size = self.remaining() |
| * |
| * if size > 0: # <<<<<<<<<<<<<< |
| * size = self.peek(&peek_buf, size) |
| * buf = <char *>malloc(size) |
| */ |
| __pyx_t_5 = (__pyx_v_size > 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":429 |
| * |
| * if size > 0: |
| * size = self.peek(&peek_buf, size) # <<<<<<<<<<<<<< |
| * buf = <char *>malloc(size) |
| * |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->peek(__pyx_v_self, (&__pyx_v_peek_buf), __pyx_v_size); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_size = __pyx_t_4; |
| |
| /* "cpyamf/util.pyx":430 |
| * if size > 0: |
| * size = self.peek(&peek_buf, size) |
| * buf = <char *>malloc(size) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((char *)malloc(__pyx_v_size)); |
| |
| /* "cpyamf/util.pyx":432 |
| * buf = <char *>malloc(size) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_buf == NULL); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":433 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * memcpy(buf, peek_buf, size) |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":435 |
| * PyErr_NoMemory() |
| * |
| * memcpy(buf, peek_buf, size) # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| memcpy(__pyx_v_buf, __pyx_v_peek_buf, __pyx_v_size); |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":437 |
| * memcpy(buf, peek_buf, size) |
| * |
| * try: # <<<<<<<<<<<<<< |
| * self._init_buffer() |
| * |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":438 |
| * |
| * try: |
| * self._init_buffer() # <<<<<<<<<<<<<< |
| * |
| * if size > 0: |
| */ |
| ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->_init_buffer(__pyx_v_self); |
| |
| /* "cpyamf/util.pyx":440 |
| * self._init_buffer() |
| * |
| * if size > 0: # <<<<<<<<<<<<<< |
| * self.write(buf, size) |
| * finally: |
| */ |
| __pyx_t_5 = (__pyx_v_size > 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":441 |
| * |
| * if size > 0: |
| * self.write(buf, size) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_3 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_buf, __pyx_v_size); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L6;} |
| goto __pyx_L8; |
| } |
| __pyx_L8:; |
| } |
| |
| /* "cpyamf/util.pyx":443 |
| * self.write(buf, size) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * self.pos = 0 |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L7; |
| __pyx_L6: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":445 |
| * free(buf) |
| * |
| * self.pos = 0 # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_v_self->pos = 0; |
| |
| /* "cpyamf/util.pyx":447 |
| * self.pos = 0 |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef int unpack_int(self, unsigned int num_bytes, void *ret) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.consume"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":419 |
| * return 0 |
| * |
| * cpdef int consume(self) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Chops the tail off the stream starting at 0 and ending at C{tell()}. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_8consume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_8consume[] = "\n Chops the tail off the stream starting at 0 and ending at C{tell()}.\n The stream pointer is set to 0 at the end of this function.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_8consume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("consume"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->consume(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.consume"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":449 |
| * return 0 |
| * |
| * cdef int unpack_int(self, unsigned int num_bytes, void *ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Unpacks a long from C{buf}. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_unpack_int(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, unsigned int __pyx_v_num_bytes, void *__pyx_v_ret) { |
| Py_ssize_t __pyx_v_nb; |
| unsigned long __pyx_v_x; |
| unsigned char *__pyx_v_bytes; |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| int __pyx_t_3; |
| unsigned int __pyx_t_4; |
| __Pyx_RefNannySetupContext("unpack_int"); |
| |
| /* "cpyamf/util.pyx":455 |
| * cdef Py_ssize_t nb |
| * |
| * if num_bytes > 4: # <<<<<<<<<<<<<< |
| * raise ValueError('Max 4 bytes to unpack') |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_num_bytes > 4); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":456 |
| * |
| * if num_bytes > 4: |
| * raise ValueError('Max 4 bytes to unpack') # <<<<<<<<<<<<<< |
| * |
| * if not self.has_available(num_bytes): |
| */ |
| __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_Raise(__pyx_t_2, 0, 0); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":458 |
| * raise ValueError('Max 4 bytes to unpack') |
| * |
| * if not self.has_available(num_bytes): # <<<<<<<<<<<<<< |
| * raise IOError |
| * |
| */ |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->has_available(__pyx_v_self, __pyx_v_num_bytes); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = (!__pyx_t_1); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":459 |
| * |
| * if not self.has_available(num_bytes): |
| * raise IOError # <<<<<<<<<<<<<< |
| * |
| * cdef unsigned long x = 0 |
| */ |
| __Pyx_Raise(__pyx_builtin_IOError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":461 |
| * raise IOError |
| * |
| * cdef unsigned long x = 0 # <<<<<<<<<<<<<< |
| * cdef unsigned char *bytes = <unsigned char *>(self.buffer + self.pos) |
| * |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":462 |
| * |
| * cdef unsigned long x = 0 |
| * cdef unsigned char *bytes = <unsigned char *>(self.buffer + self.pos) # <<<<<<<<<<<<<< |
| * |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_v_bytes = ((unsigned char *)(__pyx_v_self->buffer + __pyx_v_self->pos)); |
| |
| /* "cpyamf/util.pyx":464 |
| * cdef unsigned char *bytes = <unsigned char *>(self.buffer + self.pos) |
| * |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * for 0 <= nb < num_bytes: |
| * x = (x << 8) | bytes[nb] |
| */ |
| __pyx_t_3 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":465 |
| * |
| * if is_big_endian(self.endian): |
| * for 0 <= nb < num_bytes: # <<<<<<<<<<<<<< |
| * x = (x << 8) | bytes[nb] |
| * else: |
| */ |
| __pyx_t_4 = __pyx_v_num_bytes; |
| for (__pyx_v_nb = 0; __pyx_v_nb < __pyx_t_4; __pyx_v_nb++) { |
| |
| /* "cpyamf/util.pyx":466 |
| * if is_big_endian(self.endian): |
| * for 0 <= nb < num_bytes: |
| * x = (x << 8) | bytes[nb] # <<<<<<<<<<<<<< |
| * else: |
| * for 0 <= nb < num_bytes: |
| */ |
| __pyx_v_x = ((__pyx_v_x << 8) | (__pyx_v_bytes[__pyx_v_nb])); |
| } |
| goto __pyx_L5; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":468 |
| * x = (x << 8) | bytes[nb] |
| * else: |
| * for 0 <= nb < num_bytes: # <<<<<<<<<<<<<< |
| * x = (x << 8) | bytes[num_bytes - nb - 1] |
| * |
| */ |
| __pyx_t_4 = __pyx_v_num_bytes; |
| for (__pyx_v_nb = 0; __pyx_v_nb < __pyx_t_4; __pyx_v_nb++) { |
| |
| /* "cpyamf/util.pyx":469 |
| * else: |
| * for 0 <= nb < num_bytes: |
| * x = (x << 8) | bytes[num_bytes - nb - 1] # <<<<<<<<<<<<<< |
| * |
| * self.pos += num_bytes |
| */ |
| __pyx_v_x = ((__pyx_v_x << 8) | (__pyx_v_bytes[((__pyx_v_num_bytes - __pyx_v_nb) - 1)])); |
| } |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":471 |
| * x = (x << 8) | bytes[num_bytes - nb - 1] |
| * |
| * self.pos += num_bytes # <<<<<<<<<<<<<< |
| * memcpy(ret, &x, num_bytes) |
| * |
| */ |
| __pyx_v_self->pos = (__pyx_v_self->pos + __pyx_v_num_bytes); |
| |
| /* "cpyamf/util.pyx":472 |
| * |
| * self.pos += num_bytes |
| * memcpy(ret, &x, num_bytes) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| memcpy(__pyx_v_ret, (&__pyx_v_x), __pyx_v_num_bytes); |
| |
| /* "cpyamf/util.pyx":474 |
| * memcpy(ret, &x, num_bytes) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef int pack_int(self, int num_bytes, long x) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.unpack_int"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":476 |
| * return 0 |
| * |
| * cdef int pack_int(self, int num_bytes, long x) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Packs a long. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_pack_int(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_v_num_bytes, long __pyx_v_x) { |
| long __pyx_v_maxint; |
| long __pyx_v_minint; |
| char *__pyx_v_buf; |
| long __pyx_v_i; |
| int __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| PyObject *__pyx_t_5; |
| int __pyx_t_6; |
| __Pyx_RefNannySetupContext("pack_int"); |
| |
| /* "cpyamf/util.pyx":482 |
| * @raise OverflowError: integer out of range |
| * """ |
| * cdef long maxint = 1 # <<<<<<<<<<<<<< |
| * cdef long minint = -1 |
| * |
| */ |
| __pyx_v_maxint = 1; |
| |
| /* "cpyamf/util.pyx":483 |
| * """ |
| * cdef long maxint = 1 |
| * cdef long minint = -1 # <<<<<<<<<<<<<< |
| * |
| * if num_bytes != SIZEOF_LONG: |
| */ |
| __pyx_v_minint = -1; |
| |
| /* "cpyamf/util.pyx":485 |
| * cdef long minint = -1 |
| * |
| * if num_bytes != SIZEOF_LONG: # <<<<<<<<<<<<<< |
| * maxint = (maxint << (num_bytes * 8 - 1)) - 1 |
| * minint = (-maxint) - 1 |
| */ |
| __pyx_t_1 = (__pyx_v_num_bytes != SIZEOF_LONG); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":486 |
| * |
| * if num_bytes != SIZEOF_LONG: |
| * maxint = (maxint << (num_bytes * 8 - 1)) - 1 # <<<<<<<<<<<<<< |
| * minint = (-maxint) - 1 |
| * |
| */ |
| __pyx_v_maxint = ((__pyx_v_maxint << ((__pyx_v_num_bytes * 8) - 1)) - 1); |
| |
| /* "cpyamf/util.pyx":487 |
| * if num_bytes != SIZEOF_LONG: |
| * maxint = (maxint << (num_bytes * 8 - 1)) - 1 |
| * minint = (-maxint) - 1 # <<<<<<<<<<<<<< |
| * |
| * if x > maxint or x < minint: |
| */ |
| __pyx_v_minint = ((-__pyx_v_maxint) - 1); |
| |
| /* "cpyamf/util.pyx":489 |
| * minint = (-maxint) - 1 |
| * |
| * if x > maxint or x < minint: # <<<<<<<<<<<<<< |
| * raise OverflowError('integer out of range') |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_x > __pyx_v_maxint); |
| if (!__pyx_t_1) { |
| __pyx_t_2 = (__pyx_v_x < __pyx_v_minint); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":490 |
| * |
| * if x > maxint or x < minint: |
| * raise OverflowError('integer out of range') # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_OverflowError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":492 |
| * raise OverflowError('integer out of range') |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((char *)malloc(__pyx_v_num_bytes)); |
| |
| /* "cpyamf/util.pyx":494 |
| * cdef char *buf = <char *>malloc(num_bytes) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_3 = (__pyx_v_buf == NULL); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":495 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * cdef long i = num_bytes |
| */ |
| __pyx_t_5 = PyErr_NoMemory(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":497 |
| * PyErr_NoMemory() |
| * |
| * cdef long i = num_bytes # <<<<<<<<<<<<<< |
| * |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_v_i = __pyx_v_num_bytes; |
| |
| /* "cpyamf/util.pyx":499 |
| * cdef long i = num_bytes |
| * |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * while i > 0: |
| * i -= 1 |
| */ |
| __pyx_t_3 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":500 |
| * |
| * if is_big_endian(self.endian): |
| * while i > 0: # <<<<<<<<<<<<<< |
| * i -= 1 |
| * buf[i] = <char>x |
| */ |
| while (1) { |
| __pyx_t_3 = (__pyx_v_i > 0); |
| if (!__pyx_t_3) break; |
| |
| /* "cpyamf/util.pyx":501 |
| * if is_big_endian(self.endian): |
| * while i > 0: |
| * i -= 1 # <<<<<<<<<<<<<< |
| * buf[i] = <char>x |
| * x >>= 8 |
| */ |
| __pyx_v_i = (__pyx_v_i - 1); |
| |
| /* "cpyamf/util.pyx":502 |
| * while i > 0: |
| * i -= 1 |
| * buf[i] = <char>x # <<<<<<<<<<<<<< |
| * x >>= 8 |
| * else: |
| */ |
| (__pyx_v_buf[__pyx_v_i]) = ((char)__pyx_v_x); |
| |
| /* "cpyamf/util.pyx":503 |
| * i -= 1 |
| * buf[i] = <char>x |
| * x >>= 8 # <<<<<<<<<<<<<< |
| * else: |
| * while i > 0: |
| */ |
| __pyx_v_x = (__pyx_v_x >> 8); |
| } |
| goto __pyx_L6; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":505 |
| * x >>= 8 |
| * else: |
| * while i > 0: # <<<<<<<<<<<<<< |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 |
| */ |
| while (1) { |
| __pyx_t_3 = (__pyx_v_i > 0); |
| if (!__pyx_t_3) break; |
| |
| /* "cpyamf/util.pyx":506 |
| * else: |
| * while i > 0: |
| * buf[num_bytes - i] = <char>x # <<<<<<<<<<<<<< |
| * i -= 1 |
| * x >>= 8 |
| */ |
| (__pyx_v_buf[(__pyx_v_num_bytes - __pyx_v_i)]) = ((char)__pyx_v_x); |
| |
| /* "cpyamf/util.pyx":507 |
| * while i > 0: |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 # <<<<<<<<<<<<<< |
| * x >>= 8 |
| * |
| */ |
| __pyx_v_i = (__pyx_v_i - 1); |
| |
| /* "cpyamf/util.pyx":508 |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 |
| * x >>= 8 # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| __pyx_v_x = (__pyx_v_x >> 8); |
| } |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":510 |
| * x >>= 8 |
| * |
| * try: # <<<<<<<<<<<<<< |
| * self.write(buf, num_bytes) |
| * finally: |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":511 |
| * |
| * try: |
| * self.write(buf, num_bytes) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_6 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_buf, __pyx_v_num_bytes); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L12;} |
| } |
| |
| /* "cpyamf/util.pyx":513 |
| * self.write(buf, num_bytes) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L13; |
| __pyx_L12: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L13; |
| } |
| __pyx_L13:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":515 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef int pack_uint(self, int num_bytes, unsigned long x) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.pack_int"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":517 |
| * return 0 |
| * |
| * cdef int pack_uint(self, int num_bytes, unsigned long x) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Packs an unsigned long into a buffer. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_pack_uint(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_v_num_bytes, unsigned long __pyx_v_x) { |
| unsigned long __pyx_v_maxint; |
| char *__pyx_v_buf; |
| long __pyx_v_i; |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("pack_uint"); |
| |
| /* "cpyamf/util.pyx":523 |
| * @raise OverflowError: integer out of range |
| * """ |
| * cdef unsigned long maxint = 1 # <<<<<<<<<<<<<< |
| * |
| * if num_bytes != SIZEOF_LONG: |
| */ |
| __pyx_v_maxint = 1; |
| |
| /* "cpyamf/util.pyx":525 |
| * cdef unsigned long maxint = 1 |
| * |
| * if num_bytes != SIZEOF_LONG: # <<<<<<<<<<<<<< |
| * maxint <<= <unsigned long>(num_bytes * 8) |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_num_bytes != SIZEOF_LONG); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":526 |
| * |
| * if num_bytes != SIZEOF_LONG: |
| * maxint <<= <unsigned long>(num_bytes * 8) # <<<<<<<<<<<<<< |
| * |
| * if x >= maxint: |
| */ |
| __pyx_v_maxint = (__pyx_v_maxint << ((unsigned long)(__pyx_v_num_bytes * 8))); |
| |
| /* "cpyamf/util.pyx":528 |
| * maxint <<= <unsigned long>(num_bytes * 8) |
| * |
| * if x >= maxint: # <<<<<<<<<<<<<< |
| * raise OverflowError('integer out of range') |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_x >= __pyx_v_maxint); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":529 |
| * |
| * if x >= maxint: |
| * raise OverflowError('integer out of range') # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) |
| */ |
| __pyx_t_2 = PyObject_Call(__pyx_builtin_OverflowError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_Raise(__pyx_t_2, 0, 0); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L4; |
| } |
| __pyx_L4:; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":531 |
| * raise OverflowError('integer out of range') |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((char *)malloc(__pyx_v_num_bytes)); |
| |
| /* "cpyamf/util.pyx":533 |
| * cdef char *buf = <char *>malloc(num_bytes) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_buf == NULL); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":534 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * cdef long i = num_bytes |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":536 |
| * PyErr_NoMemory() |
| * |
| * cdef long i = num_bytes # <<<<<<<<<<<<<< |
| * |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_v_i = __pyx_v_num_bytes; |
| |
| /* "cpyamf/util.pyx":538 |
| * cdef long i = num_bytes |
| * |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * while i > 0: |
| * i -= 1 |
| */ |
| __pyx_t_1 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":539 |
| * |
| * if is_big_endian(self.endian): |
| * while i > 0: # <<<<<<<<<<<<<< |
| * i -= 1 |
| * buf[i] = <char>x |
| */ |
| while (1) { |
| __pyx_t_1 = (__pyx_v_i > 0); |
| if (!__pyx_t_1) break; |
| |
| /* "cpyamf/util.pyx":540 |
| * if is_big_endian(self.endian): |
| * while i > 0: |
| * i -= 1 # <<<<<<<<<<<<<< |
| * buf[i] = <char>x |
| * x >>= 8 |
| */ |
| __pyx_v_i = (__pyx_v_i - 1); |
| |
| /* "cpyamf/util.pyx":541 |
| * while i > 0: |
| * i -= 1 |
| * buf[i] = <char>x # <<<<<<<<<<<<<< |
| * x >>= 8 |
| * else: |
| */ |
| (__pyx_v_buf[__pyx_v_i]) = ((char)__pyx_v_x); |
| |
| /* "cpyamf/util.pyx":542 |
| * i -= 1 |
| * buf[i] = <char>x |
| * x >>= 8 # <<<<<<<<<<<<<< |
| * else: |
| * while i > 0: |
| */ |
| __pyx_v_x = (__pyx_v_x >> 8); |
| } |
| goto __pyx_L6; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":544 |
| * x >>= 8 |
| * else: |
| * while i > 0: # <<<<<<<<<<<<<< |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 |
| */ |
| while (1) { |
| __pyx_t_1 = (__pyx_v_i > 0); |
| if (!__pyx_t_1) break; |
| |
| /* "cpyamf/util.pyx":545 |
| * else: |
| * while i > 0: |
| * buf[num_bytes - i] = <char>x # <<<<<<<<<<<<<< |
| * i -= 1 |
| * x >>= 8 |
| */ |
| (__pyx_v_buf[(__pyx_v_num_bytes - __pyx_v_i)]) = ((char)__pyx_v_x); |
| |
| /* "cpyamf/util.pyx":546 |
| * while i > 0: |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 # <<<<<<<<<<<<<< |
| * x >>= 8 |
| * |
| */ |
| __pyx_v_i = (__pyx_v_i - 1); |
| |
| /* "cpyamf/util.pyx":547 |
| * buf[num_bytes - i] = <char>x |
| * i -= 1 |
| * x >>= 8 # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| __pyx_v_x = (__pyx_v_x >> 8); |
| } |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":549 |
| * x >>= 8 |
| * |
| * try: # <<<<<<<<<<<<<< |
| * self.write(buf, num_bytes) |
| * finally: |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":550 |
| * |
| * try: |
| * self.write(buf, num_bytes) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_buf, __pyx_v_num_bytes); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L12;} |
| } |
| |
| /* "cpyamf/util.pyx":552 |
| * self.write(buf, num_bytes) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L13; |
| __pyx_L12: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L13; |
| } |
| __pyx_L13:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":554 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef unsigned char read_uchar(self) except? 0: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.pack_uint"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":556 |
| * return 0 |
| * |
| * cpdef unsigned char read_uchar(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads an C{unsigned char} from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_9read_uchar(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static unsigned char __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_uchar(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| unsigned char __pyx_v_ch; |
| unsigned char __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| unsigned char __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_uchar"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_uchar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_9read_uchar)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsUnsignedChar(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":560 |
| * Reads an C{unsigned char} from the stream. |
| * """ |
| * cdef unsigned char ch = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(1, &ch) |
| */ |
| __pyx_v_ch = 0; |
| |
| /* "cpyamf/util.pyx":562 |
| * cdef unsigned char ch = 0 |
| * |
| * self.unpack_int(1, &ch) # <<<<<<<<<<<<<< |
| * |
| * return ch |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 1, (&__pyx_v_ch)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":564 |
| * self.unpack_int(1, &ch) |
| * |
| * return ch # <<<<<<<<<<<<<< |
| * |
| * cpdef char read_char(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_ch; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_uchar"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":556 |
| * return 0 |
| * |
| * cpdef unsigned char read_uchar(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads an C{unsigned char} from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_9read_uchar(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_9read_uchar[] = "\n Reads an C{unsigned char} from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_9read_uchar(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| unsigned char __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_uchar"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_uchar(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_uchar"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":566 |
| * return ch |
| * |
| * cpdef char read_char(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a C{char} from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_10read_char(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_char(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| char __pyx_v_ch; |
| char __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| char __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_char"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_10read_char)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsChar(__pyx_t_2); if (unlikely((__pyx_t_3 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":570 |
| * Reads a C{char} from the stream. |
| * """ |
| * cdef char ch = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(1, &ch) |
| */ |
| __pyx_v_ch = 0; |
| |
| /* "cpyamf/util.pyx":572 |
| * cdef char ch = 0 |
| * |
| * self.unpack_int(1, &ch) # <<<<<<<<<<<<<< |
| * |
| * return ch |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 1, (&__pyx_v_ch)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":574 |
| * self.unpack_int(1, &ch) |
| * |
| * return ch # <<<<<<<<<<<<<< |
| * |
| * cpdef unsigned short read_ushort(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_ch; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_char"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":566 |
| * return ch |
| * |
| * cpdef char read_char(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a C{char} from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_10read_char(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_10read_char[] = "\n Reads a C{char} from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_10read_char(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| char __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_char"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_char"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":576 |
| * return ch |
| * |
| * cpdef unsigned short read_ushort(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 2 byte unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_11read_ushort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static unsigned short __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_ushort(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| unsigned short __pyx_v_x; |
| unsigned short __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| unsigned short __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_ushort"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_ushort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_11read_ushort)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":580 |
| * Reads a 2 byte unsigned integer from the stream. |
| * """ |
| * cdef unsigned short x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(2, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":582 |
| * cdef unsigned short x = 0 |
| * |
| * self.unpack_int(2, &x) # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 2, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":584 |
| * self.unpack_int(2, &x) |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef short read_short(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_ushort"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":576 |
| * return ch |
| * |
| * cpdef unsigned short read_ushort(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 2 byte unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_11read_ushort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_11read_ushort[] = "\n Reads a 2 byte unsigned integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_11read_ushort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| unsigned short __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_ushort"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_ushort(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_ushort"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":586 |
| * return x |
| * |
| * cpdef short read_short(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 2 byte integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_12read_short(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static short __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_short(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| short __pyx_v_x; |
| short __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| short __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_short"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_short); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_12read_short)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsShort(__pyx_t_2); if (unlikely((__pyx_t_3 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":590 |
| * Reads a 2 byte integer from the stream. |
| * """ |
| * cdef short x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(2, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":592 |
| * cdef short x = 0 |
| * |
| * self.unpack_int(2, &x) # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 2, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":594 |
| * self.unpack_int(2, &x) |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef unsigned long read_24bit_uint(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_short"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":586 |
| * return x |
| * |
| * cpdef short read_short(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 2 byte integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_12read_short(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_12read_short[] = "\n Reads a 2 byte integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_12read_short(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| short __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_short"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_short(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_short"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":596 |
| * return x |
| * |
| * cpdef unsigned long read_24bit_uint(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 24 bit unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static unsigned long __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_24bit_uint(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| unsigned long __pyx_v_x; |
| unsigned long __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| unsigned long __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_24bit_uint"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_24bit_uint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":600 |
| * Reads a 24 bit unsigned integer from the stream. |
| * """ |
| * cdef unsigned long x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(3, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":602 |
| * cdef unsigned long x = 0 |
| * |
| * self.unpack_int(3, &x) # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 3, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":604 |
| * self.unpack_int(3, &x) |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef long read_24bit_int(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_24bit_uint"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":596 |
| * return x |
| * |
| * cpdef unsigned long read_24bit_uint(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 24 bit unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint[] = "\n Reads a 24 bit unsigned integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| unsigned long __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_24bit_uint"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_24bit_uint(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_24bit_uint"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":606 |
| * return x |
| * |
| * cpdef long read_24bit_int(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 24 bit integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static long __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_24bit_int(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| long __pyx_v_x; |
| long __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| long __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_24bit_int"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_24bit_int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":610 |
| * Reads a 24 bit integer from the stream. |
| * """ |
| * cdef long x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(3, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":612 |
| * cdef long x = 0 |
| * |
| * self.unpack_int(3, &x) # <<<<<<<<<<<<<< |
| * |
| * if x & 0x800000: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 3, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":614 |
| * self.unpack_int(3, &x) |
| * |
| * if x & 0x800000: # <<<<<<<<<<<<<< |
| * x |= ~0xffffff |
| * |
| */ |
| __pyx_t_3 = (__pyx_v_x & 0x800000); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":615 |
| * |
| * if x & 0x800000: |
| * x |= ~0xffffff # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_v_x = (__pyx_v_x | (~0xffffff)); |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":617 |
| * x |= ~0xffffff |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef unsigned long read_ulong(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_24bit_int"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":606 |
| * return x |
| * |
| * cpdef long read_24bit_int(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 24 bit integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int[] = "\n Reads a 24 bit integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| long __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_24bit_int"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_24bit_int(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_24bit_int"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":619 |
| * return x |
| * |
| * cpdef unsigned long read_ulong(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_15read_ulong(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static unsigned long __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_ulong(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| unsigned long __pyx_v_x; |
| unsigned long __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| unsigned long __pyx_t_3; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_ulong"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_ulong); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_15read_ulong)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":623 |
| * Reads a 4 byte unsigned integer from the stream. |
| * """ |
| * cdef unsigned long x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(4, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":625 |
| * cdef unsigned long x = 0 |
| * |
| * self.unpack_int(4, &x) # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 4, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":627 |
| * self.unpack_int(4, &x) |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef long read_long(self) except? 0: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_ulong"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":619 |
| * return x |
| * |
| * cpdef unsigned long read_ulong(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte unsigned integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_15read_ulong(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_15read_ulong[] = "\n Reads a 4 byte unsigned integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_15read_ulong(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| unsigned long __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_ulong"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_ulong(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_ulong"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":629 |
| * return x |
| * |
| * cpdef long read_long(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_16read_long(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static long __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_long(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, int __pyx_skip_dispatch) { |
| long __pyx_v_x; |
| long __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| long __pyx_t_3; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| __Pyx_RefNannySetupContext("read_long"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_long); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_16read_long)) { |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_3; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":633 |
| * Reads a 4 byte integer from the stream. |
| * """ |
| * cdef long x = 0 # <<<<<<<<<<<<<< |
| * |
| * self.unpack_int(4, &x) |
| */ |
| __pyx_v_x = 0; |
| |
| /* "cpyamf/util.pyx":635 |
| * cdef long x = 0 |
| * |
| * self.unpack_int(4, &x) # <<<<<<<<<<<<<< |
| * |
| * if x & 0x80000000: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->unpack_int(__pyx_v_self, 4, (&__pyx_v_x)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":637 |
| * self.unpack_int(4, &x) |
| * |
| * if x & 0x80000000: # <<<<<<<<<<<<<< |
| * x |= ~0x7fffffff |
| * |
| */ |
| __pyx_t_1 = PyInt_FromLong(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2147483648); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":638 |
| * |
| * if x & 0x80000000: |
| * x |= ~0x7fffffff # <<<<<<<<<<<<<< |
| * |
| * return x |
| */ |
| __pyx_v_x = (__pyx_v_x | (~0x7fffffff)); |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":640 |
| * x |= ~0x7fffffff |
| * |
| * return x # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_uchar(self, unsigned char ret) except -1: |
| */ |
| __pyx_r = __pyx_v_x; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_long"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":629 |
| * return x |
| * |
| * cpdef long read_long(self) except? 0: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte integer from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_16read_long(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_16read_long[] = "\n Reads a 4 byte integer from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_16read_long(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| long __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_long"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_long(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_long"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":642 |
| * return x |
| * |
| * cpdef int write_uchar(self, unsigned char ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes an C{unsigned char} to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_17write_uchar(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_uchar(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, unsigned char __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_uchar"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_uchar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_17write_uchar)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":649 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_uint(1, <unsigned long>ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_char(self, char ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_uint(__pyx_v_self, 1, ((unsigned long)__pyx_v_ret)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_uchar"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":642 |
| * return x |
| * |
| * cpdef int write_uchar(self, unsigned char ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes an C{unsigned char} to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_17write_uchar(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_17write_uchar[] = "\n Writes an C{unsigned char} to the stream.\n\n @param ret: Unsigned char\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_17write_uchar(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| unsigned char __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_uchar"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsUnsignedChar(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_uchar"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_uchar(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_uchar"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":651 |
| * return self.pack_uint(1, <unsigned long>ret) |
| * |
| * cpdef int write_char(self, char ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Write a C{char} to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_18write_char(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_char(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, char __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_char"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_18write_char)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":658 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_int(1, <long>ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_ushort(self, unsigned short ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_int(__pyx_v_self, 1, ((long)__pyx_v_ret)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_char"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":651 |
| * return self.pack_uint(1, <unsigned long>ret) |
| * |
| * cpdef int write_char(self, char ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Write a C{char} to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_18write_char(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_18write_char[] = "\n Write a C{char} to the stream.\n\n @param ret: char\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_18write_char(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| char __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_char"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsChar(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_char"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_char(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_char"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":660 |
| * return self.pack_int(1, <long>ret) |
| * |
| * cpdef int write_ushort(self, unsigned short ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_19write_ushort(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_ushort(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, unsigned short __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_ushort"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_ushort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_19write_ushort)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":667 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_uint(2, <unsigned long>ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_short(self, short ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_uint(__pyx_v_self, 2, ((unsigned long)__pyx_v_ret)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ushort"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":660 |
| * return self.pack_int(1, <long>ret) |
| * |
| * cpdef int write_ushort(self, unsigned short ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_19write_ushort(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_19write_ushort[] = "\n Writes a 2 byte unsigned integer to the stream.\n\n @param ret: 2 byte unsigned integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_19write_ushort(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| unsigned short __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_ushort"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsUnsignedShort(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ushort"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_ushort(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ushort"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":669 |
| * return self.pack_uint(2, <unsigned long>ret) |
| * |
| * cpdef int write_short(self, short ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_20write_short(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_short(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, short __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_short"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_short); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_20write_short)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":676 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_int(2, <long>ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_ulong(self, unsigned long ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_int(__pyx_v_self, 2, ((long)__pyx_v_ret)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_short"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":669 |
| * return self.pack_uint(2, <unsigned long>ret) |
| * |
| * cpdef int write_short(self, short ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_20write_short(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_20write_short[] = "\n Writes a 2 byte integer to the stream.\n\n @param ret: 2 byte integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_20write_short(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| short __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_short"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsShort(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_short"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_short(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_short"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":678 |
| * return self.pack_int(2, <long>ret) |
| * |
| * cpdef int write_ulong(self, unsigned long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_21write_ulong(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_ulong(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, unsigned long __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_ulong"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_ulong); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_21write_ulong)) { |
| __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":685 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_uint(4, ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_long(self, long ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_uint(__pyx_v_self, 4, __pyx_v_ret); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ulong"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":678 |
| * return self.pack_int(2, <long>ret) |
| * |
| * cpdef int write_ulong(self, unsigned long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_21write_ulong(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_21write_ulong[] = "\n Writes a 4 byte unsigned integer to the stream.\n\n @param ret: 4 byte unsigned integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_21write_ulong(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| unsigned long __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_ulong"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsUnsignedLong(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ulong"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_ulong(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_ulong"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":687 |
| * return self.pack_uint(4, ret) |
| * |
| * cpdef int write_long(self, long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_22write_long(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_long(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, long __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_long"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_long); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_22write_long)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":694 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_int(4, ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_24bit_uint(self, unsigned long ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_int(__pyx_v_self, 4, __pyx_v_ret); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_long"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":687 |
| * return self.pack_uint(4, ret) |
| * |
| * cpdef int write_long(self, long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_22write_long(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_22write_long[] = "\n Writes a 4 byte integer to the stream.\n\n @param ret: 4 byte integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_22write_long(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| long __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_long"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsLong(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_long"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_long(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_long"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":696 |
| * return self.pack_int(4, ret) |
| * |
| * cpdef int write_24bit_uint(self, unsigned long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 24 bit unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_24bit_uint(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, unsigned long __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_24bit_uint"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_24bit_uint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint)) { |
| __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":703 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_uint(3, ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_24bit_int(self, long ret) except -1: |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_uint(__pyx_v_self, 3, __pyx_v_ret); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_uint"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":696 |
| * return self.pack_int(4, ret) |
| * |
| * cpdef int write_24bit_uint(self, unsigned long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 24 bit unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint[] = "\n Writes a 24 bit unsigned integer to the stream.\n\n @param ret: 24 bit unsigned integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| unsigned long __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_24bit_uint"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsUnsignedLong(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_uint"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_24bit_uint(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_uint"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":705 |
| * return self.pack_uint(3, ret) |
| * |
| * cpdef int write_24bit_int(self, long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 24 bit integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_24bit_int(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, long __pyx_v_ret, int __pyx_skip_dispatch) { |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| __Pyx_RefNannySetupContext("write_24bit_int"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_24bit_int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int)) { |
| __pyx_t_2 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":712 |
| * @type ret: C{int} |
| * """ |
| * return self.pack_int(3, ret) # <<<<<<<<<<<<<< |
| * |
| * cpdef object read_utf8_string(self, Py_ssize_t l): |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->pack_int(__pyx_v_self, 3, __pyx_v_ret); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_r = __pyx_t_4; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_int"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":705 |
| * return self.pack_uint(3, ret) |
| * |
| * cpdef int write_24bit_int(self, long ret) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 24 bit integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int[] = "\n Writes a 24 bit integer to the stream.\n\n @param ret: 24 bit integer\n @type ret: C{int}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int(PyObject *__pyx_v_self, PyObject *__pyx_arg_ret) { |
| long __pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_24bit_int"); |
| assert(__pyx_arg_ret); { |
| __pyx_v_ret = __Pyx_PyInt_AsLong(__pyx_arg_ret); if (unlikely((__pyx_v_ret == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_int"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_24bit_int(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_ret, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_24bit_int"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":714 |
| * return self.pack_int(3, ret) |
| * |
| * cpdef object read_utf8_string(self, Py_ssize_t l): # <<<<<<<<<<<<<< |
| * """ |
| * Reads a UTF-8 string from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_arg_l); /*proto*/ |
| static PyObject *__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_utf8_string(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, Py_ssize_t __pyx_v_l, int __pyx_skip_dispatch) { |
| char *__pyx_v_buf; |
| PyObject *__pyx_v_ret; |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| __Pyx_RefNannySetupContext("read_utf8_string"); |
| __pyx_v_ret = Py_None; __Pyx_INCREF(Py_None); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_utf8_string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string)) { |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":720 |
| * @rtype: C{unicode} |
| * """ |
| * cdef char* buf = NULL # <<<<<<<<<<<<<< |
| * cdef object ret |
| * |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":723 |
| * cdef object ret |
| * |
| * if l == 0: # <<<<<<<<<<<<<< |
| * return empty_unicode |
| * |
| */ |
| __pyx_t_4 = (__pyx_v_l == 0); |
| if (__pyx_t_4) { |
| |
| /* "cpyamf/util.pyx":724 |
| * |
| * if l == 0: |
| * return empty_unicode # <<<<<<<<<<<<<< |
| * |
| * self.read(&buf, l) |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(__pyx_v_6cpyamf_4util_empty_unicode); |
| __pyx_r = __pyx_v_6cpyamf_4util_empty_unicode; |
| goto __pyx_L0; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":726 |
| * return empty_unicode |
| * |
| * self.read(&buf, l) # <<<<<<<<<<<<<< |
| * ret = PyUnicode_DecodeUTF8(buf, l, 'strict') |
| * |
| */ |
| __pyx_t_5 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->read(__pyx_v_self, (&__pyx_v_buf), __pyx_v_l); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":727 |
| * |
| * self.read(&buf, l) |
| * ret = PyUnicode_DecodeUTF8(buf, l, 'strict') # <<<<<<<<<<<<<< |
| * |
| * return ret |
| */ |
| __pyx_t_1 = PyUnicode_DecodeUTF8(__pyx_v_buf, __pyx_v_l, __pyx_k__strict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_v_ret); |
| __pyx_v_ret = __pyx_t_1; |
| __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":729 |
| * ret = PyUnicode_DecodeUTF8(buf, l, 'strict') |
| * |
| * return ret # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_utf8_string(self, object obj) except -1: |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(__pyx_v_ret); |
| __pyx_r = __pyx_v_ret; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_utf8_string"); |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_DECREF(__pyx_v_ret); |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":714 |
| * return self.pack_int(3, ret) |
| * |
| * cpdef object read_utf8_string(self, Py_ssize_t l): # <<<<<<<<<<<<<< |
| * """ |
| * Reads a UTF-8 string from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_arg_l); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string[] = "\n Reads a UTF-8 string from the stream.\n\n @rtype: C{unicode}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_arg_l) { |
| Py_ssize_t __pyx_v_l; |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| __Pyx_RefNannySetupContext("read_utf8_string"); |
| assert(__pyx_arg_l); { |
| __pyx_v_l = __Pyx_PyIndex_AsSsize_t(__pyx_arg_l); if (unlikely((__pyx_v_l == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_utf8_string"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->read_utf8_string(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_l, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_utf8_string"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":731 |
| * return ret |
| * |
| * cpdef int write_utf8_string(self, object obj) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a unicode object to the stream in UTF-8. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_utf8_string(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) { |
| PyObject *__pyx_v_encoded_string; |
| char *__pyx_v_buf; |
| Py_ssize_t __pyx_v_l; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| __Pyx_RefNannySetupContext("write_utf8_string"); |
| __pyx_v_encoded_string = Py_None; __Pyx_INCREF(Py_None); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_utf8_string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string)) { |
| __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| __Pyx_INCREF(__pyx_v_obj); |
| PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj); |
| __Pyx_GIVEREF(__pyx_v_obj); |
| __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":739 |
| * """ |
| * cdef object encoded_string |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * cdef Py_ssize_t l = -1 |
| * |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":740 |
| * cdef object encoded_string |
| * cdef char *buf = NULL |
| * cdef Py_ssize_t l = -1 # <<<<<<<<<<<<<< |
| * |
| * if PyUnicode_Check(obj) == 1: |
| */ |
| __pyx_v_l = -1; |
| |
| /* "cpyamf/util.pyx":742 |
| * cdef Py_ssize_t l = -1 |
| * |
| * if PyUnicode_Check(obj) == 1: # <<<<<<<<<<<<<< |
| * encoded_string = PyUnicode_AsUTF8String(obj) |
| * elif PyString_Check(obj) == 1: |
| */ |
| __pyx_t_5 = (PyUnicode_Check(__pyx_v_obj) == 1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":743 |
| * |
| * if PyUnicode_Check(obj) == 1: |
| * encoded_string = PyUnicode_AsUTF8String(obj) # <<<<<<<<<<<<<< |
| * elif PyString_Check(obj) == 1: |
| * encoded_string = obj |
| */ |
| __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_obj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_v_encoded_string); |
| __pyx_v_encoded_string = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L3; |
| } |
| |
| /* "cpyamf/util.pyx":744 |
| * if PyUnicode_Check(obj) == 1: |
| * encoded_string = PyUnicode_AsUTF8String(obj) |
| * elif PyString_Check(obj) == 1: # <<<<<<<<<<<<<< |
| * encoded_string = obj |
| * else: |
| */ |
| __pyx_t_5 = (PyString_Check(__pyx_v_obj) == 1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":745 |
| * encoded_string = PyUnicode_AsUTF8String(obj) |
| * elif PyString_Check(obj) == 1: |
| * encoded_string = obj # <<<<<<<<<<<<<< |
| * else: |
| * raise TypeError('value must be Unicode or str') |
| */ |
| __Pyx_INCREF(__pyx_v_obj); |
| __Pyx_DECREF(__pyx_v_encoded_string); |
| __pyx_v_encoded_string = __pyx_v_obj; |
| goto __pyx_L3; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":747 |
| * encoded_string = obj |
| * else: |
| * raise TypeError('value must be Unicode or str') # <<<<<<<<<<<<<< |
| * |
| * PyString_AsStringAndSize(encoded_string, &buf, &l) |
| */ |
| __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_Raise(__pyx_t_1, 0, 0); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":749 |
| * raise TypeError('value must be Unicode or str') |
| * |
| * PyString_AsStringAndSize(encoded_string, &buf, &l) # <<<<<<<<<<<<<< |
| * self.write(buf, l) |
| * |
| */ |
| __pyx_t_4 = PyString_AsStringAndSize(__pyx_v_encoded_string, (&__pyx_v_buf), (&__pyx_v_l)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":750 |
| * |
| * PyString_AsStringAndSize(encoded_string, &buf, &l) |
| * self.write(buf, l) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_buf, __pyx_v_l); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":752 |
| * self.write(buf, l) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef int read_double(self, double *obj) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_utf8_string"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_DECREF(__pyx_v_encoded_string); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":731 |
| * return ret |
| * |
| * cpdef int write_utf8_string(self, object obj) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a unicode object to the stream in UTF-8. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string[] = "\n Writes a unicode object to the stream in UTF-8.\n\n @param obj: unicode object\n @raise TypeError: Unexpected type for str C{u}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_utf8_string"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_utf8_string(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_obj, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_utf8_string"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":754 |
| * return 0 |
| * |
| * cdef int read_double(self, double *obj) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Reads an 8 byte float from the stream. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_double(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, double *__pyx_v_obj) { |
| unsigned char *__pyx_v_buf; |
| int __pyx_v_done; |
| int __pyx_r; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| PyObject *__pyx_t_3; |
| double __pyx_t_4; |
| __Pyx_RefNannySetupContext("read_double"); |
| |
| /* "cpyamf/util.pyx":758 |
| * Reads an 8 byte float from the stream. |
| * """ |
| * cdef unsigned char *buf = NULL # <<<<<<<<<<<<<< |
| * cdef int done = 0 |
| * |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":759 |
| * """ |
| * cdef unsigned char *buf = NULL |
| * cdef int done = 0 # <<<<<<<<<<<<<< |
| * |
| * self.read(<char **>&buf, 8) |
| */ |
| __pyx_v_done = 0; |
| |
| /* "cpyamf/util.pyx":761 |
| * cdef int done = 0 |
| * |
| * self.read(<char **>&buf, 8) # <<<<<<<<<<<<<< |
| * |
| * if float_broken == 1: |
| */ |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->read(__pyx_v_self, ((char **)(&__pyx_v_buf)), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":763 |
| * self.read(<char **>&buf, 8) |
| * |
| * if float_broken == 1: # <<<<<<<<<<<<<< |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| */ |
| __pyx_t_2 = (__pyx_v_6cpyamf_4util_float_broken == 1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":764 |
| * |
| * if float_broken == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| */ |
| __pyx_t_2 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":765 |
| * if float_broken == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_2 = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian)); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":766 |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * else: |
| */ |
| __pyx_t_2 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":767 |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * else: |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| goto __pyx_L4; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":769 |
| * PyErr_NoMemory() |
| * else: |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_2 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":770 |
| * else: |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_2 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":771 |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * if memcmp(buf, &system_nan, 8) == 0: |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L8; |
| } |
| __pyx_L8:; |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| } |
| __pyx_L4:; |
| |
| /* "cpyamf/util.pyx":773 |
| * PyErr_NoMemory() |
| * |
| * if memcmp(buf, &system_nan, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(obj, &system_nan, 8) |
| * |
| */ |
| __pyx_t_2 = (memcmp(__pyx_v_buf, (&__pyx_v_6cpyamf_4util_system_nan), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":774 |
| * |
| * if memcmp(buf, &system_nan, 8) == 0: |
| * memcpy(obj, &system_nan, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_obj, (&__pyx_v_6cpyamf_4util_system_nan), 8); |
| |
| /* "cpyamf/util.pyx":776 |
| * memcpy(obj, &system_nan, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(buf, &system_posinf, 8) == 0: |
| * memcpy(obj, &system_posinf, 8) |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L9; |
| } |
| |
| /* "cpyamf/util.pyx":777 |
| * |
| * done = 1 |
| * elif memcmp(buf, &system_posinf, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(obj, &system_posinf, 8) |
| * |
| */ |
| __pyx_t_2 = (memcmp(__pyx_v_buf, (&__pyx_v_6cpyamf_4util_system_posinf), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":778 |
| * done = 1 |
| * elif memcmp(buf, &system_posinf, 8) == 0: |
| * memcpy(obj, &system_posinf, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_obj, (&__pyx_v_6cpyamf_4util_system_posinf), 8); |
| |
| /* "cpyamf/util.pyx":780 |
| * memcpy(obj, &system_posinf, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(buf, &system_neginf, 8) == 0: |
| * memcpy(obj, &system_neginf, 8) |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L9; |
| } |
| |
| /* "cpyamf/util.pyx":781 |
| * |
| * done = 1 |
| * elif memcmp(buf, &system_neginf, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(obj, &system_neginf, 8) |
| * |
| */ |
| __pyx_t_2 = (memcmp(__pyx_v_buf, (&__pyx_v_6cpyamf_4util_system_neginf), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":782 |
| * done = 1 |
| * elif memcmp(buf, &system_neginf, 8) == 0: |
| * memcpy(obj, &system_neginf, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_obj, (&__pyx_v_6cpyamf_4util_system_neginf), 8); |
| |
| /* "cpyamf/util.pyx":784 |
| * memcpy(obj, &system_neginf, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * |
| * if done == 1: |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L9; |
| } |
| __pyx_L9:; |
| |
| /* "cpyamf/util.pyx":786 |
| * done = 1 |
| * |
| * if done == 1: # <<<<<<<<<<<<<< |
| * return 0 |
| * |
| */ |
| __pyx_t_2 = (__pyx_v_done == 1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":787 |
| * |
| * if done == 1: |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * if is_big_endian(SYSTEM_ENDIAN): |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| goto __pyx_L10; |
| } |
| __pyx_L10:; |
| |
| /* "cpyamf/util.pyx":789 |
| * return 0 |
| * |
| * if is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| */ |
| __pyx_t_2 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":790 |
| * |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_2 = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian)); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":791 |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * else: |
| */ |
| __pyx_t_2 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":792 |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * else: |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L13; |
| } |
| __pyx_L13:; |
| goto __pyx_L12; |
| } |
| __pyx_L12:; |
| goto __pyx_L11; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":794 |
| * PyErr_NoMemory() |
| * else: |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_2 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":795 |
| * else: |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_2 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":796 |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * obj[0] = _PyFloat_Unpack8(buf, not is_big_endian(self.endian)) |
| */ |
| __pyx_t_3 = PyErr_NoMemory(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L15; |
| } |
| __pyx_L15:; |
| goto __pyx_L14; |
| } |
| __pyx_L14:; |
| } |
| __pyx_L11:; |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":798 |
| * PyErr_NoMemory() |
| * |
| * obj[0] = _PyFloat_Unpack8(buf, not is_big_endian(self.endian)) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_4 = _PyFloat_Unpack8(__pyx_v_buf, (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian))); if (unlikely(__pyx_t_4 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| (__pyx_v_obj[0]) = __pyx_t_4; |
| |
| /* "cpyamf/util.pyx":800 |
| * obj[0] = _PyFloat_Unpack8(buf, not is_big_endian(self.endian)) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_double(self, double val) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_double"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":802 |
| * return 0 |
| * |
| * cpdef int write_double(self, double val) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes an 8 byte float to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_27write_double(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_double(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, double __pyx_v_val, int __pyx_skip_dispatch) { |
| unsigned char *__pyx_v_buf; |
| int __pyx_v_done; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| PyObject *__pyx_t_6; |
| __Pyx_RefNannySetupContext("write_double"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_27write_double)) { |
| __pyx_t_2 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":811 |
| * cdef unsigned char *buf |
| * cdef unsigned char *foo |
| * cdef int done = 0 # <<<<<<<<<<<<<< |
| * |
| * buf = <unsigned char *>malloc(sizeof(double)) |
| */ |
| __pyx_v_done = 0; |
| |
| /* "cpyamf/util.pyx":813 |
| * cdef int done = 0 |
| * |
| * buf = <unsigned char *>malloc(sizeof(double)) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((unsigned char *)malloc((sizeof(double)))); |
| |
| /* "cpyamf/util.pyx":815 |
| * buf = <unsigned char *>malloc(sizeof(double)) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_buf == NULL); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":816 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":818 |
| * PyErr_NoMemory() |
| * |
| * try: # <<<<<<<<<<<<<< |
| * if float_broken == 1: |
| * if memcmp(&val, &system_nan, 8) == 0: |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":819 |
| * |
| * try: |
| * if float_broken == 1: # <<<<<<<<<<<<<< |
| * if memcmp(&val, &system_nan, 8) == 0: |
| * memcpy(buf, &val, 8) |
| */ |
| __pyx_t_5 = (__pyx_v_6cpyamf_4util_float_broken == 1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":820 |
| * try: |
| * if float_broken == 1: |
| * if memcmp(&val, &system_nan, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(buf, &val, 8) |
| * |
| */ |
| __pyx_t_5 = (memcmp((&__pyx_v_val), (&__pyx_v_6cpyamf_4util_system_nan), 8) == 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":821 |
| * if float_broken == 1: |
| * if memcmp(&val, &system_nan, 8) == 0: |
| * memcpy(buf, &val, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_buf, (&__pyx_v_val), 8); |
| |
| /* "cpyamf/util.pyx":823 |
| * memcpy(buf, &val, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(&val, &system_posinf, 8) == 0: |
| * memcpy(buf, &val, 8) |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L8; |
| } |
| |
| /* "cpyamf/util.pyx":824 |
| * |
| * done = 1 |
| * elif memcmp(&val, &system_posinf, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(buf, &val, 8) |
| * |
| */ |
| __pyx_t_5 = (memcmp((&__pyx_v_val), (&__pyx_v_6cpyamf_4util_system_posinf), 8) == 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":825 |
| * done = 1 |
| * elif memcmp(&val, &system_posinf, 8) == 0: |
| * memcpy(buf, &val, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_buf, (&__pyx_v_val), 8); |
| |
| /* "cpyamf/util.pyx":827 |
| * memcpy(buf, &val, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(&val, &system_neginf, 8) == 0: |
| * memcpy(buf, &val, 8) |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L8; |
| } |
| |
| /* "cpyamf/util.pyx":828 |
| * |
| * done = 1 |
| * elif memcmp(&val, &system_neginf, 8) == 0: # <<<<<<<<<<<<<< |
| * memcpy(buf, &val, 8) |
| * |
| */ |
| __pyx_t_5 = (memcmp((&__pyx_v_val), (&__pyx_v_6cpyamf_4util_system_neginf), 8) == 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":829 |
| * done = 1 |
| * elif memcmp(&val, &system_neginf, 8) == 0: |
| * memcpy(buf, &val, 8) # <<<<<<<<<<<<<< |
| * |
| * done = 1 |
| */ |
| memcpy(__pyx_v_buf, (&__pyx_v_val), 8); |
| |
| /* "cpyamf/util.pyx":831 |
| * memcpy(buf, &val, 8) |
| * |
| * done = 1 # <<<<<<<<<<<<<< |
| * |
| * if done == 1: |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L8; |
| } |
| __pyx_L8:; |
| |
| /* "cpyamf/util.pyx":833 |
| * done = 1 |
| * |
| * if done == 1: # <<<<<<<<<<<<<< |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| */ |
| __pyx_t_5 = (__pyx_v_done == 1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":834 |
| * |
| * if done == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| */ |
| __pyx_t_5 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":835 |
| * if done == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_5 = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian)); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":836 |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * else: |
| */ |
| __pyx_t_5 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":837 |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * else: |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| goto __pyx_L12; |
| } |
| __pyx_L12:; |
| goto __pyx_L11; |
| } |
| __pyx_L11:; |
| goto __pyx_L10; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":839 |
| * PyErr_NoMemory() |
| * else: |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_5 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":840 |
| * else: |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_5 = (__pyx_f_6cpyamf_4util_swap_bytes(__pyx_v_buf, 8) == -1); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":841 |
| * if is_big_endian(self.endian): |
| * if swap_bytes(buf, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * if done == 0: |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| goto __pyx_L14; |
| } |
| __pyx_L14:; |
| goto __pyx_L13; |
| } |
| __pyx_L13:; |
| } |
| __pyx_L10:; |
| goto __pyx_L9; |
| } |
| __pyx_L9:; |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| |
| /* "cpyamf/util.pyx":843 |
| * PyErr_NoMemory() |
| * |
| * if done == 0: # <<<<<<<<<<<<<< |
| * _PyFloat_Pack8(val, <unsigned char *>buf, not is_big_endian(self.endian)) |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_done == 0); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":844 |
| * |
| * if done == 0: |
| * _PyFloat_Pack8(val, <unsigned char *>buf, not is_big_endian(self.endian)) # <<<<<<<<<<<<<< |
| * |
| * self.write(<char *>buf, 8) |
| */ |
| __pyx_t_4 = _PyFloat_Pack8(__pyx_v_val, __pyx_v_buf, (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian))); if (unlikely(__pyx_t_4 == -1 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| goto __pyx_L15; |
| } |
| __pyx_L15:; |
| |
| /* "cpyamf/util.pyx":846 |
| * _PyFloat_Pack8(val, <unsigned char *>buf, not is_big_endian(self.endian)) |
| * |
| * self.write(<char *>buf, 8) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, ((char *)__pyx_v_buf), 8); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| } |
| |
| /* "cpyamf/util.pyx":848 |
| * self.write(<char *>buf, 8) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L6; |
| __pyx_L5: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":850 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cdef int read_float(self, float *x) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_double"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":802 |
| * return 0 |
| * |
| * cpdef int write_double(self, double val) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes an 8 byte float to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_27write_double(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_27write_double[] = "\n Writes an 8 byte float to the stream.\n\n @param val: 8 byte float\n @type val: C{float}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_27write_double(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { |
| double __pyx_v_val; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_double"); |
| assert(__pyx_arg_val); { |
| __pyx_v_val = __pyx_PyFloat_AsDouble(__pyx_arg_val); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_double"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_double(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_val, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_double"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":852 |
| * return 0 |
| * |
| * cdef int read_float(self, float *x) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte float from the stream. |
| */ |
| |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_read_float(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, float *__pyx_v_x) { |
| char *__pyx_v_buf; |
| unsigned char __pyx_v_le; |
| int __pyx_r; |
| int __pyx_t_1; |
| double __pyx_t_2; |
| __Pyx_RefNannySetupContext("read_float"); |
| |
| /* "cpyamf/util.pyx":856 |
| * Reads a 4 byte float from the stream. |
| * """ |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * cdef unsigned char le = not is_big_endian(self.endian) |
| * |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":857 |
| * """ |
| * cdef char *buf = NULL |
| * cdef unsigned char le = not is_big_endian(self.endian) # <<<<<<<<<<<<<< |
| * |
| * self.read(&buf, 4) |
| */ |
| __pyx_v_le = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian)); |
| |
| /* "cpyamf/util.pyx":859 |
| * cdef unsigned char le = not is_big_endian(self.endian) |
| * |
| * self.read(&buf, 4) # <<<<<<<<<<<<<< |
| * |
| * x[0] = _PyFloat_Unpack4(<unsigned char *>buf, le) |
| */ |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->read(__pyx_v_self, (&__pyx_v_buf), 4); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":861 |
| * self.read(&buf, 4) |
| * |
| * x[0] = _PyFloat_Unpack4(<unsigned char *>buf, le) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_t_2 = _PyFloat_Unpack4(((unsigned char *)__pyx_v_buf), __pyx_v_le); if (unlikely(__pyx_t_2 == (-1.0) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| (__pyx_v_x[0]) = __pyx_t_2; |
| |
| /* "cpyamf/util.pyx":863 |
| * x[0] = _PyFloat_Unpack4(<unsigned char *>buf, le) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef int write_float(self, float c) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.read_float"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":865 |
| * return 0 |
| * |
| * cpdef int write_float(self, float c) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte float to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_28write_float(PyObject *__pyx_v_self, PyObject *__pyx_arg_c); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_write_float(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, float __pyx_v_c, int __pyx_skip_dispatch) { |
| unsigned char *__pyx_v_buf; |
| unsigned char __pyx_v_le; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| PyObject *__pyx_t_6; |
| __Pyx_RefNannySetupContext("write_float"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write_float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_28write_float)) { |
| __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":873 |
| * """ |
| * cdef unsigned char *buf |
| * cdef unsigned char le = not is_big_endian(self.endian) # <<<<<<<<<<<<<< |
| * |
| * buf = <unsigned char *>malloc(4) |
| */ |
| __pyx_v_le = (!__pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_self->endian)); |
| |
| /* "cpyamf/util.pyx":875 |
| * cdef unsigned char le = not is_big_endian(self.endian) |
| * |
| * buf = <unsigned char *>malloc(4) # <<<<<<<<<<<<<< |
| * |
| * if buf == NULL: |
| */ |
| __pyx_v_buf = ((unsigned char *)malloc(4)); |
| |
| /* "cpyamf/util.pyx":877 |
| * buf = <unsigned char *>malloc(4) |
| * |
| * if buf == NULL: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_5 = (__pyx_v_buf == NULL); |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":878 |
| * |
| * if buf == NULL: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * try: |
| */ |
| __pyx_t_6 = PyErr_NoMemory(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":880 |
| * PyErr_NoMemory() |
| * |
| * try: # <<<<<<<<<<<<<< |
| * _PyFloat_Pack4(c, <unsigned char *>buf, le) |
| * |
| */ |
| /*try:*/ { |
| |
| /* "cpyamf/util.pyx":881 |
| * |
| * try: |
| * _PyFloat_Pack4(c, <unsigned char *>buf, le) # <<<<<<<<<<<<<< |
| * |
| * self.write(<char *>buf, 4) |
| */ |
| __pyx_t_4 = _PyFloat_Pack4(__pyx_v_c, __pyx_v_buf, __pyx_v_le); if (unlikely(__pyx_t_4 == -1 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| |
| /* "cpyamf/util.pyx":883 |
| * _PyFloat_Pack4(c, <unsigned char *>buf, le) |
| * |
| * self.write(<char *>buf, 4) # <<<<<<<<<<<<<< |
| * finally: |
| * free(buf) |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, ((char *)__pyx_v_buf), 4); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L5;} |
| } |
| |
| /* "cpyamf/util.pyx":885 |
| * self.write(<char *>buf, 4) |
| * finally: |
| * free(buf) # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| /*finally:*/ { |
| int __pyx_why; |
| PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; |
| int __pyx_exc_lineno; |
| __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; |
| __pyx_why = 0; goto __pyx_L6; |
| __pyx_L5: { |
| __pyx_why = 4; |
| __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); |
| __pyx_exc_lineno = __pyx_lineno; |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| free(__pyx_v_buf); |
| switch (__pyx_why) { |
| case 4: { |
| __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); |
| __pyx_lineno = __pyx_exc_lineno; |
| __pyx_exc_type = 0; |
| __pyx_exc_value = 0; |
| __pyx_exc_tb = 0; |
| goto __pyx_L1_error; |
| } |
| } |
| } |
| |
| /* "cpyamf/util.pyx":887 |
| * free(buf) |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * cpdef int append(self, object obj) except -1: |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_float"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":865 |
| * return 0 |
| * |
| * cpdef int write_float(self, float c) except -1: # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte float to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_28write_float(PyObject *__pyx_v_self, PyObject *__pyx_arg_c); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_19cBufferedByteStream_28write_float[] = "\n Writes a 4 byte float to the stream.\n\n @param c: 4 byte float\n @type c: C{float}\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_28write_float(PyObject *__pyx_v_self, PyObject *__pyx_arg_c) { |
| float __pyx_v_c; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("write_float"); |
| assert(__pyx_arg_c); { |
| __pyx_v_c = __pyx_PyFloat_AsDouble(__pyx_arg_c); if (unlikely((__pyx_v_c == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_float"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->write_float(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_c, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.write_float"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":889 |
| * return 0 |
| * |
| * cpdef int append(self, object obj) except -1: # <<<<<<<<<<<<<< |
| * cdef int i = self.pos |
| * |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_29append(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ |
| static int __pyx_f_6cpyamf_4util_19cBufferedByteStream_append(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) { |
| int __pyx_v_i; |
| int __pyx_r; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| __Pyx_RefNannySetupContext("append"); |
| /* Check if called by wrapper */ |
| if (unlikely(__pyx_skip_dispatch)) ; |
| /* Check if overriden in Python */ |
| else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6cpyamf_4util_19cBufferedByteStream_29append)) { |
| __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| __Pyx_INCREF(__pyx_v_obj); |
| PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj); |
| __Pyx_GIVEREF(__pyx_v_obj); |
| __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_r = __pyx_t_4; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| goto __pyx_L0; |
| } |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| } |
| |
| /* "cpyamf/util.pyx":890 |
| * |
| * cpdef int append(self, object obj) except -1: |
| * cdef int i = self.pos # <<<<<<<<<<<<<< |
| * |
| * self.pos = self.length |
| */ |
| __pyx_v_i = __pyx_v_self->pos; |
| |
| /* "cpyamf/util.pyx":892 |
| * cdef int i = self.pos |
| * |
| * self.pos = self.length # <<<<<<<<<<<<<< |
| * |
| * if hasattr(obj, 'getvalue'): |
| */ |
| __pyx_v_self->pos = __pyx_v_self->length; |
| |
| /* "cpyamf/util.pyx":894 |
| * self.pos = self.length |
| * |
| * if hasattr(obj, 'getvalue'): # <<<<<<<<<<<<<< |
| * self.write_utf8_string(obj.getvalue()) |
| * else: |
| */ |
| __pyx_t_5 = PyObject_HasAttr(__pyx_v_obj, ((PyObject *)__pyx_n_s__getvalue)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_t_5) { |
| |
| /* "cpyamf/util.pyx":895 |
| * |
| * if hasattr(obj, 'getvalue'): |
| * self.write_utf8_string(obj.getvalue()) # <<<<<<<<<<<<<< |
| * else: |
| * self.write_utf8_string(obj) |
| */ |
| __pyx_t_1 = PyObject_GetAttr(__pyx_v_obj, __pyx_n_s__getvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write_utf8_string(__pyx_v_self, __pyx_t_3, 0); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| goto __pyx_L3; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":897 |
| * self.write_utf8_string(obj.getvalue()) |
| * else: |
| * self.write_utf8_string(obj) # <<<<<<<<<<<<<< |
| * |
| * self.pos = i |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self->__pyx_vtab)->write_utf8_string(__pyx_v_self, __pyx_v_obj, 0); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":899 |
| * self.write_utf8_string(obj) |
| * |
| * self.pos = i # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_v_self->pos = __pyx_v_i; |
| |
| /* "cpyamf/util.pyx":901 |
| * self.pos = i |
| * |
| * return 0 # <<<<<<<<<<<<<< |
| * |
| * def __nonzero__(self): |
| */ |
| __pyx_r = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.append"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":889 |
| * return 0 |
| * |
| * cpdef int append(self, object obj) except -1: # <<<<<<<<<<<<<< |
| * cdef int i = self.pos |
| * |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_29append(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ |
| static PyObject *__pyx_pf_6cpyamf_4util_19cBufferedByteStream_29append(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("append"); |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->__pyx_vtab)->append(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_obj, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.cBufferedByteStream.append"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":903 |
| * return 0 |
| * |
| * def __nonzero__(self): # <<<<<<<<<<<<<< |
| * return self.length > 0 |
| * |
| */ |
| |
| static int __pyx_pf_6cpyamf_4util_19cBufferedByteStream_30__nonzero__(PyObject *__pyx_v_self); /*proto*/ |
| static int __pyx_pf_6cpyamf_4util_19cBufferedByteStream_30__nonzero__(PyObject *__pyx_v_self) { |
| int __pyx_r; |
| __Pyx_RefNannySetupContext("__nonzero__"); |
| |
| /* "cpyamf/util.pyx":904 |
| * |
| * def __nonzero__(self): |
| * return self.length > 0 # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_r = (((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self)->length > 0); |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":913 |
| * """ |
| * |
| * def __init__(self, buf=None, min_buf_size=512): # <<<<<<<<<<<<<< |
| * cdef Py_ssize_t i |
| * cdef cBufferedByteStream x |
| */ |
| |
| static int __pyx_pf_6cpyamf_4util_18BufferedByteStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static int __pyx_pf_6cpyamf_4util_18BufferedByteStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| PyObject *__pyx_v_buf = 0; |
| PyObject *__pyx_v_min_buf_size = 0; |
| struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *__pyx_v_x; |
| PyObject *__pyx_v_old_pos; |
| int __pyx_r; |
| Py_ssize_t __pyx_t_1; |
| int __pyx_t_2; |
| PyObject *__pyx_t_3 = NULL; |
| PyObject *__pyx_t_4 = NULL; |
| PyObject *__pyx_t_5 = NULL; |
| int __pyx_t_6; |
| int __pyx_t_7; |
| int __pyx_t_8; |
| int __pyx_t_9; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buf,&__pyx_n_s__min_buf_size,0}; |
| __Pyx_RefNannySetupContext("__init__"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[2] = {0,0}; |
| values[0] = ((PyObject *)Py_None); |
| values[1] = ((PyObject *)__pyx_int_512); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buf); |
| if (value) { values[0] = value; kw_args--; } |
| } |
| case 1: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_buf_size); |
| if (value) { values[1] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| __pyx_v_buf = values[0]; |
| __pyx_v_min_buf_size = values[1]; |
| } else { |
| __pyx_v_buf = ((PyObject *)Py_None); |
| __pyx_v_min_buf_size = ((PyObject *)__pyx_int_512); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: __pyx_v_min_buf_size = PyTuple_GET_ITEM(__pyx_args, 1); |
| case 1: __pyx_v_buf = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.__init__"); |
| __Pyx_RefNannyFinishContext(); |
| return -1; |
| __pyx_L4_argument_unpacking_done:; |
| __pyx_v_x = ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)Py_None); __Pyx_INCREF(Py_None); |
| __pyx_v_old_pos = Py_None; __Pyx_INCREF(Py_None); |
| |
| /* "cpyamf/util.pyx":917 |
| * cdef cBufferedByteStream x |
| * |
| * self.min_buf_size = min_buf_size # <<<<<<<<<<<<<< |
| * |
| * if buf is None: |
| */ |
| __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_min_buf_size); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.min_buf_size = __pyx_t_1; |
| |
| /* "cpyamf/util.pyx":919 |
| * self.min_buf_size = min_buf_size |
| * |
| * if buf is None: # <<<<<<<<<<<<<< |
| * pass |
| * elif isinstance(buf, cBufferedByteStream): |
| */ |
| __pyx_t_2 = (__pyx_v_buf == Py_None); |
| if (__pyx_t_2) { |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":921 |
| * if buf is None: |
| * pass |
| * elif isinstance(buf, cBufferedByteStream): # <<<<<<<<<<<<<< |
| * x = <cBufferedByteStream>buf |
| * self.write(x.getvalue()) |
| */ |
| __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_buf, ((PyObject*)__pyx_ptype_6cpyamf_4util_cBufferedByteStream)); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":922 |
| * pass |
| * elif isinstance(buf, cBufferedByteStream): |
| * x = <cBufferedByteStream>buf # <<<<<<<<<<<<<< |
| * self.write(x.getvalue()) |
| * elif isinstance(buf, (str, unicode)): |
| */ |
| __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_buf))); |
| __Pyx_DECREF(((PyObject *)__pyx_v_x)); |
| __pyx_v_x = ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_buf); |
| |
| /* "cpyamf/util.pyx":923 |
| * elif isinstance(buf, cBufferedByteStream): |
| * x = <cBufferedByteStream>buf |
| * self.write(x.getvalue()) # <<<<<<<<<<<<<< |
| * elif isinstance(buf, (str, unicode)): |
| * self.write(buf) |
| */ |
| __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream *)__pyx_v_x->__pyx_vtab)->getvalue(__pyx_v_x, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| __Pyx_GIVEREF(__pyx_t_4); |
| __pyx_t_4 = 0; |
| __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":924 |
| * x = <cBufferedByteStream>buf |
| * self.write(x.getvalue()) |
| * elif isinstance(buf, (str, unicode)): # <<<<<<<<<<<<<< |
| * self.write(buf) |
| * elif hasattr(buf, 'getvalue'): |
| */ |
| __Pyx_INCREF(__pyx_v_buf); |
| __pyx_t_4 = __pyx_v_buf; |
| __pyx_t_2 = PyString_Check(__pyx_t_4); |
| if (!__pyx_t_2) { |
| __pyx_t_6 = PyUnicode_Check(__pyx_t_4); |
| __pyx_t_7 = __pyx_t_6; |
| } else { |
| __pyx_t_7 = __pyx_t_2; |
| } |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| if (__pyx_t_7) { |
| |
| /* "cpyamf/util.pyx":925 |
| * self.write(x.getvalue()) |
| * elif isinstance(buf, (str, unicode)): |
| * self.write(buf) # <<<<<<<<<<<<<< |
| * elif hasattr(buf, 'getvalue'): |
| * self.write(buf.getvalue()) |
| */ |
| __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| __Pyx_INCREF(__pyx_v_buf); |
| PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_buf); |
| __Pyx_GIVEREF(__pyx_v_buf); |
| __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":926 |
| * elif isinstance(buf, (str, unicode)): |
| * self.write(buf) |
| * elif hasattr(buf, 'getvalue'): # <<<<<<<<<<<<<< |
| * self.write(buf.getvalue()) |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): |
| */ |
| __pyx_t_7 = PyObject_HasAttr(__pyx_v_buf, ((PyObject *)__pyx_n_s__getvalue)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_t_7) { |
| |
| /* "cpyamf/util.pyx":927 |
| * self.write(buf) |
| * elif hasattr(buf, 'getvalue'): |
| * self.write(buf.getvalue()) # <<<<<<<<<<<<<< |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): |
| * old_pos = buf.tell() |
| */ |
| __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_5 = PyObject_GetAttr(__pyx_v_buf, __pyx_n_s__getvalue); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_5); |
| __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| __Pyx_GIVEREF(__pyx_t_4); |
| __pyx_t_4 = 0; |
| __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":928 |
| * elif hasattr(buf, 'getvalue'): |
| * self.write(buf.getvalue()) |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): # <<<<<<<<<<<<<< |
| * old_pos = buf.tell() |
| * buf.seek(0) |
| */ |
| __pyx_t_7 = PyObject_HasAttr(__pyx_v_buf, ((PyObject *)__pyx_n_s__read)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_t_7) { |
| __pyx_t_2 = PyObject_HasAttr(__pyx_v_buf, ((PyObject *)__pyx_n_s__seek)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_t_2) { |
| __pyx_t_6 = PyObject_HasAttr(__pyx_v_buf, ((PyObject *)__pyx_n_s__tell)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_8 = __pyx_t_6; |
| } else { |
| __pyx_t_8 = __pyx_t_2; |
| } |
| __pyx_t_2 = __pyx_t_8; |
| } else { |
| __pyx_t_2 = __pyx_t_7; |
| } |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":929 |
| * self.write(buf.getvalue()) |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): |
| * old_pos = buf.tell() # <<<<<<<<<<<<<< |
| * buf.seek(0) |
| * self.write(buf.read()) |
| */ |
| __pyx_t_4 = PyObject_GetAttr(__pyx_v_buf, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_5); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_DECREF(__pyx_v_old_pos); |
| __pyx_v_old_pos = __pyx_t_5; |
| __pyx_t_5 = 0; |
| |
| /* "cpyamf/util.pyx":930 |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): |
| * old_pos = buf.tell() |
| * buf.seek(0) # <<<<<<<<<<<<<< |
| * self.write(buf.read()) |
| * buf.seek(old_pos) |
| */ |
| __pyx_t_5 = PyObject_GetAttr(__pyx_v_buf, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_5); |
| __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| |
| /* "cpyamf/util.pyx":931 |
| * old_pos = buf.tell() |
| * buf.seek(0) |
| * self.write(buf.read()) # <<<<<<<<<<<<<< |
| * buf.seek(old_pos) |
| * else: |
| */ |
| __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_5 = PyObject_GetAttr(__pyx_v_buf, __pyx_n_s__read); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_5); |
| __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); |
| __Pyx_GIVEREF(__pyx_t_3); |
| __pyx_t_3 = 0; |
| __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| |
| /* "cpyamf/util.pyx":932 |
| * buf.seek(0) |
| * self.write(buf.read()) |
| * buf.seek(old_pos) # <<<<<<<<<<<<<< |
| * else: |
| * raise TypeError("Unable to coerce buf->StringIO") |
| */ |
| __pyx_t_3 = PyObject_GetAttr(__pyx_v_buf, __pyx_n_s__seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| __Pyx_INCREF(__pyx_v_old_pos); |
| PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_old_pos); |
| __Pyx_GIVEREF(__pyx_v_old_pos); |
| __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| goto __pyx_L6; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":934 |
| * buf.seek(old_pos) |
| * else: |
| * raise TypeError("Unable to coerce buf->StringIO") # <<<<<<<<<<<<<< |
| * |
| * self.seek(0) |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":936 |
| * raise TypeError("Unable to coerce buf->StringIO") |
| * |
| * self.seek(0) # <<<<<<<<<<<<<< |
| * |
| * property endian: |
| */ |
| __pyx_t_9 = ((struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 0, 0, NULL); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_XDECREF(__pyx_t_5); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.__init__"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_DECREF((PyObject *)__pyx_v_x); |
| __Pyx_DECREF(__pyx_v_old_pos); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":939 |
| * |
| * property endian: |
| * def __set__(self, value): # <<<<<<<<<<<<<< |
| * if PyString_Check(value) == 0: |
| * raise TypeError('String value expected') |
| */ |
| |
| static int __pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ |
| static int __pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { |
| int __pyx_r; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| PyObject *__pyx_t_3 = NULL; |
| int __pyx_t_4; |
| int __pyx_t_5; |
| char *__pyx_t_6; |
| __Pyx_RefNannySetupContext("__set__"); |
| |
| /* "cpyamf/util.pyx":940 |
| * property endian: |
| * def __set__(self, value): |
| * if PyString_Check(value) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('String value expected') |
| * |
| */ |
| __pyx_t_1 = (PyString_Check(__pyx_v_value) == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":941 |
| * def __set__(self, value): |
| * if PyString_Check(value) == 0: |
| * raise TypeError('String value expected') # <<<<<<<<<<<<<< |
| * |
| * if value not in [ENDIAN_NETWORK, ENDIAN_NATIVE, ENDIAN_LITTLE, ENDIAN_BIG]: |
| */ |
| __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_Raise(__pyx_t_2, 0, 0); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":943 |
| * raise TypeError('String value expected') |
| * |
| * if value not in [ENDIAN_NETWORK, ENDIAN_NATIVE, ENDIAN_LITTLE, ENDIAN_BIG]: # <<<<<<<<<<<<<< |
| * raise ValueError('Not a valid endian type') |
| * |
| */ |
| __Pyx_INCREF(__pyx_v_value); |
| __pyx_t_2 = __pyx_v_value; |
| __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_b_17), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_t_4 = __pyx_t_1; |
| if (__pyx_t_4) { |
| __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_b_18), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_t_5 = __pyx_t_1; |
| __pyx_t_1 = __pyx_t_5; |
| } else { |
| __pyx_t_1 = __pyx_t_4; |
| } |
| if (__pyx_t_1) { |
| __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_b_19), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_t_5 = __pyx_t_4; |
| __pyx_t_4 = __pyx_t_5; |
| } else { |
| __pyx_t_4 = __pyx_t_1; |
| } |
| if (__pyx_t_4) { |
| __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_b_20), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| __pyx_t_5 = __pyx_t_1; |
| __pyx_t_1 = __pyx_t_5; |
| } else { |
| __pyx_t_1 = __pyx_t_4; |
| } |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_t_4 = __pyx_t_1; |
| if (__pyx_t_4) { |
| |
| /* "cpyamf/util.pyx":944 |
| * |
| * if value not in [ENDIAN_NETWORK, ENDIAN_NATIVE, ENDIAN_LITTLE, ENDIAN_BIG]: |
| * raise ValueError('Not a valid endian type') # <<<<<<<<<<<<<< |
| * |
| * self.endian = PyString_AsString(value)[0] |
| */ |
| __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_Raise(__pyx_t_2, 0, 0); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":946 |
| * raise ValueError('Not a valid endian type') |
| * |
| * self.endian = PyString_AsString(value)[0] # <<<<<<<<<<<<<< |
| * |
| * def __get__(self): |
| */ |
| __pyx_t_6 = PyString_AsString(__pyx_v_value); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.endian = (__pyx_t_6[0]); |
| |
| __pyx_r = 0; |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.endian.__set__"); |
| __pyx_r = -1; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":948 |
| * self.endian = PyString_AsString(value)[0] |
| * |
| * def __get__(self): # <<<<<<<<<<<<<< |
| * return PyString_FromStringAndSize(&self.endian, 1) |
| * |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian_1__get__(PyObject *__pyx_v_self); /*proto*/ |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian_1__get__(PyObject *__pyx_v_self) { |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| __Pyx_RefNannySetupContext("__get__"); |
| |
| /* "cpyamf/util.pyx":949 |
| * |
| * def __get__(self): |
| * return PyString_FromStringAndSize(&self.endian, 1) # <<<<<<<<<<<<<< |
| * |
| * def read(self, size=-1): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.endian), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.endian.__get__"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":951 |
| * return PyString_FromStringAndSize(&self.endian, 1) |
| * |
| * def read(self, size=-1): # <<<<<<<<<<<<<< |
| * """ |
| * Reads C{size} bytes from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_1read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_1read[] = "\n Reads C{size} bytes from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_1read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| PyObject *__pyx_v_size = 0; |
| Py_ssize_t __pyx_v_s; |
| char *__pyx_v_buf; |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| int __pyx_t_2; |
| Py_ssize_t __pyx_t_3; |
| int __pyx_t_4; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| __Pyx_RefNannySetupContext("read"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[1] = {0}; |
| values[0] = ((PyObject *)__pyx_int_neg_1); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| if (value) { values[0] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| __pyx_v_size = values[0]; |
| } else { |
| __pyx_v_size = ((PyObject *)__pyx_int_neg_1); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.read"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| |
| /* "cpyamf/util.pyx":958 |
| * cdef object cls |
| * |
| * if size != -1: # <<<<<<<<<<<<<< |
| * s = <Py_ssize_t>size |
| * else: |
| */ |
| __pyx_t_1 = PyObject_RichCompare(__pyx_v_size, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":959 |
| * |
| * if size != -1: |
| * s = <Py_ssize_t>size # <<<<<<<<<<<<<< |
| * else: |
| * s = self.remaining() |
| */ |
| __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_size); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_s = __pyx_t_3; |
| goto __pyx_L6; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":961 |
| * s = <Py_ssize_t>size |
| * else: |
| * s = self.remaining() # <<<<<<<<<<<<<< |
| * |
| * if s == 0: |
| */ |
| __pyx_t_3 = ((struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.remaining(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 0); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_s = __pyx_t_3; |
| |
| /* "cpyamf/util.pyx":963 |
| * s = self.remaining() |
| * |
| * if s == 0: # <<<<<<<<<<<<<< |
| * s = 1 |
| * |
| */ |
| __pyx_t_2 = (__pyx_v_s == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":964 |
| * |
| * if s == 0: |
| * s = 1 # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = NULL |
| */ |
| __pyx_v_s = 1; |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":966 |
| * s = 1 |
| * |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.read(self, &buf, s) |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":968 |
| * cdef char *buf = NULL |
| * |
| * cBufferedByteStream.read(self, &buf, s) # <<<<<<<<<<<<<< |
| * |
| * return PyString_FromStringAndSize(buf, s) |
| */ |
| __pyx_t_4 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->read(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), (&__pyx_v_buf), __pyx_v_s); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":970 |
| * cBufferedByteStream.read(self, &buf, s) |
| * |
| * return PyString_FromStringAndSize(buf, s) # <<<<<<<<<<<<<< |
| * |
| * def write(self, x, size=-1): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = PyString_FromStringAndSize(__pyx_v_buf, __pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.read"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":972 |
| * return PyString_FromStringAndSize(buf, s) |
| * |
| * def write(self, x, size=-1): # <<<<<<<<<<<<<< |
| * """ |
| * Writes the content of the specified C{x} into this buffer. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_2write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_2write[] = "\n Writes the content of the specified C{x} into this buffer.\n\n @param x:\n @type x:\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_2write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| PyObject *__pyx_v_x = 0; |
| PyObject *__pyx_v_size = 0; |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| char *__pyx_t_4; |
| Py_ssize_t __pyx_t_5; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__size,0}; |
| __Pyx_RefNannySetupContext("write"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[2] = {0,0}; |
| values[1] = ((PyObject *)__pyx_int_neg_1); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); |
| if (likely(values[0])) kw_args--; |
| else goto __pyx_L5_argtuple_error; |
| case 1: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| if (value) { values[1] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| __pyx_v_x = values[0]; |
| __pyx_v_size = values[1]; |
| } else { |
| __pyx_v_size = ((PyObject *)__pyx_int_neg_1); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 2: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 1); |
| case 1: __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0); |
| break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| |
| /* "cpyamf/util.pyx":979 |
| * @type x: |
| * """ |
| * if size == -1: # <<<<<<<<<<<<<< |
| * cBufferedByteStream.write_utf8_string(self, x) |
| * else: |
| */ |
| __pyx_t_1 = PyObject_RichCompare(__pyx_v_size, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":980 |
| * """ |
| * if size == -1: |
| * cBufferedByteStream.write_utf8_string(self, x) # <<<<<<<<<<<<<< |
| * else: |
| * cBufferedByteStream.write(self, x, size) |
| */ |
| __pyx_t_3 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_utf8_string(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_x, 1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L6; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":982 |
| * cBufferedByteStream.write_utf8_string(self, x) |
| * else: |
| * cBufferedByteStream.write(self, x, size) # <<<<<<<<<<<<<< |
| * |
| * def flush(self): |
| */ |
| __pyx_t_4 = PyBytes_AsString(__pyx_v_x); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_size); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| } |
| __pyx_L6:; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":984 |
| * cBufferedByteStream.write(self, x, size) |
| * |
| * def flush(self): # <<<<<<<<<<<<<< |
| * # no-op |
| * pass |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_3flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_3flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| PyObject *__pyx_r = NULL; |
| __Pyx_RefNannySetupContext("flush"); |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":988 |
| * pass |
| * |
| * def __len__(self): # <<<<<<<<<<<<<< |
| * return self.length |
| * |
| */ |
| |
| static Py_ssize_t __pyx_pf_6cpyamf_4util_18BufferedByteStream_4__len__(PyObject *__pyx_v_self); /*proto*/ |
| static Py_ssize_t __pyx_pf_6cpyamf_4util_18BufferedByteStream_4__len__(PyObject *__pyx_v_self) { |
| Py_ssize_t __pyx_r; |
| __Pyx_RefNannySetupContext("__len__"); |
| |
| /* "cpyamf/util.pyx":989 |
| * |
| * def __len__(self): |
| * return self.length # <<<<<<<<<<<<<< |
| * |
| * def peek(self, Py_ssize_t size=1): |
| */ |
| __pyx_r = ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.length; |
| goto __pyx_L0; |
| |
| __pyx_r = 0; |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":991 |
| * return self.length |
| * |
| * def peek(self, Py_ssize_t size=1): # <<<<<<<<<<<<<< |
| * """ |
| * Looks C{size} bytes ahead in the stream, returning what it finds, |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_5peek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_5peek[] = "\n Looks C{size} bytes ahead in the stream, returning what it finds,\n returning the stream pointer to its initial position.\n\n @param size: Default is 1.\n @type size: C{int}\n\n @rtype:\n @return: Bytes.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_5peek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| Py_ssize_t __pyx_v_size; |
| char *__pyx_v_buf; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| Py_ssize_t __pyx_t_2; |
| PyObject *__pyx_t_3 = NULL; |
| static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| __Pyx_RefNannySetupContext("peek"); |
| if (unlikely(__pyx_kwds)) { |
| Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); |
| PyObject* values[1] = {0}; |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 0: |
| if (kw_args > 0) { |
| PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| if (value) { values[0] = value; kw_args--; } |
| } |
| } |
| if (unlikely(kw_args > 0)) { |
| if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "peek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } |
| if (values[0]) { |
| __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| } else { |
| __pyx_v_size = ((Py_ssize_t)1); |
| } |
| } else { |
| __pyx_v_size = ((Py_ssize_t)1); |
| switch (PyTuple_GET_SIZE(__pyx_args)) { |
| case 1: __pyx_v_size = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| case 0: break; |
| default: goto __pyx_L5_argtuple_error; |
| } |
| } |
| goto __pyx_L4_argument_unpacking_done; |
| __pyx_L5_argtuple_error:; |
| __Pyx_RaiseArgtupleInvalid("peek", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| __pyx_L3_error:; |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.peek"); |
| __Pyx_RefNannyFinishContext(); |
| return NULL; |
| __pyx_L4_argument_unpacking_done:; |
| |
| /* "cpyamf/util.pyx":1002 |
| * @return: Bytes. |
| * """ |
| * cdef char *buf = NULL # <<<<<<<<<<<<<< |
| * |
| * if size == -1: |
| */ |
| __pyx_v_buf = NULL; |
| |
| /* "cpyamf/util.pyx":1004 |
| * cdef char *buf = NULL |
| * |
| * if size == -1: # <<<<<<<<<<<<<< |
| * size = cBufferedByteStream.remaining(self) |
| * |
| */ |
| __pyx_t_1 = (__pyx_v_size == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1005 |
| * |
| * if size == -1: |
| * size = cBufferedByteStream.remaining(self) # <<<<<<<<<<<<<< |
| * |
| * size = cBufferedByteStream.peek(self, &buf, size) |
| */ |
| __pyx_t_2 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->remaining(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_size = __pyx_t_2; |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":1007 |
| * size = cBufferedByteStream.remaining(self) |
| * |
| * size = cBufferedByteStream.peek(self, &buf, size) # <<<<<<<<<<<<<< |
| * |
| * return PyString_FromStringAndSize(buf, size) |
| */ |
| __pyx_t_2 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->peek(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), (&__pyx_v_buf), __pyx_v_size); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_size = __pyx_t_2; |
| |
| /* "cpyamf/util.pyx":1009 |
| * size = cBufferedByteStream.peek(self, &buf, size) |
| * |
| * return PyString_FromStringAndSize(buf, size) # <<<<<<<<<<<<<< |
| * |
| * def write_char(self, x): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_buf, __pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_r = __pyx_t_3; |
| __pyx_t_3 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.peek"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1011 |
| * return PyString_FromStringAndSize(buf, size) |
| * |
| * def write_char(self, x): # <<<<<<<<<<<<<< |
| * """ |
| * Write a C{char} to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_6write_char(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_6write_char[] = "\n Write a C{char} to the stream.\n\n @param x: char\n @type x: C{int}\n @raise TypeError: Unexpected type for int C{x}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_6write_char(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| char __pyx_t_5; |
| int __pyx_t_6; |
| __Pyx_RefNannySetupContext("write_char"); |
| |
| /* "cpyamf/util.pyx":1019 |
| * @raise TypeError: Unexpected type for int C{x}. |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('expected int for x') |
| * |
| */ |
| __pyx_t_1 = (PyInt_Check(__pyx_v_x) == 0); |
| if (__pyx_t_1) { |
| __pyx_t_2 = (PyLong_Check(__pyx_v_x) == 0); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1020 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_char(self, <char>x) |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1022 |
| * raise TypeError('expected int for x') |
| * |
| * cBufferedByteStream.write_char(self, <char>x) # <<<<<<<<<<<<<< |
| * |
| * def write_ushort(self, x): |
| */ |
| __pyx_t_5 = __Pyx_PyInt_AsChar(__pyx_v_x); if (unlikely((__pyx_t_5 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_6 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_char(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_t_5, 1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write_char"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1024 |
| * cBufferedByteStream.write_char(self, <char>x) |
| * |
| * def write_ushort(self, x): # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_7write_ushort(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_7write_ushort[] = "\n Writes a 2 byte unsigned integer to the stream.\n\n @param x: 2 byte unsigned integer\n @type x: C{int}\n @raise TypeError: Unexpected type for int C{x}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_7write_ushort(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| unsigned short __pyx_t_5; |
| int __pyx_t_6; |
| __Pyx_RefNannySetupContext("write_ushort"); |
| |
| /* "cpyamf/util.pyx":1032 |
| * @raise TypeError: Unexpected type for int C{x}. |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('expected int for x') |
| * |
| */ |
| __pyx_t_1 = (PyInt_Check(__pyx_v_x) == 0); |
| if (__pyx_t_1) { |
| __pyx_t_2 = (PyLong_Check(__pyx_v_x) == 0); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1033 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_ushort(self, <unsigned short>x) |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1035 |
| * raise TypeError('expected int for x') |
| * |
| * cBufferedByteStream.write_ushort(self, <unsigned short>x) # <<<<<<<<<<<<<< |
| * |
| * def write_short(self, x): |
| */ |
| __pyx_t_5 = __Pyx_PyInt_AsUnsignedShort(__pyx_v_x); if (unlikely((__pyx_t_5 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_6 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_ushort(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_t_5, 1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write_ushort"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1037 |
| * cBufferedByteStream.write_ushort(self, <unsigned short>x) |
| * |
| * def write_short(self, x): # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 2 byte integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_8write_short(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_8write_short[] = "\n Writes a 2 byte integer to the stream.\n\n @param x: 2 byte integer\n @type x: C{int}\n @raise TypeError: Unexpected type for int C{x}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_8write_short(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| short __pyx_t_5; |
| int __pyx_t_6; |
| __Pyx_RefNannySetupContext("write_short"); |
| |
| /* "cpyamf/util.pyx":1045 |
| * @raise TypeError: Unexpected type for int C{x}. |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('expected int for x') |
| * |
| */ |
| __pyx_t_1 = (PyInt_Check(__pyx_v_x) == 0); |
| if (__pyx_t_1) { |
| __pyx_t_2 = (PyLong_Check(__pyx_v_x) == 0); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1046 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_short(self, <short>x) |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1048 |
| * raise TypeError('expected int for x') |
| * |
| * cBufferedByteStream.write_short(self, <short>x) # <<<<<<<<<<<<<< |
| * |
| * def write_ulong(self, x): |
| */ |
| __pyx_t_5 = __Pyx_PyInt_AsShort(__pyx_v_x); if (unlikely((__pyx_t_5 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_6 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_short(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_t_5, 1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write_short"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1050 |
| * cBufferedByteStream.write_short(self, <short>x) |
| * |
| * def write_ulong(self, x): # <<<<<<<<<<<<<< |
| * """ |
| * Writes a 4 byte unsigned integer to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_9write_ulong(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_9write_ulong[] = "\n Writes a 4 byte unsigned integer to the stream.\n\n @param x: 4 byte unsigned integer\n @type x: C{int}\n @raise TypeError: Unexpected type for int C{x}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_9write_ulong(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| int __pyx_t_3; |
| PyObject *__pyx_t_4 = NULL; |
| unsigned long __pyx_t_5; |
| int __pyx_t_6; |
| __Pyx_RefNannySetupContext("write_ulong"); |
| |
| /* "cpyamf/util.pyx":1058 |
| * @raise TypeError: Unexpected type for int C{x}. |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('expected int for x') |
| * |
| */ |
| __pyx_t_1 = (PyInt_Check(__pyx_v_x) == 0); |
| if (__pyx_t_1) { |
| __pyx_t_2 = (PyLong_Check(__pyx_v_x) == 0); |
| __pyx_t_3 = __pyx_t_2; |
| } else { |
| __pyx_t_3 = __pyx_t_1; |
| } |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1059 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * if x > 4294967295L or x < 0: |
| */ |
| __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __Pyx_Raise(__pyx_t_4, 0, 0); |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1061 |
| * raise TypeError('expected int for x') |
| * |
| * if x > 4294967295L or x < 0: # <<<<<<<<<<<<<< |
| * raise OverflowError |
| * |
| */ |
| __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_int_4294967295L, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| if (!__pyx_t_3) { |
| __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_4); |
| __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| __pyx_t_2 = __pyx_t_1; |
| } else { |
| __pyx_t_2 = __pyx_t_3; |
| } |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":1062 |
| * |
| * if x > 4294967295L or x < 0: |
| * raise OverflowError # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_ulong(self, <unsigned long>x) |
| */ |
| __Pyx_Raise(__pyx_builtin_OverflowError, 0, 0); |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":1064 |
| * raise OverflowError |
| * |
| * cBufferedByteStream.write_ulong(self, <unsigned long>x) # <<<<<<<<<<<<<< |
| * |
| * def read_double(self): |
| */ |
| __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_x); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_6 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_ulong(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_t_5, 1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_4); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write_ulong"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1066 |
| * cBufferedByteStream.write_ulong(self, <unsigned long>x) |
| * |
| * def read_double(self): # <<<<<<<<<<<<<< |
| * """ |
| * Reads an 8 byte float from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_10read_double(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_10read_double[] = "\n Reads an 8 byte float from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_10read_double(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| double __pyx_v_x; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| int __pyx_t_2; |
| PyObject *__pyx_t_3 = NULL; |
| __Pyx_RefNannySetupContext("read_double"); |
| |
| /* "cpyamf/util.pyx":1072 |
| * cdef double x |
| * |
| * cBufferedByteStream.read_double(self, &x) # <<<<<<<<<<<<<< |
| * |
| * if float_broken == 1: |
| */ |
| __pyx_t_1 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->read_double(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), (&__pyx_v_x)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":1074 |
| * cBufferedByteStream.read_double(self, &x) |
| * |
| * if float_broken == 1: # <<<<<<<<<<<<<< |
| * if memcmp(&x, &system_nan, 8) == 0: |
| * return pyamf_NaN |
| */ |
| __pyx_t_2 = (__pyx_v_6cpyamf_4util_float_broken == 1); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":1075 |
| * |
| * if float_broken == 1: |
| * if memcmp(&x, &system_nan, 8) == 0: # <<<<<<<<<<<<<< |
| * return pyamf_NaN |
| * elif memcmp(&x, &system_neginf, 8) == 0: |
| */ |
| __pyx_t_2 = (memcmp((&__pyx_v_x), (&__pyx_v_6cpyamf_4util_system_nan), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":1076 |
| * if float_broken == 1: |
| * if memcmp(&x, &system_nan, 8) == 0: |
| * return pyamf_NaN # <<<<<<<<<<<<<< |
| * elif memcmp(&x, &system_neginf, 8) == 0: |
| * return pyamf_NegInf |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(__pyx_v_6cpyamf_4util_pyamf_NaN); |
| __pyx_r = __pyx_v_6cpyamf_4util_pyamf_NaN; |
| goto __pyx_L0; |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":1077 |
| * if memcmp(&x, &system_nan, 8) == 0: |
| * return pyamf_NaN |
| * elif memcmp(&x, &system_neginf, 8) == 0: # <<<<<<<<<<<<<< |
| * return pyamf_NegInf |
| * elif memcmp(&x, &system_posinf, 8) == 0: |
| */ |
| __pyx_t_2 = (memcmp((&__pyx_v_x), (&__pyx_v_6cpyamf_4util_system_neginf), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":1078 |
| * return pyamf_NaN |
| * elif memcmp(&x, &system_neginf, 8) == 0: |
| * return pyamf_NegInf # <<<<<<<<<<<<<< |
| * elif memcmp(&x, &system_posinf, 8) == 0: |
| * return pyamf_PosInf |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(__pyx_v_6cpyamf_4util_pyamf_NegInf); |
| __pyx_r = __pyx_v_6cpyamf_4util_pyamf_NegInf; |
| goto __pyx_L0; |
| goto __pyx_L6; |
| } |
| |
| /* "cpyamf/util.pyx":1079 |
| * elif memcmp(&x, &system_neginf, 8) == 0: |
| * return pyamf_NegInf |
| * elif memcmp(&x, &system_posinf, 8) == 0: # <<<<<<<<<<<<<< |
| * return pyamf_PosInf |
| * |
| */ |
| __pyx_t_2 = (memcmp((&__pyx_v_x), (&__pyx_v_6cpyamf_4util_system_posinf), 8) == 0); |
| if (__pyx_t_2) { |
| |
| /* "cpyamf/util.pyx":1080 |
| * return pyamf_NegInf |
| * elif memcmp(&x, &system_posinf, 8) == 0: |
| * return pyamf_PosInf # <<<<<<<<<<<<<< |
| * |
| * return PyFloat_FromDouble(x) |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(__pyx_v_6cpyamf_4util_pyamf_PosInf); |
| __pyx_r = __pyx_v_6cpyamf_4util_pyamf_PosInf; |
| goto __pyx_L0; |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1082 |
| * return pyamf_PosInf |
| * |
| * return PyFloat_FromDouble(x) # <<<<<<<<<<<<<< |
| * |
| * def write_double(self, val): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_3 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_3); |
| __pyx_r = __pyx_t_3; |
| __pyx_t_3 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_3); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.read_double"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1084 |
| * return PyFloat_FromDouble(x) |
| * |
| * def write_double(self, val): # <<<<<<<<<<<<<< |
| * """ |
| * Writes an 8 byte float to the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_11write_double(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_11write_double[] = "\n Writes an 8 byte float to the stream.\n\n @param val: 8 byte float\n @type val: C{float}\n @raise TypeError: Unexpected type for float C{val}.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_11write_double(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { |
| double __pyx_v_d; |
| long __pyx_v_done; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| double __pyx_t_3; |
| PyObject *__pyx_t_4; |
| int __pyx_t_5; |
| __Pyx_RefNannySetupContext("write_double"); |
| |
| /* "cpyamf/util.pyx":1092 |
| * @raise TypeError: Unexpected type for float C{val}. |
| * """ |
| * if PyFloat_Check(val) == 0: # <<<<<<<<<<<<<< |
| * raise TypeError('Expecting float for val') |
| * |
| */ |
| __pyx_t_1 = (PyFloat_Check(__pyx_v_val) == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1093 |
| * """ |
| * if PyFloat_Check(val) == 0: |
| * raise TypeError('Expecting float for val') # <<<<<<<<<<<<<< |
| * |
| * cdef double d = val |
| */ |
| __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_Raise(__pyx_t_2, 0, 0); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L5; |
| } |
| __pyx_L5:; |
| |
| /* "cpyamf/util.pyx":1095 |
| * raise TypeError('Expecting float for val') |
| * |
| * cdef double d = val # <<<<<<<<<<<<<< |
| * |
| * if float_broken == 1: |
| */ |
| __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_v_d = __pyx_t_3; |
| |
| /* "cpyamf/util.pyx":1097 |
| * cdef double d = val |
| * |
| * if float_broken == 1: # <<<<<<<<<<<<<< |
| * if memcmp(&d, &platform_nan, 8) == 0: |
| * done = 1 |
| */ |
| __pyx_t_1 = (__pyx_v_6cpyamf_4util_float_broken == 1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1098 |
| * |
| * if float_broken == 1: |
| * if memcmp(&d, &platform_nan, 8) == 0: # <<<<<<<<<<<<<< |
| * done = 1 |
| * elif memcmp(&d, &platform_neginf, 8) == 0: |
| */ |
| __pyx_t_1 = (memcmp((&__pyx_v_d), (&__pyx_v_6cpyamf_4util_platform_nan), 8) == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1099 |
| * if float_broken == 1: |
| * if memcmp(&d, &platform_nan, 8) == 0: |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(&d, &platform_neginf, 8) == 0: |
| * done = 1 |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L7; |
| } |
| |
| /* "cpyamf/util.pyx":1100 |
| * if memcmp(&d, &platform_nan, 8) == 0: |
| * done = 1 |
| * elif memcmp(&d, &platform_neginf, 8) == 0: # <<<<<<<<<<<<<< |
| * done = 1 |
| * elif memcmp(&d, &platform_posinf, 8) == 0: |
| */ |
| __pyx_t_1 = (memcmp((&__pyx_v_d), (&__pyx_v_6cpyamf_4util_platform_neginf), 8) == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1101 |
| * done = 1 |
| * elif memcmp(&d, &platform_neginf, 8) == 0: |
| * done = 1 # <<<<<<<<<<<<<< |
| * elif memcmp(&d, &platform_posinf, 8) == 0: |
| * done = 1 |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L7; |
| } |
| |
| /* "cpyamf/util.pyx":1102 |
| * elif memcmp(&d, &platform_neginf, 8) == 0: |
| * done = 1 |
| * elif memcmp(&d, &platform_posinf, 8) == 0: # <<<<<<<<<<<<<< |
| * done = 1 |
| * |
| */ |
| __pyx_t_1 = (memcmp((&__pyx_v_d), (&__pyx_v_6cpyamf_4util_platform_posinf), 8) == 0); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1103 |
| * done = 1 |
| * elif memcmp(&d, &platform_posinf, 8) == 0: |
| * done = 1 # <<<<<<<<<<<<<< |
| * |
| * if done == 1: |
| */ |
| __pyx_v_done = 1; |
| goto __pyx_L7; |
| } |
| __pyx_L7:; |
| |
| /* "cpyamf/util.pyx":1105 |
| * done = 1 |
| * |
| * if done == 1: # <<<<<<<<<<<<<< |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| */ |
| __pyx_t_1 = (__pyx_v_done == 1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1106 |
| * |
| * if done == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): # <<<<<<<<<<<<<< |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: |
| */ |
| __pyx_t_1 = __pyx_f_6cpyamf_4util_is_big_endian(__pyx_v_6cpyamf_4util_SYSTEM_ENDIAN); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1107 |
| * if done == 1: |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_1 = (!__pyx_f_6cpyamf_4util_is_big_endian(((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.endian)); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1108 |
| * if is_big_endian(SYSTEM_ENDIAN): |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * else: |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util_swap_bytes(((unsigned char *)(&__pyx_v_d)), 8) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1109 |
| * if not is_big_endian(self.endian): |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * else: |
| * if is_big_endian(self.endian): |
| */ |
| __pyx_t_4 = PyErr_NoMemory(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L11; |
| } |
| __pyx_L11:; |
| goto __pyx_L10; |
| } |
| __pyx_L10:; |
| goto __pyx_L9; |
| } |
| /*else*/ { |
| |
| /* "cpyamf/util.pyx":1111 |
| * PyErr_NoMemory() |
| * else: |
| * if is_big_endian(self.endian): # <<<<<<<<<<<<<< |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: |
| * PyErr_NoMemory() |
| */ |
| __pyx_t_1 = __pyx_f_6cpyamf_4util_is_big_endian(((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.endian); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1112 |
| * else: |
| * if is_big_endian(self.endian): |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: # <<<<<<<<<<<<<< |
| * PyErr_NoMemory() |
| * |
| */ |
| __pyx_t_1 = (__pyx_f_6cpyamf_4util_swap_bytes(((unsigned char *)(&__pyx_v_d)), 8) == -1); |
| if (__pyx_t_1) { |
| |
| /* "cpyamf/util.pyx":1113 |
| * if is_big_endian(self.endian): |
| * if swap_bytes(<unsigned char *>&d, 8) == -1: |
| * PyErr_NoMemory() # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write(self, <char *>&d, 8) |
| */ |
| __pyx_t_4 = PyErr_NoMemory(); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L13; |
| } |
| __pyx_L13:; |
| goto __pyx_L12; |
| } |
| __pyx_L12:; |
| } |
| __pyx_L9:; |
| |
| /* "cpyamf/util.pyx":1115 |
| * PyErr_NoMemory() |
| * |
| * cBufferedByteStream.write(self, <char *>&d, 8) # <<<<<<<<<<<<<< |
| * |
| * return |
| */ |
| __pyx_t_5 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), ((char *)(&__pyx_v_d)), 8); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":1117 |
| * cBufferedByteStream.write(self, <char *>&d, 8) |
| * |
| * return # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_double(self, d) |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| goto __pyx_L8; |
| } |
| __pyx_L8:; |
| goto __pyx_L6; |
| } |
| __pyx_L6:; |
| |
| /* "cpyamf/util.pyx":1119 |
| * return |
| * |
| * cBufferedByteStream.write_double(self, d) # <<<<<<<<<<<<<< |
| * |
| * def read_float(self): |
| */ |
| __pyx_t_5 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->write_double(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), __pyx_v_d, 1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.write_double"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1121 |
| * cBufferedByteStream.write_double(self, d) |
| * |
| * def read_float(self): # <<<<<<<<<<<<<< |
| * """ |
| * Reads a 4 byte float from the stream. |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_12read_float(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| static char __pyx_doc_6cpyamf_4util_18BufferedByteStream_12read_float[] = "\n Reads a 4 byte float from the stream.\n "; |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_12read_float(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| float __pyx_v_x; |
| PyObject *__pyx_r = NULL; |
| int __pyx_t_1; |
| PyObject *__pyx_t_2 = NULL; |
| __Pyx_RefNannySetupContext("read_float"); |
| |
| /* "cpyamf/util.pyx":1127 |
| * cdef float x |
| * |
| * cBufferedByteStream.read_float(self, &x) # <<<<<<<<<<<<<< |
| * |
| * return PyFloat_FromDouble(x) |
| */ |
| __pyx_t_1 = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream->read_float(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), (&__pyx_v_x)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":1129 |
| * cBufferedByteStream.read_float(self, &x) |
| * |
| * return PyFloat_FromDouble(x) # <<<<<<<<<<<<<< |
| * |
| * def __add__(self, other): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_2 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_r = __pyx_t_2; |
| __pyx_t_2 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.read_float"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1131 |
| * return PyFloat_FromDouble(x) |
| * |
| * def __add__(self, other): # <<<<<<<<<<<<<< |
| * cdef Py_ssize_t old_pos = self.tell() |
| * cdef Py_ssize_t old_other_pos = other.tell() |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_13__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_13__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { |
| Py_ssize_t __pyx_v_old_pos; |
| Py_ssize_t __pyx_v_old_other_pos; |
| struct __pyx_obj_6cpyamf_4util_BufferedByteStream *__pyx_v_new; |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| Py_ssize_t __pyx_t_3; |
| int __pyx_t_4; |
| struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek __pyx_t_5; |
| PyObject *__pyx_t_6 = NULL; |
| __Pyx_RefNannySetupContext("__add__"); |
| __pyx_v_new = ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)Py_None); __Pyx_INCREF(Py_None); |
| |
| /* "cpyamf/util.pyx":1132 |
| * |
| * def __add__(self, other): |
| * cdef Py_ssize_t old_pos = self.tell() # <<<<<<<<<<<<<< |
| * cdef Py_ssize_t old_other_pos = other.tell() |
| * |
| */ |
| __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_v_old_pos = __pyx_t_3; |
| |
| /* "cpyamf/util.pyx":1133 |
| * def __add__(self, other): |
| * cdef Py_ssize_t old_pos = self.tell() |
| * cdef Py_ssize_t old_other_pos = other.tell() # <<<<<<<<<<<<<< |
| * |
| * new = BufferedByteStream(self) |
| */ |
| __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __pyx_v_old_other_pos = __pyx_t_3; |
| |
| /* "cpyamf/util.pyx":1135 |
| * cdef Py_ssize_t old_other_pos = other.tell() |
| * |
| * new = BufferedByteStream(self) # <<<<<<<<<<<<<< |
| * |
| * other.seek(0) |
| */ |
| __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| __Pyx_INCREF(__pyx_v_self); |
| PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); |
| __Pyx_GIVEREF(__pyx_v_self); |
| __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6cpyamf_4util_BufferedByteStream)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_v_new)); |
| __pyx_v_new = ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_t_2); |
| __pyx_t_2 = 0; |
| |
| /* "cpyamf/util.pyx":1137 |
| * new = BufferedByteStream(self) |
| * |
| * other.seek(0) # <<<<<<<<<<<<<< |
| * new.seek(0, 2) |
| * new.write(other.read()) |
| */ |
| __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":1138 |
| * |
| * other.seek(0) |
| * new.seek(0, 2) # <<<<<<<<<<<<<< |
| * new.write(other.read()) |
| * |
| */ |
| __pyx_t_5.__pyx_n = 1; |
| __pyx_t_5.mode = 2; |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *)__pyx_v_new->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_new), 0, 0, &__pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":1139 |
| * other.seek(0) |
| * new.seek(0, 2) |
| * new.write(other.read()) # <<<<<<<<<<<<<< |
| * |
| * self.seek(old_pos) |
| */ |
| __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_new), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_6); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); |
| __Pyx_GIVEREF(__pyx_t_6); |
| __pyx_t_6 = 0; |
| __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_6); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| |
| /* "cpyamf/util.pyx":1141 |
| * new.write(other.read()) |
| * |
| * self.seek(old_pos) # <<<<<<<<<<<<<< |
| * other.seek(old_other_pos) |
| * new.seek(0) |
| */ |
| __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seek); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_6); |
| __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_old_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_t_2 = 0; |
| __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| |
| /* "cpyamf/util.pyx":1142 |
| * |
| * self.seek(old_pos) |
| * other.seek(old_other_pos) # <<<<<<<<<<<<<< |
| * new.seek(0) |
| * |
| */ |
| __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_old_other_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_6)); |
| PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); |
| __Pyx_GIVEREF(__pyx_t_1); |
| __pyx_t_1 = 0; |
| __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":1143 |
| * self.seek(old_pos) |
| * other.seek(old_other_pos) |
| * new.seek(0) # <<<<<<<<<<<<<< |
| * |
| * return new |
| */ |
| __pyx_t_4 = ((struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *)__pyx_v_new->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_new), 0, 0, NULL); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| |
| /* "cpyamf/util.pyx":1145 |
| * new.seek(0) |
| * |
| * return new # <<<<<<<<<<<<<< |
| * |
| * def __str__(self): |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __Pyx_INCREF(((PyObject *)__pyx_v_new)); |
| __pyx_r = ((PyObject *)__pyx_v_new); |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| __Pyx_XDECREF(__pyx_t_6); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.__add__"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_DECREF((PyObject *)__pyx_v_new); |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| |
| /* "cpyamf/util.pyx":1147 |
| * return new |
| * |
| * def __str__(self): # <<<<<<<<<<<<<< |
| * return self.getvalue() |
| * |
| */ |
| |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_14__str__(PyObject *__pyx_v_self); /*proto*/ |
| static PyObject *__pyx_pf_6cpyamf_4util_18BufferedByteStream_14__str__(PyObject *__pyx_v_self) { |
| PyObject *__pyx_r = NULL; |
| PyObject *__pyx_t_1 = NULL; |
| __Pyx_RefNannySetupContext("__str__"); |
| |
| /* "cpyamf/util.pyx":1148 |
| * |
| * def __str__(self): |
| * return self.getvalue() # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __Pyx_XDECREF(__pyx_r); |
| __pyx_t_1 = ((struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream *)((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.getvalue(((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_r = __pyx_t_1; |
| __pyx_t_1 = 0; |
| goto __pyx_L0; |
| |
| __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_AddTraceback("cpyamf.util.BufferedByteStream.__str__"); |
| __pyx_r = NULL; |
| __pyx_L0:; |
| __Pyx_XGIVEREF(__pyx_r); |
| __Pyx_RefNannyFinishContext(); |
| return __pyx_r; |
| } |
| static struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream __pyx_vtable_6cpyamf_4util_cBufferedByteStream; |
| |
| static PyObject *__pyx_tp_new_6cpyamf_4util_cBufferedByteStream(PyTypeObject *t, PyObject *a, PyObject *k) { |
| struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *p; |
| PyObject *o = (*t->tp_alloc)(t, 0); |
| if (!o) return 0; |
| p = ((struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *)o); |
| p->__pyx_vtab = __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream; |
| if (__pyx_pf_6cpyamf_4util_19cBufferedByteStream___cinit__(o, __pyx_empty_tuple, NULL) < 0) { |
| Py_DECREF(o); o = 0; |
| } |
| return o; |
| } |
| |
| static void __pyx_tp_dealloc_6cpyamf_4util_cBufferedByteStream(PyObject *o) { |
| { |
| PyObject *etype, *eval, *etb; |
| PyErr_Fetch(&etype, &eval, &etb); |
| ++Py_REFCNT(o); |
| __pyx_pf_6cpyamf_4util_19cBufferedByteStream_1__dealloc__(o); |
| if (PyErr_Occurred()) PyErr_WriteUnraisable(o); |
| --Py_REFCNT(o); |
| PyErr_Restore(etype, eval, etb); |
| } |
| (*Py_TYPE(o)->tp_free)(o); |
| } |
| |
| static PyMethodDef __pyx_methods_6cpyamf_4util_cBufferedByteStream[] = { |
| {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_2tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_2tell)}, |
| {__Pyx_NAMESTR("at_eof"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_3at_eof, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_3at_eof)}, |
| {__Pyx_NAMESTR("remaining"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_4remaining, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_4remaining)}, |
| {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_5seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_5seek)}, |
| {__Pyx_NAMESTR("getvalue"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_6getvalue, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_6getvalue)}, |
| {__Pyx_NAMESTR("truncate"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_7truncate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_7truncate)}, |
| {__Pyx_NAMESTR("consume"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_8consume, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_8consume)}, |
| {__Pyx_NAMESTR("read_uchar"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_9read_uchar, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_9read_uchar)}, |
| {__Pyx_NAMESTR("read_char"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_10read_char, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_10read_char)}, |
| {__Pyx_NAMESTR("read_ushort"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_11read_ushort, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_11read_ushort)}, |
| {__Pyx_NAMESTR("read_short"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_12read_short, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_12read_short)}, |
| {__Pyx_NAMESTR("read_24bit_uint"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_13read_24bit_uint)}, |
| {__Pyx_NAMESTR("read_24bit_int"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_14read_24bit_int)}, |
| {__Pyx_NAMESTR("read_ulong"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_15read_ulong, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_15read_ulong)}, |
| {__Pyx_NAMESTR("read_long"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_16read_long, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_16read_long)}, |
| {__Pyx_NAMESTR("write_uchar"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_17write_uchar, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_17write_uchar)}, |
| {__Pyx_NAMESTR("write_char"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_18write_char, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_18write_char)}, |
| {__Pyx_NAMESTR("write_ushort"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_19write_ushort, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_19write_ushort)}, |
| {__Pyx_NAMESTR("write_short"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_20write_short, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_20write_short)}, |
| {__Pyx_NAMESTR("write_ulong"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_21write_ulong, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_21write_ulong)}, |
| {__Pyx_NAMESTR("write_long"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_22write_long, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_22write_long)}, |
| {__Pyx_NAMESTR("write_24bit_uint"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_23write_24bit_uint)}, |
| {__Pyx_NAMESTR("write_24bit_int"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_24write_24bit_int)}, |
| {__Pyx_NAMESTR("read_utf8_string"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_25read_utf8_string)}, |
| {__Pyx_NAMESTR("write_utf8_string"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_26write_utf8_string)}, |
| {__Pyx_NAMESTR("write_double"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_27write_double, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_27write_double)}, |
| {__Pyx_NAMESTR("write_float"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_28write_float, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_19cBufferedByteStream_28write_float)}, |
| {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_6cpyamf_4util_19cBufferedByteStream_29append, METH_O, __Pyx_DOCSTR(0)}, |
| {0, 0, 0, 0} |
| }; |
| |
| static PyNumberMethods __pyx_tp_as_number_cBufferedByteStream = { |
| 0, /*nb_add*/ |
| 0, /*nb_subtract*/ |
| 0, /*nb_multiply*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_divide*/ |
| #endif |
| 0, /*nb_remainder*/ |
| 0, /*nb_divmod*/ |
| 0, /*nb_power*/ |
| 0, /*nb_negative*/ |
| 0, /*nb_positive*/ |
| 0, /*nb_absolute*/ |
| __pyx_pf_6cpyamf_4util_19cBufferedByteStream_30__nonzero__, /*nb_nonzero*/ |
| 0, /*nb_invert*/ |
| 0, /*nb_lshift*/ |
| 0, /*nb_rshift*/ |
| 0, /*nb_and*/ |
| 0, /*nb_xor*/ |
| 0, /*nb_or*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_coerce*/ |
| #endif |
| 0, /*nb_int*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_long*/ |
| #else |
| 0, /*reserved*/ |
| #endif |
| 0, /*nb_float*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_oct*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_hex*/ |
| #endif |
| 0, /*nb_inplace_add*/ |
| 0, /*nb_inplace_subtract*/ |
| 0, /*nb_inplace_multiply*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_inplace_divide*/ |
| #endif |
| 0, /*nb_inplace_remainder*/ |
| 0, /*nb_inplace_power*/ |
| 0, /*nb_inplace_lshift*/ |
| 0, /*nb_inplace_rshift*/ |
| 0, /*nb_inplace_and*/ |
| 0, /*nb_inplace_xor*/ |
| 0, /*nb_inplace_or*/ |
| 0, /*nb_floor_divide*/ |
| 0, /*nb_true_divide*/ |
| 0, /*nb_inplace_floor_divide*/ |
| 0, /*nb_inplace_true_divide*/ |
| #if PY_VERSION_HEX >= 0x02050000 |
| 0, /*nb_index*/ |
| #endif |
| }; |
| |
| static PySequenceMethods __pyx_tp_as_sequence_cBufferedByteStream = { |
| 0, /*sq_length*/ |
| 0, /*sq_concat*/ |
| 0, /*sq_repeat*/ |
| 0, /*sq_item*/ |
| 0, /*sq_slice*/ |
| 0, /*sq_ass_item*/ |
| 0, /*sq_ass_slice*/ |
| 0, /*sq_contains*/ |
| 0, /*sq_inplace_concat*/ |
| 0, /*sq_inplace_repeat*/ |
| }; |
| |
| static PyMappingMethods __pyx_tp_as_mapping_cBufferedByteStream = { |
| 0, /*mp_length*/ |
| 0, /*mp_subscript*/ |
| 0, /*mp_ass_subscript*/ |
| }; |
| |
| static PyBufferProcs __pyx_tp_as_buffer_cBufferedByteStream = { |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getreadbuffer*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getwritebuffer*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getsegcount*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getcharbuffer*/ |
| #endif |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*bf_getbuffer*/ |
| #endif |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*bf_releasebuffer*/ |
| #endif |
| }; |
| |
| static PyTypeObject __pyx_type_6cpyamf_4util_cBufferedByteStream = { |
| PyVarObject_HEAD_INIT(0, 0) |
| __Pyx_NAMESTR("cpyamf.util.cBufferedByteStream"), /*tp_name*/ |
| sizeof(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream), /*tp_basicsize*/ |
| 0, /*tp_itemsize*/ |
| __pyx_tp_dealloc_6cpyamf_4util_cBufferedByteStream, /*tp_dealloc*/ |
| 0, /*tp_print*/ |
| 0, /*tp_getattr*/ |
| 0, /*tp_setattr*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*tp_compare*/ |
| #else |
| 0, /*reserved*/ |
| #endif |
| 0, /*tp_repr*/ |
| &__pyx_tp_as_number_cBufferedByteStream, /*tp_as_number*/ |
| &__pyx_tp_as_sequence_cBufferedByteStream, /*tp_as_sequence*/ |
| &__pyx_tp_as_mapping_cBufferedByteStream, /*tp_as_mapping*/ |
| 0, /*tp_hash*/ |
| 0, /*tp_call*/ |
| 0, /*tp_str*/ |
| 0, /*tp_getattro*/ |
| 0, /*tp_setattro*/ |
| &__pyx_tp_as_buffer_cBufferedByteStream, /*tp_as_buffer*/ |
| Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ |
| __Pyx_DOCSTR("\n A file like object that can be read/written to. Supports data type\n specific reads/writes (e.g. ints, longs, floats etc.)\n\n Endian aware.\n "), /*tp_doc*/ |
| 0, /*tp_traverse*/ |
| 0, /*tp_clear*/ |
| 0, /*tp_richcompare*/ |
| 0, /*tp_weaklistoffset*/ |
| 0, /*tp_iter*/ |
| 0, /*tp_iternext*/ |
| __pyx_methods_6cpyamf_4util_cBufferedByteStream, /*tp_methods*/ |
| 0, /*tp_members*/ |
| 0, /*tp_getset*/ |
| 0, /*tp_base*/ |
| 0, /*tp_dict*/ |
| 0, /*tp_descr_get*/ |
| 0, /*tp_descr_set*/ |
| 0, /*tp_dictoffset*/ |
| 0, /*tp_init*/ |
| 0, /*tp_alloc*/ |
| __pyx_tp_new_6cpyamf_4util_cBufferedByteStream, /*tp_new*/ |
| 0, /*tp_free*/ |
| 0, /*tp_is_gc*/ |
| 0, /*tp_bases*/ |
| 0, /*tp_mro*/ |
| 0, /*tp_cache*/ |
| 0, /*tp_subclasses*/ |
| 0, /*tp_weaklist*/ |
| 0, /*tp_del*/ |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*tp_version_tag*/ |
| #endif |
| }; |
| static struct __pyx_vtabstruct_6cpyamf_4util_BufferedByteStream __pyx_vtable_6cpyamf_4util_BufferedByteStream; |
| |
| static PyObject *__pyx_tp_new_6cpyamf_4util_BufferedByteStream(PyTypeObject *t, PyObject *a, PyObject *k) { |
| struct __pyx_obj_6cpyamf_4util_BufferedByteStream *p; |
| PyObject *o = __pyx_tp_new_6cpyamf_4util_cBufferedByteStream(t, a, k); |
| if (!o) return 0; |
| p = ((struct __pyx_obj_6cpyamf_4util_BufferedByteStream *)o); |
| p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6cpyamf_4util_cBufferedByteStream*)__pyx_vtabptr_6cpyamf_4util_BufferedByteStream; |
| return o; |
| } |
| |
| static PyObject *__pyx_getprop_6cpyamf_4util_18BufferedByteStream_endian(PyObject *o, void *x) { |
| return __pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian_1__get__(o); |
| } |
| |
| static int __pyx_setprop_6cpyamf_4util_18BufferedByteStream_endian(PyObject *o, PyObject *v, void *x) { |
| if (v) { |
| return __pyx_pf_6cpyamf_4util_18BufferedByteStream_6endian___set__(o, v); |
| } |
| else { |
| PyErr_SetString(PyExc_NotImplementedError, "__del__"); |
| return -1; |
| } |
| } |
| |
| static PyMethodDef __pyx_methods_6cpyamf_4util_BufferedByteStream[] = { |
| {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_1read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_1read)}, |
| {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_2write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_2write)}, |
| {__Pyx_NAMESTR("flush"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_3flush, METH_NOARGS, __Pyx_DOCSTR(0)}, |
| {__Pyx_NAMESTR("peek"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_5peek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_5peek)}, |
| {__Pyx_NAMESTR("write_char"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_6write_char, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_6write_char)}, |
| {__Pyx_NAMESTR("write_ushort"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_7write_ushort, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_7write_ushort)}, |
| {__Pyx_NAMESTR("write_short"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_8write_short, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_8write_short)}, |
| {__Pyx_NAMESTR("write_ulong"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_9write_ulong, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_9write_ulong)}, |
| {__Pyx_NAMESTR("read_double"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_10read_double, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_10read_double)}, |
| {__Pyx_NAMESTR("write_double"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_11write_double, METH_O, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_11write_double)}, |
| {__Pyx_NAMESTR("read_float"), (PyCFunction)__pyx_pf_6cpyamf_4util_18BufferedByteStream_12read_float, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6cpyamf_4util_18BufferedByteStream_12read_float)}, |
| {0, 0, 0, 0} |
| }; |
| |
| static struct PyGetSetDef __pyx_getsets_6cpyamf_4util_BufferedByteStream[] = { |
| {(char *)"endian", __pyx_getprop_6cpyamf_4util_18BufferedByteStream_endian, __pyx_setprop_6cpyamf_4util_18BufferedByteStream_endian, 0, 0}, |
| {0, 0, 0, 0, 0} |
| }; |
| |
| static PyNumberMethods __pyx_tp_as_number_BufferedByteStream = { |
| __pyx_pf_6cpyamf_4util_18BufferedByteStream_13__add__, /*nb_add*/ |
| 0, /*nb_subtract*/ |
| 0, /*nb_multiply*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_divide*/ |
| #endif |
| 0, /*nb_remainder*/ |
| 0, /*nb_divmod*/ |
| 0, /*nb_power*/ |
| 0, /*nb_negative*/ |
| 0, /*nb_positive*/ |
| 0, /*nb_absolute*/ |
| 0, /*nb_nonzero*/ |
| 0, /*nb_invert*/ |
| 0, /*nb_lshift*/ |
| 0, /*nb_rshift*/ |
| 0, /*nb_and*/ |
| 0, /*nb_xor*/ |
| 0, /*nb_or*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_coerce*/ |
| #endif |
| 0, /*nb_int*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_long*/ |
| #else |
| 0, /*reserved*/ |
| #endif |
| 0, /*nb_float*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_oct*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_hex*/ |
| #endif |
| 0, /*nb_inplace_add*/ |
| 0, /*nb_inplace_subtract*/ |
| 0, /*nb_inplace_multiply*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*nb_inplace_divide*/ |
| #endif |
| 0, /*nb_inplace_remainder*/ |
| 0, /*nb_inplace_power*/ |
| 0, /*nb_inplace_lshift*/ |
| 0, /*nb_inplace_rshift*/ |
| 0, /*nb_inplace_and*/ |
| 0, /*nb_inplace_xor*/ |
| 0, /*nb_inplace_or*/ |
| 0, /*nb_floor_divide*/ |
| 0, /*nb_true_divide*/ |
| 0, /*nb_inplace_floor_divide*/ |
| 0, /*nb_inplace_true_divide*/ |
| #if PY_VERSION_HEX >= 0x02050000 |
| 0, /*nb_index*/ |
| #endif |
| }; |
| |
| static PySequenceMethods __pyx_tp_as_sequence_BufferedByteStream = { |
| __pyx_pf_6cpyamf_4util_18BufferedByteStream_4__len__, /*sq_length*/ |
| 0, /*sq_concat*/ |
| 0, /*sq_repeat*/ |
| 0, /*sq_item*/ |
| 0, /*sq_slice*/ |
| 0, /*sq_ass_item*/ |
| 0, /*sq_ass_slice*/ |
| 0, /*sq_contains*/ |
| 0, /*sq_inplace_concat*/ |
| 0, /*sq_inplace_repeat*/ |
| }; |
| |
| static PyMappingMethods __pyx_tp_as_mapping_BufferedByteStream = { |
| __pyx_pf_6cpyamf_4util_18BufferedByteStream_4__len__, /*mp_length*/ |
| 0, /*mp_subscript*/ |
| 0, /*mp_ass_subscript*/ |
| }; |
| |
| static PyBufferProcs __pyx_tp_as_buffer_BufferedByteStream = { |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getreadbuffer*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getwritebuffer*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getsegcount*/ |
| #endif |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*bf_getcharbuffer*/ |
| #endif |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*bf_getbuffer*/ |
| #endif |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*bf_releasebuffer*/ |
| #endif |
| }; |
| |
| static PyTypeObject __pyx_type_6cpyamf_4util_BufferedByteStream = { |
| PyVarObject_HEAD_INIT(0, 0) |
| __Pyx_NAMESTR("cpyamf.util.BufferedByteStream"), /*tp_name*/ |
| sizeof(struct __pyx_obj_6cpyamf_4util_BufferedByteStream), /*tp_basicsize*/ |
| 0, /*tp_itemsize*/ |
| __pyx_tp_dealloc_6cpyamf_4util_cBufferedByteStream, /*tp_dealloc*/ |
| 0, /*tp_print*/ |
| 0, /*tp_getattr*/ |
| 0, /*tp_setattr*/ |
| #if PY_MAJOR_VERSION < 3 |
| 0, /*tp_compare*/ |
| #else |
| 0, /*reserved*/ |
| #endif |
| 0, /*tp_repr*/ |
| &__pyx_tp_as_number_BufferedByteStream, /*tp_as_number*/ |
| &__pyx_tp_as_sequence_BufferedByteStream, /*tp_as_sequence*/ |
| &__pyx_tp_as_mapping_BufferedByteStream, /*tp_as_mapping*/ |
| 0, /*tp_hash*/ |
| 0, /*tp_call*/ |
| __pyx_pf_6cpyamf_4util_18BufferedByteStream_14__str__, /*tp_str*/ |
| 0, /*tp_getattro*/ |
| 0, /*tp_setattro*/ |
| &__pyx_tp_as_buffer_BufferedByteStream, /*tp_as_buffer*/ |
| Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ |
| __Pyx_DOCSTR("\n A Python exposed version of cBufferedByteStream. This exists because of\n various intricacies of Cythons cpdef (probably just user stupidity tho)\n "), /*tp_doc*/ |
| 0, /*tp_traverse*/ |
| 0, /*tp_clear*/ |
| 0, /*tp_richcompare*/ |
| 0, /*tp_weaklistoffset*/ |
| 0, /*tp_iter*/ |
| 0, /*tp_iternext*/ |
| __pyx_methods_6cpyamf_4util_BufferedByteStream, /*tp_methods*/ |
| 0, /*tp_members*/ |
| __pyx_getsets_6cpyamf_4util_BufferedByteStream, /*tp_getset*/ |
| 0, /*tp_base*/ |
| 0, /*tp_dict*/ |
| 0, /*tp_descr_get*/ |
| 0, /*tp_descr_set*/ |
| 0, /*tp_dictoffset*/ |
| __pyx_pf_6cpyamf_4util_18BufferedByteStream___init__, /*tp_init*/ |
| 0, /*tp_alloc*/ |
| __pyx_tp_new_6cpyamf_4util_BufferedByteStream, /*tp_new*/ |
| 0, /*tp_free*/ |
| 0, /*tp_is_gc*/ |
| 0, /*tp_bases*/ |
| 0, /*tp_mro*/ |
| 0, /*tp_cache*/ |
| 0, /*tp_subclasses*/ |
| 0, /*tp_weaklist*/ |
| 0, /*tp_del*/ |
| #if PY_VERSION_HEX >= 0x02060000 |
| 0, /*tp_version_tag*/ |
| #endif |
| }; |
| |
| static PyMethodDef __pyx_methods[] = { |
| {0, 0, 0, 0} |
| }; |
| |
| #if PY_MAJOR_VERSION >= 3 |
| static struct PyModuleDef __pyx_moduledef = { |
| PyModuleDef_HEAD_INIT, |
| __Pyx_NAMESTR("util"), |
| __Pyx_DOCSTR(__pyx_k_31), /* m_doc */ |
| -1, /* m_size */ |
| __pyx_methods /* m_methods */, |
| NULL, /* m_reload */ |
| NULL, /* m_traverse */ |
| NULL, /* m_clear */ |
| NULL /* m_free */ |
| }; |
| #endif |
| |
| static __Pyx_StringTabEntry __pyx_string_tab[] = { |
| {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, |
| {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, |
| {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, |
| {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, |
| {&__pyx_kp_b_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 0, 0}, |
| {&__pyx_kp_b_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 0, 0}, |
| {&__pyx_kp_b_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 0, 0}, |
| {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, |
| {&__pyx_kp_b_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0, 0}, |
| {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, |
| {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, |
| {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, |
| {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, |
| {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, |
| {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, |
| {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, |
| {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, |
| {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, |
| {&__pyx_n_s__NaN, __pyx_k__NaN, sizeof(__pyx_k__NaN), 0, 0, 1, 1}, |
| {&__pyx_n_s__NegInf, __pyx_k__NegInf, sizeof(__pyx_k__NegInf), 0, 0, 1, 1}, |
| {&__pyx_n_s__OverflowError, __pyx_k__OverflowError, sizeof(__pyx_k__OverflowError), 0, 0, 1, 1}, |
| {&__pyx_n_s__PosInf, __pyx_k__PosInf, sizeof(__pyx_k__PosInf), 0, 0, 1, 1}, |
| {&__pyx_n_s__SystemError, __pyx_k__SystemError, sizeof(__pyx_k__SystemError), 0, 0, 1, 1}, |
| {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, |
| {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, |
| {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, |
| {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, |
| {&__pyx_n_s___increase_buffer, __pyx_k___increase_buffer, sizeof(__pyx_k___increase_buffer), 0, 0, 1, 1}, |
| {&__pyx_n_s___init_buffer, __pyx_k___init_buffer, sizeof(__pyx_k___init_buffer), 0, 0, 1, 1}, |
| {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, |
| {&__pyx_n_s__at_eof, __pyx_k__at_eof, sizeof(__pyx_k__at_eof), 0, 0, 1, 1}, |
| {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, |
| {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, |
| {&__pyx_n_s__consume, __pyx_k__consume, sizeof(__pyx_k__consume), 0, 0, 1, 1}, |
| {&__pyx_n_s__endian, __pyx_k__endian, sizeof(__pyx_k__endian), 0, 0, 1, 1}, |
| {&__pyx_n_s__getvalue, __pyx_k__getvalue, sizeof(__pyx_k__getvalue), 0, 0, 1, 1}, |
| {&__pyx_n_s__has_available, __pyx_k__has_available, sizeof(__pyx_k__has_available), 0, 0, 1, 1}, |
| {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1}, |
| {&__pyx_n_s__min_buf_size, __pyx_k__min_buf_size, sizeof(__pyx_k__min_buf_size), 0, 0, 1, 1}, |
| {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, |
| {&__pyx_n_s__pack_int, __pyx_k__pack_int, sizeof(__pyx_k__pack_int), 0, 0, 1, 1}, |
| {&__pyx_n_s__pack_uint, __pyx_k__pack_uint, sizeof(__pyx_k__pack_uint), 0, 0, 1, 1}, |
| {&__pyx_n_s__peek, __pyx_k__peek, sizeof(__pyx_k__peek), 0, 0, 1, 1}, |
| {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, |
| {&__pyx_n_s__pyamf, __pyx_k__pyamf, sizeof(__pyx_k__pyamf), 0, 0, 1, 1}, |
| {&__pyx_n_s__python, __pyx_k__python, sizeof(__pyx_k__python), 0, 0, 1, 1}, |
| {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_24bit_int, __pyx_k__read_24bit_int, sizeof(__pyx_k__read_24bit_int), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_24bit_uint, __pyx_k__read_24bit_uint, sizeof(__pyx_k__read_24bit_uint), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_char, __pyx_k__read_char, sizeof(__pyx_k__read_char), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_long, __pyx_k__read_long, sizeof(__pyx_k__read_long), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_short, __pyx_k__read_short, sizeof(__pyx_k__read_short), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_uchar, __pyx_k__read_uchar, sizeof(__pyx_k__read_uchar), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_ulong, __pyx_k__read_ulong, sizeof(__pyx_k__read_ulong), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_ushort, __pyx_k__read_ushort, sizeof(__pyx_k__read_ushort), 0, 0, 1, 1}, |
| {&__pyx_n_s__read_utf8_string, __pyx_k__read_utf8_string, sizeof(__pyx_k__read_utf8_string), 0, 0, 1, 1}, |
| {&__pyx_n_s__remaining, __pyx_k__remaining, sizeof(__pyx_k__remaining), 0, 0, 1, 1}, |
| {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, |
| {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, |
| {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, |
| {&__pyx_n_s__truncate, __pyx_k__truncate, sizeof(__pyx_k__truncate), 0, 0, 1, 1}, |
| {&__pyx_n_s__unpack_int, __pyx_k__unpack_int, sizeof(__pyx_k__unpack_int), 0, 0, 1, 1}, |
| {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_24bit_int, __pyx_k__write_24bit_int, sizeof(__pyx_k__write_24bit_int), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_24bit_uint, __pyx_k__write_24bit_uint, sizeof(__pyx_k__write_24bit_uint), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_char, __pyx_k__write_char, sizeof(__pyx_k__write_char), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_double, __pyx_k__write_double, sizeof(__pyx_k__write_double), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_float, __pyx_k__write_float, sizeof(__pyx_k__write_float), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_long, __pyx_k__write_long, sizeof(__pyx_k__write_long), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_short, __pyx_k__write_short, sizeof(__pyx_k__write_short), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_uchar, __pyx_k__write_uchar, sizeof(__pyx_k__write_uchar), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_ulong, __pyx_k__write_ulong, sizeof(__pyx_k__write_ulong), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_ushort, __pyx_k__write_ushort, sizeof(__pyx_k__write_ushort), 0, 0, 1, 1}, |
| {&__pyx_n_s__write_utf8_string, __pyx_k__write_utf8_string, sizeof(__pyx_k__write_utf8_string), 0, 0, 1, 1}, |
| {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, |
| {0, 0, 0, 0, 0, 0, 0} |
| }; |
| static int __Pyx_InitCachedBuiltins(void) { |
| __pyx_builtin_SystemError = __Pyx_GetName(__pyx_b, __pyx_n_s__SystemError); if (!__pyx_builtin_SystemError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| return 0; |
| __pyx_L1_error:; |
| return -1; |
| } |
| |
| static int __Pyx_InitCachedConstants(void) { |
| __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); |
| |
| /* "cpyamf/util.pyx":360 |
| * self.pos = self.length + pos |
| * else: |
| * raise ValueError('Bad value for mode') # <<<<<<<<<<<<<< |
| * |
| * return 0 |
| */ |
| __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); |
| |
| /* "cpyamf/util.pyx":456 |
| * |
| * if num_bytes > 4: |
| * raise ValueError('Max 4 bytes to unpack') # <<<<<<<<<<<<<< |
| * |
| * if not self.has_available(num_bytes): |
| */ |
| __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); |
| |
| /* "cpyamf/util.pyx":490 |
| * |
| * if x > maxint or x < minint: |
| * raise OverflowError('integer out of range') # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) |
| */ |
| __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); |
| |
| /* "cpyamf/util.pyx":529 |
| * |
| * if x >= maxint: |
| * raise OverflowError('integer out of range') # <<<<<<<<<<<<<< |
| * |
| * cdef char *buf = <char *>malloc(num_bytes) |
| */ |
| __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_7)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); |
| |
| /* "cpyamf/util.pyx":747 |
| * encoded_string = obj |
| * else: |
| * raise TypeError('value must be Unicode or str') # <<<<<<<<<<<<<< |
| * |
| * PyString_AsStringAndSize(encoded_string, &buf, &l) |
| */ |
| __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_10)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); |
| |
| /* "cpyamf/util.pyx":930 |
| * elif hasattr(buf, 'read') and hasattr(buf, 'seek') and hasattr(buf, 'tell'): |
| * old_pos = buf.tell() |
| * buf.seek(0) # <<<<<<<<<<<<<< |
| * self.write(buf.read()) |
| * buf.seek(old_pos) |
| */ |
| __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); |
| __Pyx_INCREF(__pyx_int_0); |
| PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_int_0); |
| __Pyx_GIVEREF(__pyx_int_0); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); |
| |
| /* "cpyamf/util.pyx":934 |
| * buf.seek(old_pos) |
| * else: |
| * raise TypeError("Unable to coerce buf->StringIO") # <<<<<<<<<<<<<< |
| * |
| * self.seek(0) |
| */ |
| __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); |
| |
| /* "cpyamf/util.pyx":941 |
| * def __set__(self, value): |
| * if PyString_Check(value) == 0: |
| * raise TypeError('String value expected') # <<<<<<<<<<<<<< |
| * |
| * if value not in [ENDIAN_NETWORK, ENDIAN_NATIVE, ENDIAN_LITTLE, ENDIAN_BIG]: |
| */ |
| __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_15)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); |
| |
| /* "cpyamf/util.pyx":944 |
| * |
| * if value not in [ENDIAN_NETWORK, ENDIAN_NATIVE, ENDIAN_LITTLE, ENDIAN_BIG]: |
| * raise ValueError('Not a valid endian type') # <<<<<<<<<<<<<< |
| * |
| * self.endian = PyString_AsString(value)[0] |
| */ |
| __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_21)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); |
| |
| /* "cpyamf/util.pyx":1020 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_char(self, <char>x) |
| */ |
| __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); |
| |
| /* "cpyamf/util.pyx":1033 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_ushort(self, <unsigned short>x) |
| */ |
| __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); |
| |
| /* "cpyamf/util.pyx":1046 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * cBufferedByteStream.write_short(self, <short>x) |
| */ |
| __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); |
| |
| /* "cpyamf/util.pyx":1059 |
| * """ |
| * if PyInt_Check(x) == 0 and PyLong_Check(x) == 0: |
| * raise TypeError('expected int for x') # <<<<<<<<<<<<<< |
| * |
| * if x > 4294967295L or x < 0: |
| */ |
| __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); |
| |
| /* "cpyamf/util.pyx":1093 |
| * """ |
| * if PyFloat_Check(val) == 0: |
| * raise TypeError('Expecting float for val') # <<<<<<<<<<<<<< |
| * |
| * cdef double d = val |
| */ |
| __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_28)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); |
| |
| /* "cpyamf/util.pyx":1137 |
| * new = BufferedByteStream(self) |
| * |
| * other.seek(0) # <<<<<<<<<<<<<< |
| * new.seek(0, 2) |
| * new.write(other.read()) |
| */ |
| __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); |
| __Pyx_INCREF(__pyx_int_0); |
| PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, __pyx_int_0); |
| __Pyx_GIVEREF(__pyx_int_0); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); |
| |
| /* "cpyamf/util.pyx":55 |
| * cdef object pyamf_NegInf = python.NegInf |
| * cdef object pyamf_PosInf = python.PosInf |
| * cdef object empty_unicode = unicode('') # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_35)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); |
| |
| /* "cpyamf/util.pyx":1159 |
| * |
| * if build_platform_exceptional_floats() == -1: |
| * raise SystemError('Unable to initialise cpyamf.util') # <<<<<<<<<<<<<< |
| */ |
| __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); |
| __Pyx_INCREF(((PyObject *)__pyx_kp_s_37)); |
| PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); |
| __Pyx_RefNannyFinishContext(); |
| return 0; |
| __pyx_L1_error:; |
| __Pyx_RefNannyFinishContext(); |
| return -1; |
| } |
| |
| static int __Pyx_InitGlobals(void) { |
| if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| __pyx_int_2147483648 = PyInt_FromString((char *)"2147483648", 0, 0); if (unlikely(!__pyx_int_2147483648)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| __pyx_int_4294967295L = PyLong_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295L)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| return 0; |
| __pyx_L1_error:; |
| return -1; |
| } |
| |
| #if PY_MAJOR_VERSION < 3 |
| PyMODINIT_FUNC initutil(void); /*proto*/ |
| PyMODINIT_FUNC initutil(void) |
| #else |
| PyMODINIT_FUNC PyInit_util(void); /*proto*/ |
| PyMODINIT_FUNC PyInit_util(void) |
| #endif |
| { |
| PyObject *__pyx_t_1 = NULL; |
| PyObject *__pyx_t_2 = NULL; |
| int __pyx_t_3; |
| int __pyx_t_4; |
| #if CYTHON_REFNANNY |
| void* __pyx_refnanny = NULL; |
| __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); |
| if (!__Pyx_RefNanny) { |
| PyErr_Clear(); |
| __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); |
| if (!__Pyx_RefNanny) |
| Py_FatalError("failed to import 'refnanny' module"); |
| } |
| __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_util(void)", __LINE__, __FILE__); |
| #endif |
| __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| #ifdef __pyx_binding_PyCFunctionType_USED |
| if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| #endif |
| /*--- Library function declarations ---*/ |
| /*--- Threads initialization code ---*/ |
| #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS |
| #ifdef WITH_THREAD /* Python build with threading support? */ |
| PyEval_InitThreads(); |
| #endif |
| #endif |
| /*--- Module creation code ---*/ |
| #if PY_MAJOR_VERSION < 3 |
| __pyx_m = Py_InitModule4(__Pyx_NAMESTR("util"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_31), 0, PYTHON_API_VERSION); |
| #else |
| __pyx_m = PyModule_Create(&__pyx_moduledef); |
| #endif |
| if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| #if PY_MAJOR_VERSION < 3 |
| Py_INCREF(__pyx_m); |
| #endif |
| __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); |
| if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| /*--- Initialize various global constants etc. ---*/ |
| if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_module_is_main_cpyamf__util) { |
| if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| } |
| /*--- Builtin init code ---*/ |
| if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| /*--- Constants init code ---*/ |
| if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| /*--- Global init code ---*/ |
| __pyx_v_6cpyamf_4util_pyamf_NaN = Py_None; Py_INCREF(Py_None); |
| __pyx_v_6cpyamf_4util_pyamf_NegInf = Py_None; Py_INCREF(Py_None); |
| __pyx_v_6cpyamf_4util_pyamf_PosInf = Py_None; Py_INCREF(Py_None); |
| __pyx_v_6cpyamf_4util_empty_unicode = Py_None; Py_INCREF(Py_None); |
| /*--- Function export code ---*/ |
| /*--- Type init code ---*/ |
| __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream = &__pyx_vtable_6cpyamf_4util_cBufferedByteStream; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.tell = (Py_ssize_t (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_tell; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char *, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream._init_buffer = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *))__pyx_f_6cpyamf_4util_19cBufferedByteStream__init_buffer; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream._actually_increase_buffer = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream__actually_increase_buffer; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream._increase_buffer = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream__increase_buffer; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.has_available = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream_has_available; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char **, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.at_eof = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_at_eof; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.remaining = (Py_ssize_t (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_remaining; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.seek = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_seek *__pyx_optional_args))__pyx_f_6cpyamf_4util_19cBufferedByteStream_seek; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.getvalue = (PyObject *(*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_getvalue; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.peek = (Py_ssize_t (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char **, Py_ssize_t))__pyx_f_6cpyamf_4util_19cBufferedByteStream_peek; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.truncate = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch, struct __pyx_opt_args_6cpyamf_4util_19cBufferedByteStream_truncate *__pyx_optional_args))__pyx_f_6cpyamf_4util_19cBufferedByteStream_truncate; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.consume = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_consume; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.unpack_int = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned int, void *))__pyx_f_6cpyamf_4util_19cBufferedByteStream_unpack_int; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.pack_int = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int, long))__pyx_f_6cpyamf_4util_19cBufferedByteStream_pack_int; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.pack_uint = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int, unsigned long))__pyx_f_6cpyamf_4util_19cBufferedByteStream_pack_uint; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_uchar = (unsigned char (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_uchar; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_char = (char (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_char; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_ushort = (unsigned short (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_ushort; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_short = (short (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_short; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_24bit_uint = (unsigned long (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_24bit_uint; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_24bit_int = (long (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_24bit_int; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_ulong = (unsigned long (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_ulong; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_long = (long (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_long; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_uchar = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned char, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_uchar; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_char = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, char, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_char; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_ushort = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned short, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_ushort; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_short = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, short, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_short; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_24bit_uint = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned long, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_24bit_uint; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_24bit_int = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, long, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_24bit_int; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_ulong = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, unsigned long, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_ulong; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_long = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, long, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_long; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_utf8_string = (PyObject *(*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, Py_ssize_t, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_utf8_string; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_utf8_string = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_utf8_string; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_double = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, double *))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_double; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_double = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, double, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_double; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.read_float = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, float *))__pyx_f_6cpyamf_4util_19cBufferedByteStream_read_float; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.write_float = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, float, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_write_float; |
| __pyx_vtable_6cpyamf_4util_cBufferedByteStream.append = (int (*)(struct __pyx_obj_6cpyamf_4util_cBufferedByteStream *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6cpyamf_4util_19cBufferedByteStream_append; |
| if (PyType_Ready(&__pyx_type_6cpyamf_4util_cBufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__Pyx_SetVtable(__pyx_type_6cpyamf_4util_cBufferedByteStream.tp_dict, __pyx_vtabptr_6cpyamf_4util_cBufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__Pyx_SetAttrString(__pyx_m, "cBufferedByteStream", (PyObject *)&__pyx_type_6cpyamf_4util_cBufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_ptype_6cpyamf_4util_cBufferedByteStream = &__pyx_type_6cpyamf_4util_cBufferedByteStream; |
| __pyx_vtabptr_6cpyamf_4util_BufferedByteStream = &__pyx_vtable_6cpyamf_4util_BufferedByteStream; |
| __pyx_vtable_6cpyamf_4util_BufferedByteStream.__pyx_base = *__pyx_vtabptr_6cpyamf_4util_cBufferedByteStream; |
| __pyx_type_6cpyamf_4util_BufferedByteStream.tp_base = __pyx_ptype_6cpyamf_4util_cBufferedByteStream; |
| if (PyType_Ready(&__pyx_type_6cpyamf_4util_BufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__Pyx_SetVtable(__pyx_type_6cpyamf_4util_BufferedByteStream.tp_dict, __pyx_vtabptr_6cpyamf_4util_BufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__Pyx_SetAttrString(__pyx_m, "BufferedByteStream", (PyObject *)&__pyx_type_6cpyamf_4util_BufferedByteStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_ptype_6cpyamf_4util_BufferedByteStream = &__pyx_type_6cpyamf_4util_BufferedByteStream; |
| /*--- Type import code ---*/ |
| __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| /*--- Function import code ---*/ |
| /*--- Execution code ---*/ |
| |
| /* "cpyamf/util.pyx":26 |
| * |
| * |
| * from pyamf import python # <<<<<<<<<<<<<< |
| * |
| * # module constant declarations |
| */ |
| __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| __Pyx_INCREF(((PyObject *)__pyx_n_s__python)); |
| PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__python)); |
| __Pyx_GIVEREF(((PyObject *)__pyx_n_s__python)); |
| __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__pyamf), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__python); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| if (PyObject_SetAttr(__pyx_m, __pyx_n_s__python, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| |
| /* "cpyamf/util.pyx":38 |
| * cdef char SYSTEM_ENDIAN |
| * |
| * cdef int float_broken = -1 # <<<<<<<<<<<<<< |
| * |
| * cdef unsigned char *NaN = <unsigned char *>'\xff\xf8\x00\x00\x00\x00\x00\x00' |
| */ |
| __pyx_v_6cpyamf_4util_float_broken = -1; |
| |
| /* "cpyamf/util.pyx":40 |
| * cdef int float_broken = -1 |
| * |
| * cdef unsigned char *NaN = <unsigned char *>'\xff\xf8\x00\x00\x00\x00\x00\x00' # <<<<<<<<<<<<<< |
| * cdef unsigned char *NegInf = <unsigned char *>'\xff\xf0\x00\x00\x00\x00\x00\x00' |
| * cdef unsigned char *PosInf = <unsigned char *>'\x7f\xf0\x00\x00\x00\x00\x00\x00' |
| */ |
| __pyx_v_6cpyamf_4util_NaN = ((unsigned char *)__pyx_k_32); |
| |
| /* "cpyamf/util.pyx":41 |
| * |
| * cdef unsigned char *NaN = <unsigned char *>'\xff\xf8\x00\x00\x00\x00\x00\x00' |
| * cdef unsigned char *NegInf = <unsigned char *>'\xff\xf0\x00\x00\x00\x00\x00\x00' # <<<<<<<<<<<<<< |
| * cdef unsigned char *PosInf = <unsigned char *>'\x7f\xf0\x00\x00\x00\x00\x00\x00' |
| * |
| */ |
| __pyx_v_6cpyamf_4util_NegInf = ((unsigned char *)__pyx_k_33); |
| |
| /* "cpyamf/util.pyx":42 |
| * cdef unsigned char *NaN = <unsigned char *>'\xff\xf8\x00\x00\x00\x00\x00\x00' |
| * cdef unsigned char *NegInf = <unsigned char *>'\xff\xf0\x00\x00\x00\x00\x00\x00' |
| * cdef unsigned char *PosInf = <unsigned char *>'\x7f\xf0\x00\x00\x00\x00\x00\x00' # <<<<<<<<<<<<<< |
| * |
| * cdef double platform_nan |
| */ |
| __pyx_v_6cpyamf_4util_PosInf = ((unsigned char *)__pyx_k_34); |
| |
| /* "cpyamf/util.pyx":52 |
| * cdef double system_neginf |
| * |
| * cdef object pyamf_NaN = python.NaN # <<<<<<<<<<<<<< |
| * cdef object pyamf_NegInf = python.NegInf |
| * cdef object pyamf_PosInf = python.PosInf |
| */ |
| __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__python); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_GOTREF(__pyx_v_6cpyamf_4util_pyamf_NaN); |
| __Pyx_DECREF(__pyx_v_6cpyamf_4util_pyamf_NaN); |
| __Pyx_GIVEREF(__pyx_t_1); |
| __pyx_v_6cpyamf_4util_pyamf_NaN = __pyx_t_1; |
| __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":53 |
| * |
| * cdef object pyamf_NaN = python.NaN |
| * cdef object pyamf_NegInf = python.NegInf # <<<<<<<<<<<<<< |
| * cdef object pyamf_PosInf = python.PosInf |
| * cdef object empty_unicode = unicode('') |
| */ |
| __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__python); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NegInf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| __Pyx_GOTREF(__pyx_v_6cpyamf_4util_pyamf_NegInf); |
| __Pyx_DECREF(__pyx_v_6cpyamf_4util_pyamf_NegInf); |
| __Pyx_GIVEREF(__pyx_t_2); |
| __pyx_v_6cpyamf_4util_pyamf_NegInf = __pyx_t_2; |
| __pyx_t_2 = 0; |
| |
| /* "cpyamf/util.pyx":54 |
| * cdef object pyamf_NaN = python.NaN |
| * cdef object pyamf_NegInf = python.NegInf |
| * cdef object pyamf_PosInf = python.PosInf # <<<<<<<<<<<<<< |
| * cdef object empty_unicode = unicode('') |
| * |
| */ |
| __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__python); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_2); |
| __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__PosInf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| __Pyx_GOTREF(__pyx_v_6cpyamf_4util_pyamf_PosInf); |
| __Pyx_DECREF(__pyx_v_6cpyamf_4util_pyamf_PosInf); |
| __Pyx_GIVEREF(__pyx_t_1); |
| __pyx_v_6cpyamf_4util_pyamf_PosInf = __pyx_t_1; |
| __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":55 |
| * cdef object pyamf_NegInf = python.NegInf |
| * cdef object pyamf_PosInf = python.PosInf |
| * cdef object empty_unicode = unicode('') # <<<<<<<<<<<<<< |
| * |
| * |
| */ |
| __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_GOTREF(__pyx_v_6cpyamf_4util_empty_unicode); |
| __Pyx_DECREF(__pyx_v_6cpyamf_4util_empty_unicode); |
| __Pyx_GIVEREF(__pyx_t_1); |
| __pyx_v_6cpyamf_4util_empty_unicode = __pyx_t_1; |
| __pyx_t_1 = 0; |
| |
| /* "cpyamf/util.pyx":1153 |
| * # init the module from here |
| * |
| * SYSTEM_ENDIAN = get_native_endian() # <<<<<<<<<<<<<< |
| * |
| * if is_broken_float(): |
| */ |
| __pyx_v_6cpyamf_4util_SYSTEM_ENDIAN = __pyx_f_6cpyamf_4util_get_native_endian(); |
| |
| /* "cpyamf/util.pyx":1155 |
| * SYSTEM_ENDIAN = get_native_endian() |
| * |
| * if is_broken_float(): # <<<<<<<<<<<<<< |
| * float_broken = 1 |
| * |
| */ |
| __pyx_t_3 = __pyx_f_6cpyamf_4util_is_broken_float(); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1156 |
| * |
| * if is_broken_float(): |
| * float_broken = 1 # <<<<<<<<<<<<<< |
| * |
| * if build_platform_exceptional_floats() == -1: |
| */ |
| __pyx_v_6cpyamf_4util_float_broken = 1; |
| goto __pyx_L2; |
| } |
| __pyx_L2:; |
| |
| /* "cpyamf/util.pyx":1158 |
| * float_broken = 1 |
| * |
| * if build_platform_exceptional_floats() == -1: # <<<<<<<<<<<<<< |
| * raise SystemError('Unable to initialise cpyamf.util') |
| */ |
| __pyx_t_4 = __pyx_f_6cpyamf_4util_build_platform_exceptional_floats(); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __pyx_t_3 = (__pyx_t_4 == -1); |
| if (__pyx_t_3) { |
| |
| /* "cpyamf/util.pyx":1159 |
| * |
| * if build_platform_exceptional_floats() == -1: |
| * raise SystemError('Unable to initialise cpyamf.util') # <<<<<<<<<<<<<< |
| */ |
| __pyx_t_1 = PyObject_Call(__pyx_builtin_SystemError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(__pyx_t_1); |
| __Pyx_Raise(__pyx_t_1, 0, 0); |
| __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| goto __pyx_L3; |
| } |
| __pyx_L3:; |
| |
| /* "cpyamf/util.pyx":1 |
| * # Copyright (c) The PyAMF Project. # <<<<<<<<<<<<<< |
| * # See LICENSE.txt for details. |
| * |
| */ |
| __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| |
| /* "cpython/type.pxd":2 |
| * |
| * cdef extern from "Python.h": # <<<<<<<<<<<<<< |
| * # The C structure of the objects used to describe built-in types. |
| * |
| */ |
| goto __pyx_L0; |
| __pyx_L1_error:; |
| __Pyx_XDECREF(__pyx_t_1); |
| __Pyx_XDECREF(__pyx_t_2); |
| if (__pyx_m) { |
| __Pyx_AddTraceback("init cpyamf.util"); |
| Py_DECREF(__pyx_m); __pyx_m = 0; |
| } else if (!PyErr_Occurred()) { |
| PyErr_SetString(PyExc_ImportError, "init cpyamf.util"); |
| } |
| __pyx_L0:; |
| __Pyx_RefNannyFinishContext(); |
| #if PY_MAJOR_VERSION < 3 |
| return; |
| #else |
| return __pyx_m; |
| #endif |
| } |
| |
| /* Runtime support code */ |
| |
| static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { |
| PyObject *result; |
| result = PyObject_GetAttr(dict, name); |
| if (!result) |
| PyErr_SetObject(PyExc_NameError, name); |
| return result; |
| } |
| |
| static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { |
| PyObject *local_type, *local_value, *local_tb; |
| PyObject *tmp_type, *tmp_value, *tmp_tb; |
| PyThreadState *tstate = PyThreadState_GET(); |
| local_type = tstate->curexc_type; |
| local_value = tstate->curexc_value; |
| local_tb = tstate->curexc_traceback; |
| tstate->curexc_type = 0; |
| tstate->curexc_value = 0; |
| tstate->curexc_traceback = 0; |
| PyErr_NormalizeException(&local_type, &local_value, &local_tb); |
| if (unlikely(tstate->curexc_type)) |
| goto bad; |
| #if PY_MAJOR_VERSION >= 3 |
| if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) |
| goto bad; |
| #endif |
| *type = local_type; |
| *value = local_value; |
| *tb = local_tb; |
| Py_INCREF(local_type); |
| Py_INCREF(local_value); |
| Py_INCREF(local_tb); |
| tmp_type = tstate->exc_type; |
| tmp_value = tstate->exc_value; |
| tmp_tb = tstate->exc_traceback; |
| tstate->exc_type = local_type; |
| tstate->exc_value = local_value; |
| tstate->exc_traceback = local_tb; |
| /* Make sure tstate is in a consistent state when we XDECREF |
| these objects (XDECREF may run arbitrary code). */ |
| Py_XDECREF(tmp_type); |
| Py_XDECREF(tmp_value); |
| Py_XDECREF(tmp_tb); |
| return 0; |
| bad: |
| *type = 0; |
| *value = 0; |
| *tb = 0; |
| Py_XDECREF(local_type); |
| Py_XDECREF(local_value); |
| Py_XDECREF(local_tb); |
| return -1; |
| } |
| |
| |
| static void __Pyx_RaiseArgtupleInvalid( |
| const char* func_name, |
| int exact, |
| Py_ssize_t num_min, |
| Py_ssize_t num_max, |
| Py_ssize_t num_found) |
| { |
| Py_ssize_t num_expected; |
| const char *number, *more_or_less; |
| |
| if (num_found < num_min) { |
| num_expected = num_min; |
| more_or_less = "at least"; |
| } else { |
| num_expected = num_max; |
| more_or_less = "at most"; |
| } |
| if (exact) { |
| more_or_less = "exactly"; |
| } |
| number = (num_expected == 1) ? "" : "s"; |
| PyErr_Format(PyExc_TypeError, |
| #if PY_VERSION_HEX < 0x02050000 |
| "%s() takes %s %d positional argument%s (%d given)", |
| #else |
| "%s() takes %s %zd positional argument%s (%zd given)", |
| #endif |
| func_name, more_or_less, num_expected, number, num_found); |
| } |
| |
| static CYTHON_INLINE int __Pyx_CheckKeywordStrings( |
| PyObject *kwdict, |
| const char* function_name, |
| int kw_allowed) |
| { |
| PyObject* key = 0; |
| Py_ssize_t pos = 0; |
| while (PyDict_Next(kwdict, &pos, &key, 0)) { |
| #if PY_MAJOR_VERSION < 3 |
| if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) |
| #else |
| if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) |
| #endif |
| goto invalid_keyword_type; |
| } |
| if ((!kw_allowed) && unlikely(key)) |
| goto invalid_keyword; |
| return 1; |
| invalid_keyword_type: |
| PyErr_Format(PyExc_TypeError, |
| "%s() keywords must be strings", function_name); |
| return 0; |
| invalid_keyword: |
| PyErr_Format(PyExc_TypeError, |
| #if PY_MAJOR_VERSION < 3 |
| "%s() got an unexpected keyword argument '%s'", |
| function_name, PyString_AsString(key)); |
| #else |
| "%s() got an unexpected keyword argument '%U'", |
| function_name, key); |
| #endif |
| return 0; |
| } |
| |
| static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { |
| PyObject *tmp_type, *tmp_value, *tmp_tb; |
| PyThreadState *tstate = PyThreadState_GET(); |
| |
| tmp_type = tstate->curexc_type; |
| tmp_value = tstate->curexc_value; |
| tmp_tb = tstate->curexc_traceback; |
| tstate->curexc_type = type; |
| tstate->curexc_value = value; |
| tstate->curexc_traceback = tb; |
| Py_XDECREF(tmp_type); |
| Py_XDECREF(tmp_value); |
| Py_XDECREF(tmp_tb); |
| } |
| |
| static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { |
| PyThreadState *tstate = PyThreadState_GET(); |
| *type = tstate->curexc_type; |
| *value = tstate->curexc_value; |
| *tb = tstate->curexc_traceback; |
| |
| tstate->curexc_type = 0; |
| tstate->curexc_value = 0; |
| tstate->curexc_traceback = 0; |
| } |
| |
| |
| #if PY_MAJOR_VERSION < 3 |
| static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { |
| Py_XINCREF(type); |
| Py_XINCREF(value); |
| Py_XINCREF(tb); |
| /* First, check the traceback argument, replacing None with NULL. */ |
| if (tb == Py_None) { |
| Py_DECREF(tb); |
| tb = 0; |
| } |
| else if (tb != NULL && !PyTraceBack_Check(tb)) { |
| PyErr_SetString(PyExc_TypeError, |
| "raise: arg 3 must be a traceback or None"); |
| goto raise_error; |
| } |
| /* Next, replace a missing value with None */ |
| if (value == NULL) { |
| value = Py_None; |
| Py_INCREF(value); |
| } |
| #if PY_VERSION_HEX < 0x02050000 |
| if (!PyClass_Check(type)) |
| #else |
| if (!PyType_Check(type)) |
| #endif |
| { |
| /* Raising an instance. The value should be a dummy. */ |
| if (value != Py_None) { |
| PyErr_SetString(PyExc_TypeError, |
| "instance exception may not have a separate value"); |
| goto raise_error; |
| } |
| /* Normalize to raise <class>, <instance> */ |
| Py_DECREF(value); |
| value = type; |
| #if PY_VERSION_HEX < 0x02050000 |
| if (PyInstance_Check(type)) { |
| type = (PyObject*) ((PyInstanceObject*)type)->in_class; |
| Py_INCREF(type); |
| } |
| else { |
| type = 0; |
| PyErr_SetString(PyExc_TypeError, |
| "raise: exception must be an old-style class or instance"); |
| goto raise_error; |
| } |
| #else |
| type = (PyObject*) Py_TYPE(type); |
| Py_INCREF(type); |
| if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { |
| PyErr_SetString(PyExc_TypeError, |
| "raise: exception class must be a subclass of BaseException"); |
| goto raise_error; |
| } |
| #endif |
| } |
| |
| __Pyx_ErrRestore(type, value, tb); |
| return; |
| raise_error: |
| Py_XDECREF(value); |
| Py_XDECREF(type); |
| Py_XDECREF(tb); |
| return; |
| } |
| |
| #else /* Python 3+ */ |
| |
| static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { |
| if (tb == Py_None) { |
| tb = 0; |
| } else if (tb && !PyTraceBack_Check(tb)) { |
| PyErr_SetString(PyExc_TypeError, |
| "raise: arg 3 must be a traceback or None"); |
| goto bad; |
| } |
| if (value == Py_None) |
| value = 0; |
| |
| if (PyExceptionInstance_Check(type)) { |
| if (value) { |
| PyErr_SetString(PyExc_TypeError, |
| "instance exception may not have a separate value"); |
| goto bad; |
| } |
| value = type; |
| type = (PyObject*) Py_TYPE(value); |
| } else if (!PyExceptionClass_Check(type)) { |
| PyErr_SetString(PyExc_TypeError, |
| "raise: exception class must be a subclass of BaseException"); |
| goto bad; |
| } |
| |
| PyErr_SetObject(type, value); |
| |
| if (tb) { |
| PyThreadState *tstate = PyThreadState_GET(); |
| PyObject* tmp_tb = tstate->curexc_traceback; |
| if (tb != tmp_tb) { |
| Py_INCREF(tb); |
| tstate->curexc_traceback = tb; |
| Py_XDECREF(tmp_tb); |
| } |
| } |
| |
| bad: |
| return; |
| } |
| #endif |
| |
| static void __Pyx_RaiseDoubleKeywordsError( |
| const char* func_name, |
| PyObject* kw_name) |
| { |
| PyErr_Format(PyExc_TypeError, |
| #if PY_MAJOR_VERSION >= 3 |
| "%s() got multiple values for keyword argument '%U'", func_name, kw_name); |
| #else |
| "%s() got multiple values for keyword argument '%s'", func_name, |
| PyString_AS_STRING(kw_name)); |
| #endif |
| } |
| |
| static int __Pyx_ParseOptionalKeywords( |
| PyObject *kwds, |
| PyObject **argnames[], |
| PyObject *kwds2, |
| PyObject *values[], |
| Py_ssize_t num_pos_args, |
| const char* function_name) |
| { |
| PyObject *key = 0, *value = 0; |
| Py_ssize_t pos = 0; |
| PyObject*** name; |
| PyObject*** first_kw_arg = argnames + num_pos_args; |
| |
| while (PyDict_Next(kwds, &pos, &key, &value)) { |
| name = first_kw_arg; |
| while (*name && (**name != key)) name++; |
| if (*name) { |
| values[name-argnames] = value; |
| } else { |
| #if PY_MAJOR_VERSION < 3 |
| if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { |
| #else |
| if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { |
| #endif |
| goto invalid_keyword_type; |
| } else { |
| for (name = first_kw_arg; *name; name++) { |
| #if PY_MAJOR_VERSION >= 3 |
| if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && |
| PyUnicode_Compare(**name, key) == 0) break; |
| #else |
| if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && |
| _PyString_Eq(**name, key)) break; |
| #endif |
| } |
| if (*name) { |
| values[name-argnames] = value; |
| } else { |
| /* unexpected keyword found */ |
| for (name=argnames; name != first_kw_arg; name++) { |
| if (**name == key) goto arg_passed_twice; |
| #if PY_MAJOR_VERSION >= 3 |
| if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && |
| PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; |
| #else |
| if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && |
| _PyString_Eq(**name, key)) goto arg_passed_twice; |
| #endif |
| } |
| if (kwds2) { |
| if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; |
| } else { |
| goto invalid_keyword; |
| } |
| } |
| } |
| } |
| } |
| return 0; |
| arg_passed_twice: |
| __Pyx_RaiseDoubleKeywordsError(function_name, **name); |
| goto bad; |
| invalid_keyword_type: |
| PyErr_Format(PyExc_TypeError, |
| "%s() keywords must be strings", function_name); |
| goto bad; |
| invalid_keyword: |
| PyErr_Format(PyExc_TypeError, |
| #if PY_MAJOR_VERSION < 3 |
| "%s() got an unexpected keyword argument '%s'", |
| function_name, PyString_AsString(key)); |
| #else |
| "%s() got an unexpected keyword argument '%U'", |
| function_name, key); |
| #endif |
| bad: |
| return -1; |
| } |
| |
| static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { |
| PyThreadState *tstate = PyThreadState_GET(); |
| *type = tstate->exc_type; |
| *value = tstate->exc_value; |
| *tb = tstate->exc_traceback; |
| Py_XINCREF(*type); |
| Py_XINCREF(*value); |
| Py_XINCREF(*tb); |
| } |
| |
| static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { |
| PyObject *tmp_type, *tmp_value, *tmp_tb; |
| PyThreadState *tstate = PyThreadState_GET(); |
| tmp_type = tstate->exc_type; |
| tmp_value = tstate->exc_value; |
| tmp_tb = tstate->exc_traceback; |
| tstate->exc_type = type; |
| tstate->exc_value = value; |
| tstate->exc_traceback = tb; |
| Py_XDECREF(tmp_type); |
| Py_XDECREF(tmp_value); |
| Py_XDECREF(tmp_tb); |
| } |
| |
| static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { |
| PyObject *py_import = 0; |
| PyObject *empty_list = 0; |
| PyObject *module = 0; |
| PyObject *global_dict = 0; |
| PyObject *empty_dict = 0; |
| PyObject *list; |
| py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); |
| if (!py_import) |
| goto bad; |
| if (from_list) |
| list = from_list; |
| else { |
| empty_list = PyList_New(0); |
| if (!empty_list) |
| goto bad; |
| list = empty_list; |
| } |
| global_dict = PyModule_GetDict(__pyx_m); |
| if (!global_dict) |
| goto bad; |
| empty_dict = PyDict_New(); |
| if (!empty_dict) |
| goto bad; |
| module = PyObject_CallFunctionObjArgs(py_import, |
| name, global_dict, empty_dict, list, NULL); |
| bad: |
| Py_XDECREF(empty_list); |
| Py_XDECREF(py_import); |
| Py_XDECREF(empty_dict); |
| return module; |
| } |
| |
| static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { |
| const unsigned char neg_one = (unsigned char)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(unsigned char) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(unsigned char)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to unsigned char" : |
| "value too large to convert to unsigned char"); |
| } |
| return (unsigned char)-1; |
| } |
| return (unsigned char)val; |
| } |
| return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); |
| } |
| |
| static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { |
| const unsigned short neg_one = (unsigned short)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(unsigned short) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(unsigned short)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to unsigned short" : |
| "value too large to convert to unsigned short"); |
| } |
| return (unsigned short)-1; |
| } |
| return (unsigned short)val; |
| } |
| return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); |
| } |
| |
| static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { |
| const unsigned int neg_one = (unsigned int)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(unsigned int) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(unsigned int)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to unsigned int" : |
| "value too large to convert to unsigned int"); |
| } |
| return (unsigned int)-1; |
| } |
| return (unsigned int)val; |
| } |
| return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); |
| } |
| |
| static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { |
| const char neg_one = (char)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(char) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(char)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to char" : |
| "value too large to convert to char"); |
| } |
| return (char)-1; |
| } |
| return (char)val; |
| } |
| return (char)__Pyx_PyInt_AsLong(x); |
| } |
| |
| static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { |
| const short neg_one = (short)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(short) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(short)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to short" : |
| "value too large to convert to short"); |
| } |
| return (short)-1; |
| } |
| return (short)val; |
| } |
| return (short)__Pyx_PyInt_AsLong(x); |
| } |
| |
| static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { |
| const int neg_one = (int)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(int) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(int)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to int" : |
| "value too large to convert to int"); |
| } |
| return (int)-1; |
| } |
| return (int)val; |
| } |
| return (int)__Pyx_PyInt_AsLong(x); |
| } |
| |
| static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { |
| const signed char neg_one = (signed char)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(signed char) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(signed char)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to signed char" : |
| "value too large to convert to signed char"); |
| } |
| return (signed char)-1; |
| } |
| return (signed char)val; |
| } |
| return (signed char)__Pyx_PyInt_AsSignedLong(x); |
| } |
| |
| static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { |
| const signed short neg_one = (signed short)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(signed short) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(signed short)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to signed short" : |
| "value too large to convert to signed short"); |
| } |
| return (signed short)-1; |
| } |
| return (signed short)val; |
| } |
| return (signed short)__Pyx_PyInt_AsSignedLong(x); |
| } |
| |
| static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { |
| const signed int neg_one = (signed int)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(signed int) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(signed int)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to signed int" : |
| "value too large to convert to signed int"); |
| } |
| return (signed int)-1; |
| } |
| return (signed int)val; |
| } |
| return (signed int)__Pyx_PyInt_AsSignedLong(x); |
| } |
| |
| static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { |
| const int neg_one = (int)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| if (sizeof(int) < sizeof(long)) { |
| long val = __Pyx_PyInt_AsLong(x); |
| if (unlikely(val != (long)(int)val)) { |
| if (!unlikely(val == -1 && PyErr_Occurred())) { |
| PyErr_SetString(PyExc_OverflowError, |
| (is_unsigned && unlikely(val < 0)) ? |
| "can't convert negative value to int" : |
| "value too large to convert to int"); |
| } |
| return (int)-1; |
| } |
| return (int)val; |
| } |
| return (int)__Pyx_PyInt_AsLong(x); |
| } |
| |
| static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { |
| const unsigned long neg_one = (unsigned long)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to unsigned long"); |
| return (unsigned long)-1; |
| } |
| return (unsigned long)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to unsigned long"); |
| return (unsigned long)-1; |
| } |
| return PyLong_AsUnsignedLong(x); |
| } else { |
| return PyLong_AsLong(x); |
| } |
| } else { |
| unsigned long val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (unsigned long)-1; |
| val = __Pyx_PyInt_AsUnsignedLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { |
| const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to unsigned PY_LONG_LONG"); |
| return (unsigned PY_LONG_LONG)-1; |
| } |
| return (unsigned PY_LONG_LONG)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to unsigned PY_LONG_LONG"); |
| return (unsigned PY_LONG_LONG)-1; |
| } |
| return PyLong_AsUnsignedLongLong(x); |
| } else { |
| return PyLong_AsLongLong(x); |
| } |
| } else { |
| unsigned PY_LONG_LONG val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (unsigned PY_LONG_LONG)-1; |
| val = __Pyx_PyInt_AsUnsignedLongLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { |
| const long neg_one = (long)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to long"); |
| return (long)-1; |
| } |
| return (long)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to long"); |
| return (long)-1; |
| } |
| return PyLong_AsUnsignedLong(x); |
| } else { |
| return PyLong_AsLong(x); |
| } |
| } else { |
| long val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (long)-1; |
| val = __Pyx_PyInt_AsLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { |
| const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to PY_LONG_LONG"); |
| return (PY_LONG_LONG)-1; |
| } |
| return (PY_LONG_LONG)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to PY_LONG_LONG"); |
| return (PY_LONG_LONG)-1; |
| } |
| return PyLong_AsUnsignedLongLong(x); |
| } else { |
| return PyLong_AsLongLong(x); |
| } |
| } else { |
| PY_LONG_LONG val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (PY_LONG_LONG)-1; |
| val = __Pyx_PyInt_AsLongLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { |
| const signed long neg_one = (signed long)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to signed long"); |
| return (signed long)-1; |
| } |
| return (signed long)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to signed long"); |
| return (signed long)-1; |
| } |
| return PyLong_AsUnsignedLong(x); |
| } else { |
| return PyLong_AsLong(x); |
| } |
| } else { |
| signed long val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (signed long)-1; |
| val = __Pyx_PyInt_AsSignedLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { |
| const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; |
| const int is_unsigned = neg_one > const_zero; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (likely(PyInt_Check(x))) { |
| long val = PyInt_AS_LONG(x); |
| if (is_unsigned && unlikely(val < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to signed PY_LONG_LONG"); |
| return (signed PY_LONG_LONG)-1; |
| } |
| return (signed PY_LONG_LONG)val; |
| } else |
| #endif |
| if (likely(PyLong_Check(x))) { |
| if (is_unsigned) { |
| if (unlikely(Py_SIZE(x) < 0)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "can't convert negative value to signed PY_LONG_LONG"); |
| return (signed PY_LONG_LONG)-1; |
| } |
| return PyLong_AsUnsignedLongLong(x); |
| } else { |
| return PyLong_AsLongLong(x); |
| } |
| } else { |
| signed PY_LONG_LONG val; |
| PyObject *tmp = __Pyx_PyNumber_Int(x); |
| if (!tmp) return (signed PY_LONG_LONG)-1; |
| val = __Pyx_PyInt_AsSignedLongLong(tmp); |
| Py_DECREF(tmp); |
| return val; |
| } |
| } |
| |
| static void __Pyx_WriteUnraisable(const char *name) { |
| PyObject *old_exc, *old_val, *old_tb; |
| PyObject *ctx; |
| __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); |
| #if PY_MAJOR_VERSION < 3 |
| ctx = PyString_FromString(name); |
| #else |
| ctx = PyUnicode_FromString(name); |
| #endif |
| __Pyx_ErrRestore(old_exc, old_val, old_tb); |
| if (!ctx) { |
| PyErr_WriteUnraisable(Py_None); |
| } else { |
| PyErr_WriteUnraisable(ctx); |
| Py_DECREF(ctx); |
| } |
| } |
| |
| static int __Pyx_SetVtable(PyObject *dict, void *vtable) { |
| #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) |
| PyObject *ob = PyCapsule_New(vtable, 0, 0); |
| #else |
| PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); |
| #endif |
| if (!ob) |
| goto bad; |
| if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) |
| goto bad; |
| Py_DECREF(ob); |
| return 0; |
| bad: |
| Py_XDECREF(ob); |
| return -1; |
| } |
| |
| #ifndef __PYX_HAVE_RT_ImportType |
| #define __PYX_HAVE_RT_ImportType |
| static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, |
| long size, int strict) |
| { |
| PyObject *py_module = 0; |
| PyObject *result = 0; |
| PyObject *py_name = 0; |
| char warning[200]; |
| |
| py_module = __Pyx_ImportModule(module_name); |
| if (!py_module) |
| goto bad; |
| #if PY_MAJOR_VERSION < 3 |
| py_name = PyString_FromString(class_name); |
| #else |
| py_name = PyUnicode_FromString(class_name); |
| #endif |
| if (!py_name) |
| goto bad; |
| result = PyObject_GetAttr(py_module, py_name); |
| Py_DECREF(py_name); |
| py_name = 0; |
| Py_DECREF(py_module); |
| py_module = 0; |
| if (!result) |
| goto bad; |
| if (!PyType_Check(result)) { |
| PyErr_Format(PyExc_TypeError, |
| "%s.%s is not a type object", |
| module_name, class_name); |
| goto bad; |
| } |
| if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { |
| PyOS_snprintf(warning, sizeof(warning), |
| "%s.%s size changed, may indicate binary incompatibility", |
| module_name, class_name); |
| #if PY_VERSION_HEX < 0x02050000 |
| PyErr_Warn(NULL, warning); |
| #else |
| PyErr_WarnEx(NULL, warning, 0); |
| #endif |
| } |
| else if (((PyTypeObject *)result)->tp_basicsize != size) { |
| PyErr_Format(PyExc_ValueError, |
| "%s.%s has the wrong size, try recompiling", |
| module_name, class_name); |
| goto bad; |
| } |
| return (PyTypeObject *)result; |
| bad: |
| Py_XDECREF(py_module); |
| Py_XDECREF(result); |
| return 0; |
| } |
| #endif |
| |
| #ifndef __PYX_HAVE_RT_ImportModule |
| #define __PYX_HAVE_RT_ImportModule |
| static PyObject *__Pyx_ImportModule(const char *name) { |
| PyObject *py_name = 0; |
| PyObject *py_module = 0; |
| |
| #if PY_MAJOR_VERSION < 3 |
| py_name = PyString_FromString(name); |
| #else |
| py_name = PyUnicode_FromString(name); |
| #endif |
| if (!py_name) |
| goto bad; |
| py_module = PyImport_Import(py_name); |
| Py_DECREF(py_name); |
| return py_module; |
| bad: |
| Py_XDECREF(py_name); |
| return 0; |
| } |
| #endif |
| |
| #include "compile.h" |
| #include "frameobject.h" |
| #include "traceback.h" |
| |
| static void __Pyx_AddTraceback(const char *funcname) { |
| PyObject *py_srcfile = 0; |
| PyObject *py_funcname = 0; |
| PyObject *py_globals = 0; |
| PyCodeObject *py_code = 0; |
| PyFrameObject *py_frame = 0; |
| |
| #if PY_MAJOR_VERSION < 3 |
| py_srcfile = PyString_FromString(__pyx_filename); |
| #else |
| py_srcfile = PyUnicode_FromString(__pyx_filename); |
| #endif |
| if (!py_srcfile) goto bad; |
| if (__pyx_clineno) { |
| #if PY_MAJOR_VERSION < 3 |
| py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); |
| #else |
| py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); |
| #endif |
| } |
| else { |
| #if PY_MAJOR_VERSION < 3 |
| py_funcname = PyString_FromString(funcname); |
| #else |
| py_funcname = PyUnicode_FromString(funcname); |
| #endif |
| } |
| if (!py_funcname) goto bad; |
| py_globals = PyModule_GetDict(__pyx_m); |
| if (!py_globals) goto bad; |
| py_code = PyCode_New( |
| 0, /*int argcount,*/ |
| #if PY_MAJOR_VERSION >= 3 |
| 0, /*int kwonlyargcount,*/ |
| #endif |
| 0, /*int nlocals,*/ |
| 0, /*int stacksize,*/ |
| 0, /*int flags,*/ |
| __pyx_empty_bytes, /*PyObject *code,*/ |
| __pyx_empty_tuple, /*PyObject *consts,*/ |
| __pyx_empty_tuple, /*PyObject *names,*/ |
| __pyx_empty_tuple, /*PyObject *varnames,*/ |
| __pyx_empty_tuple, /*PyObject *freevars,*/ |
| __pyx_empty_tuple, /*PyObject *cellvars,*/ |
| py_srcfile, /*PyObject *filename,*/ |
| py_funcname, /*PyObject *name,*/ |
| __pyx_lineno, /*int firstlineno,*/ |
| __pyx_empty_bytes /*PyObject *lnotab*/ |
| ); |
| if (!py_code) goto bad; |
| py_frame = PyFrame_New( |
| PyThreadState_GET(), /*PyThreadState *tstate,*/ |
| py_code, /*PyCodeObject *code,*/ |
| py_globals, /*PyObject *globals,*/ |
| 0 /*PyObject *locals*/ |
| ); |
| if (!py_frame) goto bad; |
| py_frame->f_lineno = __pyx_lineno; |
| PyTraceBack_Here(py_frame); |
| bad: |
| Py_XDECREF(py_srcfile); |
| Py_XDECREF(py_funcname); |
| Py_XDECREF(py_code); |
| Py_XDECREF(py_frame); |
| } |
| |
| static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
| while (t->p) { |
| #if PY_MAJOR_VERSION < 3 |
| if (t->is_unicode) { |
| *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); |
| } else if (t->intern) { |
| *t->p = PyString_InternFromString(t->s); |
| } else { |
| *t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
| } |
| #else /* Python 3+ has unicode identifiers */ |
| if (t->is_unicode | t->is_str) { |
| if (t->intern) { |
| *t->p = PyUnicode_InternFromString(t->s); |
| } else if (t->encoding) { |
| *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); |
| } else { |
| *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); |
| } |
| } else { |
| *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); |
| } |
| #endif |
| if (!*t->p) |
| return -1; |
| ++t; |
| } |
| return 0; |
| } |
| |
| /* Type Conversion Functions */ |
| |
| static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { |
| int is_true = x == Py_True; |
| if (is_true | (x == Py_False) | (x == Py_None)) return is_true; |
| else return PyObject_IsTrue(x); |
| } |
| |
| static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { |
| PyNumberMethods *m; |
| const char *name = NULL; |
| PyObject *res = NULL; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (PyInt_Check(x) || PyLong_Check(x)) |
| #else |
| if (PyLong_Check(x)) |
| #endif |
| return Py_INCREF(x), x; |
| m = Py_TYPE(x)->tp_as_number; |
| #if PY_VERSION_HEX < 0x03000000 |
| if (m && m->nb_int) { |
| name = "int"; |
| res = PyNumber_Int(x); |
| } |
| else if (m && m->nb_long) { |
| name = "long"; |
| res = PyNumber_Long(x); |
| } |
| #else |
| if (m && m->nb_int) { |
| name = "int"; |
| res = PyNumber_Long(x); |
| } |
| #endif |
| if (res) { |
| #if PY_VERSION_HEX < 0x03000000 |
| if (!PyInt_Check(res) && !PyLong_Check(res)) { |
| #else |
| if (!PyLong_Check(res)) { |
| #endif |
| PyErr_Format(PyExc_TypeError, |
| "__%s__ returned non-%s (type %.200s)", |
| name, name, Py_TYPE(res)->tp_name); |
| Py_DECREF(res); |
| return NULL; |
| } |
| } |
| else if (!PyErr_Occurred()) { |
| PyErr_SetString(PyExc_TypeError, |
| "an integer is required"); |
| } |
| return res; |
| } |
| |
| static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { |
| Py_ssize_t ival; |
| PyObject* x = PyNumber_Index(b); |
| if (!x) return -1; |
| ival = PyInt_AsSsize_t(x); |
| Py_DECREF(x); |
| return ival; |
| } |
| |
| static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { |
| #if PY_VERSION_HEX < 0x02050000 |
| if (ival <= LONG_MAX) |
| return PyInt_FromLong((long)ival); |
| else { |
| unsigned char *bytes = (unsigned char *) &ival; |
| int one = 1; int little = (int)*(unsigned char*)&one; |
| return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); |
| } |
| #else |
| return PyInt_FromSize_t(ival); |
| #endif |
| } |
| |
| static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { |
| unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); |
| if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { |
| return (size_t)-1; |
| } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { |
| PyErr_SetString(PyExc_OverflowError, |
| "value too large to convert to size_t"); |
| return (size_t)-1; |
| } |
| return (size_t)val; |
| } |
| |
| |
| #endif /* Py_PYTHON_H */ |