1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * Copyright (c) 2008 The Hewlett-Packard Development Company 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 104 unchanged lines hidden (view full) --- 113{ 114 assert(pymod->zlen == pymod->code_end - pymod->code); 115 Bytef *marshalled = new Bytef[pymod->mlen]; 116 uLongf unzlen = pymod->mlen; 117 int ret = uncompress(marshalled, &unzlen, (const Bytef *)pymod->code, 118 pymod->zlen); 119 if (ret != Z_OK) 120 panic("Could not uncompress code: %s\n", zError(ret)); |
121 assert(unzlen == (uLongf)pymod->mlen); |
122 123 return PyMarshal_ReadObjectFromString((char *)marshalled, pymod->mlen); 124} 125 126// The python library is totally messed up with respect to constness, 127// so make a simple macro to make life a little easier 128#define PyCC(x) (const_cast<char *>(x)) 129 --- 80 unchanged lines hidden --- |