Merge pull request #201 from anthrotype/msvcrt90-cp27

replace vector.data() with &vector[0] for MSVC90 compatibility
This commit is contained in:
szabadka 2015-10-05 12:15:57 +02:00
commit 8e90bf4c5f
3 changed files with 6 additions and 15 deletions

View File

@ -18,7 +18,7 @@ environment:
- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
WINDOWS_SDK_VERSION: "v7.1"
WINDOWS_SDK_VERSION: "v7.0"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"

View File

@ -191,7 +191,7 @@ static PyObject* brotli_decompress(PyObject *self, PyObject *args) {
ok = BrotliDecompress(in, out);
if (ok) {
ret = PyBytes_FromStringAndSize((char*)output.data(), output.size());
ret = PyBytes_FromStringAndSize((char*)(output.size() ? &output[0] : NULL), output.size());
} else {
PyErr_SetString(BrotliError, "BrotliDecompress failed");
}

View File

@ -1,3 +1,7 @@
try:
import setuptools
except:
pass
import distutils
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
@ -9,19 +13,6 @@ import re
CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# when compiling for Windows Python 2.7, force distutils to use Visual Studio
# 2010 instead of 2008, as the latter doesn't support c++0x
if platform.system() == 'Windows':
try:
import distutils.msvc9compiler
except distutils.errors.DistutilsPlatformError:
pass # importing msvc9compiler raises when running under MinGW
else:
orig_find_vcvarsall = distutils.msvc9compiler.find_vcvarsall
def patched_find_vcvarsall(version):
return orig_find_vcvarsall(version if version != 9.0 else 10.0)
distutils.msvc9compiler.find_vcvarsall = patched_find_vcvarsall
def get_version():
""" Return BROTLI_VERSION string as defined in 'tools/version.h' file. """