Changeset: 7b4247e4a21e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7b4247e4a21e Modified Files: sql/backends/monet5/UDF/pyapi/type_conversion.c sql/backends/monet5/UDF/pyapi/type_conversion.h Branch: Aug2018 Log Message:
Add some const, required for Python 3.7. diffs (57 lines): diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.c b/sql/backends/monet5/UDF/pyapi/type_conversion.c --- a/sql/backends/monet5/UDF/pyapi/type_conversion.c +++ b/sql/backends/monet5/UDF/pyapi/type_conversion.c @@ -18,7 +18,7 @@ #define PyString_CheckExact PyUnicode_CheckExact #endif -bool string_copy(char *source, char *dest, size_t max_size, bool allow_unicode) +bool string_copy(const char *source, char *dest, size_t max_size, bool allow_unicode) { size_t i; for (i = 0; i < max_size; i++) { @@ -175,7 +175,7 @@ str pyobject_to_str(PyObject **ptr, size ucs2_to_utf8(0, ((PyUnicodeObject *)obj)->length, utf8_string, str); #endif #else - char *str = PyUnicode_AsUTF8(obj); + const char *str = PyUnicode_AsUTF8(obj); if (!string_copy(str, utf8_string, len-1, true)) { msg = createException(MAL, "pyapi.eval", SQLSTATE(PY000) "Invalid string encoding used. Please return " @@ -206,7 +206,7 @@ wrapup: } #define STRING_TO_NUMBER_FACTORY(tpe) \ - str str_to_##tpe(char *ptr, size_t maxsize, tpe *value) \ + str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value) \ { \ size_t len = sizeof(tpe); \ char buf[256]; \ diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.h b/sql/backends/monet5/UDF/pyapi/type_conversion.h --- a/sql/backends/monet5/UDF/pyapi/type_conversion.h +++ b/sql/backends/monet5/UDF/pyapi/type_conversion.h @@ -24,12 +24,12 @@ //! Copies the string of size up to max_size from the source to the destination, //! returns FALSE if "source" is not a legal ASCII string (i.e. a character is //! >= 128) -bool string_copy(char *source, char *dest, size_t max_size, bool allow_unicode); +bool string_copy(const char *source, char *dest, size_t max_size, bool allow_unicode); #ifdef HAVE_HGE //! Converts a hge to a string and writes it into the string "str" int hge_to_string(char *str, hge); //! Converts a base-10 string to a hge value -str str_to_hge(char *ptr, size_t maxsize, hge *value); +str str_to_hge(const char *ptr, size_t maxsize, hge *value); //! Converts a base-10 utf32-encoded string to a hge value str unicode_to_hge(Py_UNICODE *utf32, size_t maxsize, hge *value); //! Converts a PyObject to a hge value @@ -48,7 +48,7 @@ str pyobject_to_blob(PyObject **ptr, siz //using macros, create a number of str_to_<type>, unicode_to_<type> and pyobject_to_<type> functions (we are Java now) #define CONVERSION_FUNCTION_HEADER_FACTORY(tpe) \ - str str_to_##tpe(char *ptr, size_t maxsize, tpe *value); \ + str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value); \ str unicode_to_##tpe(Py_UNICODE *ptr, size_t maxsize, tpe *value); \ str pyobject_to_##tpe(PyObject **ptr, size_t maxsize, tpe *value); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list