diff options
| author | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2017-08-17 00:23:07 +0300 |
|---|---|---|
| committer | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2017-08-17 00:23:07 +0300 |
| commit | 761968246f0eed96b26f1b62833e0e5080b9e781 (patch) | |
| tree | 8edce136479018816f803d8b883c1c97c700de3b /busdevice.c | |
| parent | 04fb9f870feffab0c13adbde1b59e531fc3f8fd7 (diff) | |
| parent | 1f684939334775303db6bd150e04b0249a79de63 (diff) | |
| download | SimpleMotionV2-761968246f0eed96b26f1b62833e0e5080b9e781.tar.gz SimpleMotionV2-761968246f0eed96b26f1b62833e0e5080b9e781.zip | |
# Conflicts:
# devicedeployment.c
Diffstat (limited to 'busdevice.c')
| -rw-r--r-- | busdevice.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/busdevice.c b/busdevice.c index b73da3f..4bc0ee0 100644 --- a/busdevice.c +++ b/busdevice.c @@ -137,6 +137,7 @@ static int parseIpAddress(const char *s, char *ip, size_t ipsize, short *port) { const char *ip_end, *port_start; + //ip_end and port_start are pointers to memory area of s, not offsets or indexes to s if (validateIpAddress(s, &ip_end, &port_start) == -1) return -1; @@ -144,7 +145,7 @@ static int parseIpAddress(const char *s, char *ip, size_t ipsize, short *port) if (!ip) return 0; - if (ipsize < ip_end - s + 1) + if (ipsize < (size_t)(ip_end - s + 1)) return -1; memcpy(ip, s, ip_end - s); @@ -182,7 +183,7 @@ smbusdevicehandle smBDOpen( const char *devicename ) //all handles in use if(handle>=SM_MAX_BUSES) return -1; - if(strncmp(devicename,"COM",3) == 0 || strncmp(devicename,"/dev/tty",8) == 0) //use rs232 lib + if(strncmp(devicename,"COM",3) == 0 || strncmp(devicename,"/dev/tty",8) == 0 || strncmp(devicename,"/dev/cu.",8) == 0) //use rs232 lib { BusDevice[handle].comPort=serialPortOpen( devicename, SMBusBaudrate ); if( BusDevice[handle].comPort == -1 ) |
