mirror of
https://github.com/lxsang/ant-http
synced 2024-12-26 00:38:21 +01:00
remove warning
This commit is contained in:
parent
b72ea610c7
commit
0e84e46fab
@ -145,7 +145,7 @@ char* ext(const char* file)
|
|||||||
if(file == NULL) return NULL;
|
if(file == NULL) return NULL;
|
||||||
char* str_cpy = strdup(file);
|
char* str_cpy = strdup(file);
|
||||||
char* str_org = str_cpy;
|
char* str_org = str_cpy;
|
||||||
if(strstr(str_cpy,".")<= 0)
|
if(!strstr(str_cpy,"."))
|
||||||
{
|
{
|
||||||
free(str_org);
|
free(str_org);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
33
libs/ws.c
33
libs/ws.c
@ -95,7 +95,7 @@ int ws_read_data(void* client, ws_msg_header_t* header, int len, uint8_t* data)
|
|||||||
{
|
{
|
||||||
// if len == -1 ==> read all remaining data to 'data';
|
// if len == -1 ==> read all remaining data to 'data';
|
||||||
if(header->plen == 0) return 0;
|
if(header->plen == 0) return 0;
|
||||||
int dlen = (len==-1 || len > (int)header->plen)?header->plen:len;
|
int dlen = (len==-1 || len > (int)header->plen)?(int)header->plen:len;
|
||||||
if((dlen = antd_recv(client,data, dlen)) <0) return -1;
|
if((dlen = antd_recv(client,data, dlen)) <0) return -1;
|
||||||
header->plen = header->plen - dlen;
|
header->plen = header->plen - dlen;
|
||||||
// unmask received data
|
// unmask received data
|
||||||
@ -220,24 +220,21 @@ void ws_send_file(void* client, const char* file, int mask)
|
|||||||
while(!feof(ptr))
|
while(!feof(ptr))
|
||||||
{
|
{
|
||||||
size = fread(buff,1,1024,ptr);
|
size = fread(buff,1,1024,ptr);
|
||||||
if(size >= 0)
|
if(feof(ptr))
|
||||||
|
header.fin = 1;
|
||||||
|
else
|
||||||
|
header.fin = 0;
|
||||||
|
// clear opcode
|
||||||
|
if(first_frame)
|
||||||
{
|
{
|
||||||
if(feof(ptr))
|
header.opcode = WS_BIN;
|
||||||
header.fin = 1;
|
first_frame = 0;
|
||||||
else
|
}
|
||||||
header.fin = 0;
|
else
|
||||||
// clear opcode
|
header.opcode = 0;
|
||||||
if(first_frame)
|
header.plen = size;
|
||||||
{
|
//printf("FIN: %d OC:%d\n", header.fin, header.opcode);
|
||||||
header.opcode = WS_BIN;
|
ws_send_frame(client,buff,header);
|
||||||
first_frame = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
header.opcode = 0;
|
|
||||||
header.plen = size;
|
|
||||||
//printf("FIN: %d OC:%d\n", header.fin, header.opcode);
|
|
||||||
ws_send_frame(client,buff,header);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(ptr);
|
fclose(ptr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user