Kodi Community Forum

Full Version: [Kodi 15.2] Compilation warnings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I finally got time to upgrade to 15.2 yesterday afternoon (I was using RC2 for a long time) and I just have to report three warnings I saw during the compilation.
Nothing serious preventing the build, just warnings that could be tune in the code I guess.

1-
Quote:CPP lib/SlingboxLib/SlingboxLib.o
SlingboxLib.cpp: In member function ‘bool CSlingbox::Connect(bool, const char*)’:
SlingboxLib.cpp:174:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
"Pragma: Sling-Connection-Type=Control, Session-Id=0\r\n\r\n";
^

2-
Quote:CC xbmc/cores/DllLoader/ldt_keeper.o
ldt_keeper.c: In function ‘Setup_LDT_Keeper’:
ldt_keeper.c:258:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
*(void**)array.base_addr = ldt_fs->prev_struct;
^

3-
Quote:CPP xbmc/interfaces/python/swig.o
swig.cpp: In static member function ‘static bool PythonBindings:TongueythonToCppException:TonguearsePythonException(std:Confusedtring&, std:Confusedtring&, std:Confusedtring&)’:
swig.cpp:199:190: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
PyObject *tbList = PyObject_CallMethod(tracebackModule, "format_exception", "OOO", exc_type, exc_value == NULL ? Py_None : exc_value, exc_traceback == NULL ? Py_None : exc_traceback);
^
swig.cpp:199:190: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
swig.cpp:201:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
PyObject *strRetval = PyObject_CallMethod(emptyString, "join", "O", tbList);
^
swig.cpp:201:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]


Thank you for this awesome piece of software you are writing, keep up the EXCELLENT work !
It's only a warning. As we convert a const char* to a char* ptr.

Edit: if you want add: const_cast < char* > and see if it solves the issue for you, please.
Hi,

Finally got time to test, correct, try, and post !


1-

Code:
diff --git a/lib/SlingboxLib/SlingboxLib.cpp b/lib/SlingboxLib/SlingboxLib.cpp
index 0632e6f..2bef317 100644
--- a/lib/SlingboxLib/SlingboxLib.cpp
+++ b/lib/SlingboxLib/SlingboxLib.cpp
@@ -168,9 +168,8 @@ bool CSlingbox::Connect(bool bLoginAsAdmin, const char * szPassword)

     return false;
   }
-
   // Prepare and send string
-  char * szString = "GET /stream.asf HTTP/1.1\r\nAccept: */*\r\n"
+  const char * szString = "GET /stream.asf HTTP/1.1\r\nAccept: */*\r\n"
     "Pragma: Sling-Connection-Type=Control, Session-Id=0\r\n\r\n";
   if (Send(m_socCommunication, (void *)szString, strlen(szString)) <= 0)
   {

No more warning.


2-

Code:
CC xbmc/cores/DllLoader/ldt_keeper.o
ldt_keeper.c: In function ‘Setup_LDT_Keeper’:
ldt_keeper.c:258:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
*(void**)array.base_addr = ldt_fs->prev_struct;
^

I don't really see what I can do here ...


3-

As I read it seems to be a Python's functions problem (somes requesting "const char" , others not ...).
So, nothing we can do on this side of the code. Am I wrong ?