1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

libldb: Fix const char in pyldb

../lib/ldb/pyldb.c: In function ‘PyDict_AsMessage’:
../lib/ldb/pyldb.c:90:22: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 #define PyStr_AsUTF8 PyUnicode_AsUTF8
                      ^~~~~~~~~~~~~~~~
../lib/ldb/pyldb.c:1359:19: note: in expansion of macro ‘PyStr_AsUTF8’
   char *key_str = PyStr_AsUTF8(key);
                   ^~~~~~~~~~~~
../lib/ldb/pyldb.c: In function ‘py_ldb_msg_getitem_helper’:
../lib/ldb/pyldb.c:3336:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  name = PyStr_AsUTF8(py_name);
       ^
../lib/ldb/pyldb.c: In function ‘py_ldb_msg_setitem’:
../lib/ldb/pyldb.c:3502:12: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  attr_name = PyStr_AsUTF8(name);
            ^

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
Andreas Schneider 2018-11-12 17:19:21 +01:00 committed by Andreas Schneider
parent 483d5ea5c8
commit 0595129b8e

View File

@ -1356,7 +1356,7 @@ static struct ldb_message *PyDict_AsMessage(TALLOC_CTX *mem_ctx,
}
while (PyDict_Next(py_obj, &dict_pos, &key, &value)) {
char *key_str = PyStr_AsUTF8(key);
const char *key_str = PyStr_AsUTF8(key);
if (ldb_attr_cmp(key_str, "dn") != 0) {
msg_el = PyObject_AsMessageElement(msg->elements, value,
mod_flags, key_str);
@ -3331,7 +3331,7 @@ static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self)
static PyObject *py_ldb_msg_getitem_helper(PyLdbMessageObject *self, PyObject *py_name)
{
struct ldb_message_element *el;
char *name;
const char *name;
struct ldb_message *msg = pyldb_Message_AsMessage(self);
name = PyStr_AsUTF8(py_name);
if (name == NULL) {
@ -3497,7 +3497,7 @@ static PyObject *py_ldb_msg_iter(PyLdbMessageObject *self)
static int py_ldb_msg_setitem(PyLdbMessageObject *self, PyObject *name, PyObject *value)
{
char *attr_name;
const char *attr_name;
attr_name = PyStr_AsUTF8(name);
if (attr_name == NULL) {