xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #878: lz4-msvc-fix.patch

File lz4-msvc-fix.patch, 1.7 KB (added by Antoine Martin, 5 years ago)

patch for building latest python-lz4 with msvc

  • src/python-lz4.c

    a b  
    8080    char *dest;
    8181    int dest_size;
    8282    int acceleration;
     83    int actual_size;
     84    int osize;
    8385
    8486    if (!PyArg_ParseTuple(args, "s#I", &source, &source_size, &acceleration))
    8587        return NULL;
     
    9395    store_le32(dest, source_size);
    9496    if (source_size > 0) {
    9597        //int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
    96         int osize = LZ4_compress_fast(source, dest + hdr_size, source_size, LZ4_compressBound(source_size), acceleration);
    97         int actual_size = hdr_size + osize;
     98        osize = LZ4_compress_fast(source, dest + hdr_size, source_size, LZ4_compressBound(source_size), acceleration);
     99        actual_size = hdr_size + osize;
    98100        /* Resizes are expensive; tolerate some slop to avoid. */
    99101        if (actual_size < (dest_size / 4) * 3) {
    100102            _PyBytes_Resize(&result, actual_size);
     
    112114    int source_size;
    113115    char *dest;
    114116    int dest_size;
     117    int actual_size;
     118    int osize;
    115119
    116120    if (!PyArg_ParseTuple(args, "s#", &source, &source_size))
    117121        return NULL;
     
    124128    dest = PyBytes_AS_STRING(result);
    125129    store_le32(dest, source_size);
    126130    if (source_size > 0) {
    127         int osize = -1;
     131        osize = -1;
    128132        Py_BEGIN_ALLOW_THREADS
    129133        osize = compress(source, dest + hdr_size, source_size);
    130134        Py_END_ALLOW_THREADS
    131         int actual_size = hdr_size + osize;
     135        actual_size = hdr_size + osize;
    132136        /* Resizes are expensive; tolerate some slop to avoid. */
    133137        if (actual_size < (dest_size / 4) * 3) {
    134138            _PyBytes_Resize(&result, actual_size);