lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1789422 - /lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp
Date Wed, 29 Mar 2017 23:08:37 GMT
Author: vajda
Date: Wed Mar 29 23:08:37 2017
New Revision: 1789422

URL: http://svn.apache.org/viewvc?rev=1789422&view=rev
Log:
hopefully fix strhash for _MSC_VER

Modified:
    lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp

Modified: lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp?rev=1789422&r1=1789421&r2=1789422&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc3/sources/jcc.cpp Wed Mar 29 23:08:37 2017
@@ -193,6 +193,17 @@ static PyObject *t_jccenv_isShared(PyObj
 #endif
 }
 
+#ifdef _MSC_VER
+static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
+{
+    static const size_t hexdig = sizeof(unsigned long long) * 2;
+    unsigned long long hash = (unsigned long long) PyObject_Hash(arg);
+    char buffer[hexdig + 1];
+
+    sprintf(buffer, "%0*llx", (int) hexdig, hash);
+    return PyUnicode_FromStringAndSize(buffer, hexdig);
+}
+#else
 static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
 {
     static const size_t hexdig = sizeof(uintmax_t) * 2;
@@ -202,6 +213,7 @@ static PyObject *t_jccenv_strhash(PyObje
     sprintf(buffer, "%0*"PRIxMAX, (int) hexdig, hash);
     return PyUnicode_FromStringAndSize(buffer, hexdig);
 }
+#endif
 
 static PyObject *t_jccenv__dumpRefs(PyObject *self,
                                     PyObject *args, PyObject *kwds)



Mime
View raw message