various changes for removing warning in clang compilation: const char…#16
various changes for removing warning in clang compilation: const char…#16adamrankin merged 1 commit intoPlusToolkit:masterfrom
Conversation
| if (pol->ErrorCallback) | ||
| { | ||
| pol->ErrorCallback(errnum, ndiErrorString(errnum), pol->ErrorCallbackData); | ||
| pol->ErrorCallback(errnum, (char*)ndiErrorString(errnum), pol->ErrorCallbackData); |
There was a problem hiding this comment.
So, the return type of ndiErrorString is char*, so this is redundant. Is it the ndicapiExport token in ndicapiExport char* ndiErrorString(int errnum); that causes the warning?
There was a problem hiding this comment.
Oh, I see, changes to ndiErrorString below, nevermind.
| #define PyString_Format PyUnicode_Format | ||
| #define PyString_AsString PyUnicode_AsUTF8 | ||
| #define PyIntObject PyLongObject | ||
| //#define PY_INT_OBJECT_OB_IVAL(ob) PyLong_AsLong((PyObject*)(ob)) |
There was a problem hiding this comment.
Please remove commented code. If you want to keep it, please add a comment above as to why it's being kept.
There was a problem hiding this comment.
The safe way to get the long inside a PyLong is to use PyLong_AsLong(PyObject*) and not just ob_digit[0]. All around in CPython PyLong_AsLong is used.
https://github.com/python/cpython/blob/6405feecda6a5d5dd7a4240eb3054a2676ed29b1/Objects/longobject.c
There was a problem hiding this comment.
I think you know more about this than I do. Whatever you think is right (and works on all platforms).
There was a problem hiding this comment.
Fixed with the most compatible way: PyLong_AsLong
| bitfield_lshift(PyIntObject* v, PyIntObject* w) | ||
| { | ||
| register unsigned long a, b; | ||
| register long a, b; |
There was a problem hiding this comment.
Is this a bug fix or a compiler warning? If compiler warning, please #ifdef it to OSX vs other
There was a problem hiding this comment.
Compiler mega-warning when doing (b < 0) that's impossible. These variables got assigned as from ob_digit[0] from PyLong that is a signed long and not unsigned.
I would also remove the register keyword.
| Py_NDIErrcodeMacro(NDI_EPROM_READ); | ||
| Py_NDIErrcodeMacro(NDI_EPROM_WRITE); | ||
| Py_NDIErrcodeMacro(NDI_EPROM_ERASE); | ||
| //Py_NDIErrcodeMacro(NDI_EPROM_READ); |
There was a problem hiding this comment.
Do these no longer work? If so, could you add an issue?
If they do work, please undo the commenting.
There was a problem hiding this comment.
Removed due to missing symblols. I can protect them with an #ifdef
|
Thank you very much for the fixes! I've added some comments and questions to the PR. |
|
After a couple of |
…const char, error in probe python, || and && added BX to Python
|
Thanks for the contribution, the python wrapping is not my area! |
Fix of building error under macOS clang 9.1.0 and warnings under Linux with GCC 4.9.2