Skip to content

Commit

Permalink
fix: Visual Studio does not support VLAs (issue #1)
Browse files Browse the repository at this point in the history
Stupid compiler, hopefully it's happy with "static int".

BTW we fix a warning: PyObject_Hash returns Py_hash_t nowadays
since (python 3.2).

see #1

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
  • Loading branch information
rudimeier committed Mar 17, 2017
1 parent 8400572 commit 764ed0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jcc/sources/jcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ static PyObject *t_jccenv_isShared(PyObject *self)

static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
{
long hash = PyObject_Hash(arg);
size_t hexdig = sizeof(long) * 2;
unsigned long hash = (unsigned long)PyObject_Hash(arg);
static const size_t hexdig = sizeof(hash) * 2;
char buffer[hexdig + 1];

sprintf(buffer, "%0*lx", (int)hexdig, (unsigned long)hash);
sprintf(buffer, "%0*lx", (int)hexdig, hash);
return PyUnicode_FromStringAndSize(buffer, hexdig);
}

Expand Down

0 comments on commit 764ed0d

Please sign in to comment.