[Bugfix][API-1551[network] lynq_set_vlan_info, vlan_info is "", ret
8004
Affected branch: unknown
Affected module: unknown
Is it affected on both ZXIC and MTK: both
Self-test: Yes
Doc Update: No
Change-Id: Icb6e6fffdff8436798d54ba67f47d537fe475e24
diff --git a/common_src/lib/liblynq-call/lynq_call_rtp.cpp b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
index 05b3032..092a85c 100755
--- a/common_src/lib/liblynq-call/lynq_call_rtp.cpp
+++ b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
@@ -33,6 +33,17 @@
return strndup16to8(s16, stringlen);
}
+int is_whitespace_only(const char *str) {
+ while (*str != '\0') {
+ if (!isspace((unsigned char)*str)) {
+ return 0;
+ }
+ str++;
+ }
+ return 1;
+}
+
+
/*set*/
int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)
{
@@ -62,9 +73,9 @@
LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
return LYNQ_E_CONFLICT;
}
- if (NULL == ip)
+ if (NULL == ip || is_whitespace_only(ip))
{
- LYERRLOG("ip is NULL!!!");
+ LYERRLOG("ip is NULL or white space string !!!");
return LYNQ_E_PARAMETER_ANONALY;
}
if ((ip_length < strlen(ip)+1) || (ip_length > MAX_IP_LENGTH))
@@ -94,15 +105,24 @@
LYERRLOG("vlan_info is NULL!!!");
return LYNQ_E_PARAMETER_ANONALY;
}
-
- if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))
- {
- LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);
- return LYNQ_E_PARAMETER_ANONALY;
- }
Parcel* p=NULL;
- int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);
+ int ret;
+
+ if(is_whitespace_only(vlan_info))
+ {
+ ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,0,"");
+ }
+ else
+ {
+ if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))
+ {
+ LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+ ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);
+ }
+
if(ret==RESULT_OK)
{
delete p;