Commit 9d5f41e4 authored by Michael Buesch's avatar Michael Buesch

Avoid const-ness compiler warning in __Pyx_PyObject_AsWritableString

This avoids the compiler warning
  warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
by casting the pointer to uintptr_t before removing the const-ness.

The warning was introduced in 6cd70f09

Also merge the two places that define stdint types.
parent cac84684
......@@ -259,15 +259,31 @@
#ifdef _MSC_VER
#ifndef _MSC_STDINT_H_
#if _MSC_VER < 1300
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
#endif
#if _MSC_VER < 1300
#ifdef _WIN64
typedef unsigned long long __pyx_uintptr_t;
#else
typedef unsigned int __pyx_uintptr_t;
#endif
#else
#ifdef _WIN64
typedef unsigned __int64 __pyx_uintptr_t;
#else
typedef unsigned __int32 __pyx_uintptr_t;
#endif
#endif
#else
#include <stdint.h>
#include <stdint.h>
typedef uintptr_t __pyx_uintptr_t;
#endif
......
......@@ -68,9 +68,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
......@@ -708,18 +708,6 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
//@requires: StringTools.c::BuildPyUnicode
//@requires: CIntToDigits
#ifdef _MSC_VER
#ifndef _MSC_STDINT_H_
#if _MSC_VER < 1300
typedef unsigned short uint16_t;
#else
typedef unsigned __int16 uint16_t;
#endif
#endif
#else
#include <stdint.h>
#endif
// NOTE: inlining because most arguments are constant, which collapses lots of code below
static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t width, char padding_char, char format_char) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment