Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: sip.cpp
- Revision:
- 50:d9b6577a70f5
- Parent:
- 48:195c97f12e8e
- Child:
- 74:81c47fff88a5
--- a/sip.cpp Mon Oct 20 16:32:12 2014 +0000 +++ b/sip.cpp Mon Oct 20 19:28:38 2014 +0000 @@ -53,7 +53,7 @@ if( debug_sip ) debug_msg("Failed to open /qspi/serverip.txt" ); strncpy( this->server_ip, __SERVER_IP__, 20 ); }else{ - char tmp[ 16 ]; + char tmp[ 16 ] = "\0"; int read = fread( tmp, 1, 15, fp ); if( read > 0 ){ for( int i = 0; i < read; i++ ) @@ -62,15 +62,14 @@ break; } strcpy( this->server_ip, tmp ); - if( debug_sip ) debug_msg("Objeto SIP fixado no server ip %s", this->server_ip ); + if( debug_sip ) debug_msg("Objeto SIP fixado no server ip %s( read %d chars ), valid %d", this->server_ip, read, strlen( this->server_ip ) ); }else{ if( debug_sip ) debug_msg("Failed to read /qspi/serverip.txt" ); strncpy( this->server_ip, __SERVER_IP__, 20 ); } } fclose( fp ); - this->server_ip[ 15 ] = 0; - + this->server_ip[ 15 ] = '\0'; fp = fopen( "/qspi/serverport.txt", "r"); if( fp == NULL ){ @@ -92,7 +91,7 @@ if( debug_sip ) debug_msg("Failed to open /qspi/myip.txt" ); strncpy( this->my_ip, __MY_IP__, 20 ); }else{ - char tmp[ 20 ]; + char tmp[ 16 ] = "\0"; int read = fread( tmp, 1, 15, fp ); if( read > 0 ){ for( int i = 0; i < read; i++ ) @@ -101,7 +100,7 @@ break; } strcpy( this->my_ip, tmp ); - if( debug_sip ) debug_msg("Objeto SIP fixado no ip %s", this->my_ip ); + if( debug_sip ) debug_msg("Objeto SIP fixado no ip %s( lidos %d chars ), valid %d", this->my_ip, read, strlen( this->my_ip ) ); }else{ if( debug_sip ) debug_msg("Failed to read /qspi/myip.txt" ); strncpy( this->my_ip, __MY_IP__, 20 ); @@ -109,7 +108,7 @@ } fclose( fp ); - this->my_ip[ 15 ] = 0; + this->my_ip[ 15 ] = '\0'; this->my_port = my_port; this->my_rtp_port = fill_random_rtp_port();