1:warning: comparison between signed and unsigned integer expressions
解决方法:强制类型转换 前面都加上(int),进行强制类型转换
if (key == NULL || (int)strlen(key) >(int)I_LIMITED_SIMPLE || strlen(key) < 1)
// if (key == NULL || strlen(key) > I_LIMITED_SIMPLE || strlen(key) < 1)
2: warning: ‘unsigned int sdk_req::m_nBufferLength’
添加语句
#define UNUSED_VAR __attribute__ ((unused))
for any variable just use the above macro before its type for example:
如:在原来变量前面添加UNUSED_VAR,即可UNUSED_VAR int a = 2;
static const char* V_REQUEST_STATE_END = "END";
static const char* V_REQUEST_STATE_DOING = "DOING";
UNUSED_VAR static const char* V_REQUEST_STATE_IDLE = "IDLE";
UNUSED_VAR static const char* V_REQUEST_STATE_RELEASE = "RELEASE";
UNUSED_VAR static const char* V_REQUEST_CONNECT_KEEP = "Keep-Alive";
UNUSED_VAR static const char* V_REQUEST_CONNECT_CLOSE = "Close";
3: warning: suggest parentheses around assignment used as truth value
解决方法:在if判断语句中添加个()
if ((tmpLen = atoi(m_reqHttpRequest.GetHttpHeader(H_CONTENT_LENGTH).c_str())) > 0)
// if (tmpLen = atoi(m_reqHttpRequest.GetHttpHeader(H_CONTENT_LENGTH).c_str()) > 0)
4:
../../api/libusc.cpp:662: warning: deprecated conversion from string constant to ‘char*’
../../api/libusc.cpp:664: warning: deprecated conversion from string constant to ‘char*’
../../api/libusc.cpp:666: warning: deprecated conversion from string constant to ‘char*’
5:
Warning: 'typedef' was ignored in this declaration
把 typedef 去掉。。
6:
../../../jni/sdk/sdk_http.h:19: warning: ‘sdk_http::m_nTimeout’ will be initialized after../../../jni/sdk/sdk_http.h:18: warning: ‘ghttp_request* sdk_http::m_pRequest’
../../../jni/sdk/sdk_http.cpp:36: warning: when initialized here
解决方法:初始化顺序引起的, 需要按照 构造函数定义的顺序,进行初始化
初始化列表的顺序应该是按照你成员声明顺序初始化。
7:warning: array subscript has type ‘char’
主要错误地方是:这个warning是说,数组的下标被定义成char型了,由于char型有可能是负数,因此会产生难以 预料的错误。
修改:使用无符号类型替代有符号类型。
解决方法:加入unsigned int