@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGES.
4242
4343#include < string.h>
4444#include < stdlib.h>
45+ #include < iostream>
46+
4547#include < stdio.h>
4648#include < math.h>
4749
@@ -68,7 +70,7 @@ namespace
6870 // call the user-supplied callback function
6971 if (pol->ErrorCallback )
7072 {
71- pol->ErrorCallback (errnum, ndiErrorString (errnum), pol->ErrorCallbackData );
73+ pol->ErrorCallback (errnum, ( char *) ndiErrorString (errnum), pol->ErrorCallbackData );
7274 }
7375
7476 return errnum;
@@ -491,9 +493,9 @@ ndicapiExport int ndiGetSocketError(ndicapi* pol)
491493}
492494
493495// ----------------------------------------------------------------------------
494- ndicapiExport char * ndiErrorString (int errnum)
496+ ndicapiExport const char * ndiErrorString (int errnum)
495497{
496- static char * textarray_low[] = // values from 0x01 to 0x21
498+ static const char * textarray_low[] = // values from 0x01 to 0x21
497499 {
498500 " No error" ,
499501 " Invalid command" ,
@@ -546,7 +548,7 @@ ndicapiExport char* ndiErrorString(int errnum)
546548 " Invalid input or output state" ,
547549 };
548550
549- static char * textarray_high[] = // values from 0xf6 to 0xf4
551+ static const char * textarray_high[] = // values from 0xf6 to 0xf4
550552 {
551553 " Too much environmental infrared" ,
552554 " Unrecognized error code" ,
@@ -556,7 +558,7 @@ ndicapiExport char* ndiErrorString(int errnum)
556558 " Unable to read Flash EPROM" ,
557559 };
558560
559- static char * textarray_api[] = // values specific to the API
561+ static const char * textarray_api[] = // values specific to the API
560562 {
561563 " Bad CRC on reply from Measurement System" ,
562564 " Error opening serial connection" ,
@@ -568,7 +570,7 @@ ndicapiExport char* ndiErrorString(int errnum)
568570 " Measurement System not found on specified port"
569571 };
570572
571- static char * textarray_serial[] = // values specific to serial errors
573+ static const char * textarray_serial[] = // values specific to serial errors
572574 {
573575 " Serial DSR query failure" ,
574576 " Bad reply from measurement system" ,
@@ -597,7 +599,7 @@ ndicapiExport char* ndiErrorString(int errnum)
597599}
598600
599601// ----------------------------------------------------------------------------
600- ndicapiExport char * ndiSerialDeviceName (int i)
602+ ndicapiExport const char * ndiSerialDeviceName (int i)
601603{
602604#if defined(_WIN32)
603605
@@ -649,7 +651,7 @@ ndicapiExport char* ndiSerialDeviceName(int i)
649651 {
650652 strncpy (devicenames[j], " /dev/" , 5 );
651653 strncpy (devicenames[j] + 5 , ep->d_name , 255 );
652- devicenames[j][255 + 5 ] == ' \0 ' ;
654+ devicenames[j][255 + 5 ] = ' \0 ' ;
653655 closedir (dirp);
654656 return devicenames[j];
655657 }
@@ -744,7 +746,6 @@ ndicapiExport int ndiSerialProbe(const char* device, bool checkDSR)
744746 ndiSerialClose (serial_port);
745747 return NDI_BAD_COMM;
746748 }
747-
748749 // flush the buffers (which are unlikely to contain anything)
749750 ndiSerialFlush (serial_port, NDI_IOFLUSH);
750751
@@ -2184,7 +2185,7 @@ namespace
21842185 int newspeed = 9600 ;
21852186 int newhand = 0 ;
21862187
2187- if (command[5 ] >= ' 0' && command[5 ] <= ' 7' || command[5 ] == ' A' )
2188+ if (( command[5 ] >= ' 0' && command[5 ] <= ' 7' ) || command[5 ] == ' A' )
21882189 {
21892190 if (command[5 ] != ' A' )
21902191 {
@@ -2353,17 +2354,17 @@ ndicapiExport char* ndiCommandVA(ndicapi* api, const char* format, va_list ap)
23532354 command[i++] = ' \r ' ; // tack on carriage return
23542355 command[i] = ' \0 ' ; // terminate for good luck
23552356
2356- bool isBinary = (strncmp (command, " BX" , commandLength) == 0 && commandLength == strlen (" BX" ) ||
2357- strncmp (command, " GETLOG" , commandLength) == 0 && commandLength == strlen (" GETLOG" ) ||
2358- strncmp (command, " VGET" , commandLength) == 0 && commandLength == strlen (" VGET" ));
2357+ bool isBinary = (strncmp (command, " BX" , commandLength) == 0 && commandLength == strlen (" BX" )) ||
2358+ ( strncmp (command, " GETLOG" , commandLength) == 0 && commandLength == strlen (" GETLOG" ) ) ||
2359+ ( strncmp (command, " VGET" , commandLength) == 0 && commandLength == strlen (" VGET" ));
23592360
23602361
23612362 // if the command is GX, TX, or BX and thread_mode is on, we copy the reply from
23622363 // the thread rather than getting it directly from the Measurement System
23632364 if (api->IsThreadedMode && api->IsTracking &&
2364- commandLength == 2 && (command[0 ] == ' G' && command[1 ] == ' X' ||
2365- command[0 ] == ' T' && command[1 ] == ' X' ||
2366- command[0 ] == ' B' && command[1 ] == ' X' ))
2365+ commandLength == 2 && (( command[0 ] == ' G' && command[1 ] == ' X' ) ||
2366+ ( command[0 ] == ' T' && command[1 ] == ' X' ) ||
2367+ ( command[0 ] == ' B' && command[1 ] == ' X' ) ))
23672368 {
23682369 // check that the thread is sending the GX/BX/TX command that we want
23692370 if (strcmp (command, api->ThreadCommand ) != 0 )
@@ -2559,7 +2560,7 @@ ndicapiExport char* ndiCommandVA(ndicapi* api, const char* format, va_list ap)
25592560 // check for error code
25602561 if (commandReply[0 ] == ' E' && strncmp (commandReply, " ERROR" , 5 ) == 0 )
25612562 {
2562- ndiSetError (api, ndiHexToUnsignedLong (&commandReply[5 ], 2 ));
2563+ ndiSetError (api, ( int ) ndiHexToUnsignedLong (&commandReply[5 ], 2 ));
25632564 return commandReply;
25642565 }
25652566
@@ -3825,7 +3826,7 @@ static void* ndiThreadFunc(void* userdata)
38253826 }
38263827
38273828 // send the command to the Measurement System
3828- i = strlen (command);
3829+ i = ( int ) strlen (command);
38293830 if (errorCode == 0 )
38303831 {
38313832 if (pol->SerialDevice != NDI_INVALID_HANDLE)
0 commit comments