Closed dimitre closed 2 years ago
There should be no harm in a cast like that but I don't see why it would be necessary.
This code was taken from the early NDI Version 2 "NDIlib_Send_Video_Advanced" C++ example. Examples from Version 3 onwards initialize NDI_connection_type.p_data directly with default 0 for string length and "NDIlib_send_timecode_synthesize" for the timecode.
To bring it up to date we would have :
NDIlib_metadata_frame_t NDI_connection_type;
NDI_connection_type.p_data = "<ndi_product long_name=\"ofxNDI sender\" "
" short_name=\"ofxNDI Sender\" "
" manufacturer=\"spout@zeal.co\" "
" version=\"1.004.000\" "
" session=\"default\" "
" model_name=\"none\" "
" serial=\"none\"/>";
p_NDILib->send_add_connection_metadata(pNDI_send, &NDI_connection_type);
Would that still cause a warning in your environment?
Yeah sure it is no problem to be as it is here is the warning, just for information
ISO C++11 does not allow conversion from string literal to 'char *'
OK thanks for clarifying that.
I understand from what you say that the current NDI example code would also produce such a warning. In that case we could add the char cast before the string as so -
NDIlib_metadata_frame_t NDI_connection_type;
NDI_connection_type.p_data = (char *)"<ndi_product long_name=\"ofxNDI sender\" "
" short_name=\"ofxNDI Sender\" "
" manufacturer=\"spout@zeal.co\" "
" version=\"1.004.000\" "
" session=\"default\" "
" model_name=\"none\" "
" serial=\"none\"/>";
p_NDILib->send_add_connection_metadata(pNDI_send, &NDI_connection_type);
Would that work? I would like to update to the current example code if possible.
Changes made and checked An NDI SDK problem
so it doesn't complain in c++11