Fix type mismatches and remove unused variables in nap plugin
Should just fix compiler warnings.
This commit is contained in:
@@ -224,7 +224,7 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
|
|||||||
|
|
||||||
if (service == SERVICE_SERVER)
|
if (service == SERVICE_SERVER)
|
||||||
{
|
{
|
||||||
int length;
|
socklen_t length;
|
||||||
#ifdef IP_PORTRANGE
|
#ifdef IP_PORTRANGE
|
||||||
int ports;
|
int ports;
|
||||||
#endif
|
#endif
|
||||||
@@ -1593,17 +1593,14 @@ void print_file(FileStruct *f, int count)
|
|||||||
|
|
||||||
NAP_COMM(cmd_fileinfo)
|
NAP_COMM(cmd_fileinfo)
|
||||||
{
|
{
|
||||||
char *nick;
|
|
||||||
char *ip;
|
|
||||||
int port;
|
int port;
|
||||||
char *file;
|
char *file;
|
||||||
char *checksum;
|
|
||||||
int speed;
|
int speed;
|
||||||
nick = next_arg(args, &args);
|
next_arg(args, &args); /* nick, ignored */
|
||||||
ip = next_arg(args, &args);
|
next_arg(args, &args); /* ip, ignored */
|
||||||
port = my_atol(next_arg(args, &args));
|
port = my_atol(next_arg(args, &args));
|
||||||
file = new_next_arg(args, &args);
|
file = new_next_arg(args, &args);
|
||||||
checksum = next_arg(args, &args);
|
next_arg(args, &args); /* checksum, ignored */
|
||||||
speed = my_atol(next_arg(args, &args));
|
speed = my_atol(next_arg(args, &args));
|
||||||
nap_put("Number <20> Song <20> Speed");
|
nap_put("Number <20> Song <20> Speed");
|
||||||
nap_put("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
nap_put("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
|
|||||||
@@ -739,7 +739,6 @@ gato242 3068149784 6699 "d:\mp3\Hackers_-_07_-_Orbital_-_Halcyon_&_On_&_On.mp3"
|
|||||||
*/
|
*/
|
||||||
unsigned short port;
|
unsigned short port;
|
||||||
int getfd = -1;
|
int getfd = -1;
|
||||||
int speed;
|
|
||||||
char *nick, *file, *checksum, *ip, *dir = NULL;
|
char *nick, *file, *checksum, *ip, *dir = NULL;
|
||||||
char *realfile = NULL;
|
char *realfile = NULL;
|
||||||
char indata[2*NAP_BUFFER_SIZE+1];
|
char indata[2*NAP_BUFFER_SIZE+1];
|
||||||
@@ -752,7 +751,7 @@ struct stat st;
|
|||||||
port = my_atol(next_arg(args, &args));
|
port = my_atol(next_arg(args, &args));
|
||||||
file = new_next_arg(args, &args);
|
file = new_next_arg(args, &args);
|
||||||
checksum = next_arg(args, &args);
|
checksum = next_arg(args, &args);
|
||||||
speed = my_atol(args);
|
/* Last argument (speed) ignored */
|
||||||
|
|
||||||
if (!(gf = find_in_getfile(&getfile_struct, 1, nick, checksum, file, -1, NAP_DOWNLOAD)))
|
if (!(gf = find_in_getfile(&getfile_struct, 1, nick, checksum, file, -1, NAP_DOWNLOAD)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ BUILT_IN_FUNCTION(func_connected)
|
|||||||
{
|
{
|
||||||
if (nap_socket > -1)
|
if (nap_socket > -1)
|
||||||
{
|
{
|
||||||
int len;
|
socklen_t len;
|
||||||
struct sockaddr_in name;
|
struct sockaddr_in name;
|
||||||
len = sizeof (name);
|
len = sizeof (name);
|
||||||
if (getpeername(nap_socket, (struct sockaddr *)&name, &len))
|
if (getpeername(nap_socket, (struct sockaddr *)&name, &len))
|
||||||
|
|||||||
@@ -605,17 +605,14 @@ double compute_tpf(AUDIO_HEADER *fr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long get_bitrate(int fdes, time_t *mp3_time, unsigned int *freq_rate, unsigned long *filesize, int *stereo, long *id3, int *mime_type)
|
long get_bitrate(int fdes, time_t *mp3_time, int *freq_rate, unsigned long *filesize, int *stereo, long *id3, int *mime_type)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
AUDIO_HEADER header = {0};
|
AUDIO_HEADER header = {0};
|
||||||
unsigned long btr = 0;
|
unsigned long btr = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
unsigned long head;
|
unsigned long head;
|
||||||
|
unsigned char buf[1025];
|
||||||
unsigned char buf[1025];
|
unsigned char tmp[5];
|
||||||
unsigned char tmp[5];
|
|
||||||
|
|
||||||
if (freq_rate)
|
if (freq_rate)
|
||||||
*freq_rate = 0;
|
*freq_rate = 0;
|
||||||
@@ -627,15 +624,15 @@ unsigned char tmp[5];
|
|||||||
memset(tmp, 0, sizeof(tmp));
|
memset(tmp, 0, sizeof(tmp));
|
||||||
read(fdes, tmp, 4);
|
read(fdes, tmp, 4);
|
||||||
|
|
||||||
if (!strcmp(tmp, "PK\003\004")) /* zip magic */
|
if (!memcmp(tmp, "PK\003\004", 4)) /* zip magic */
|
||||||
return 0;
|
return 0;
|
||||||
if (!strcmp(tmp, "PE") || !strcmp(tmp, "MZ")) /* windows Exe magic */
|
if (!memcmp(tmp, "PE", 2) || !memcmp(tmp, "MZ", 2)) /* windows Exe magic */
|
||||||
return 0;
|
return 0;
|
||||||
if (!strcmp(tmp, "\037\235")) /* gzip/compress */
|
if (!memcmp(tmp, "\037\235", 2)) /* gzip/compress */
|
||||||
return 0;
|
return 0;
|
||||||
if (!strcmp(tmp, "\037\213") || !strcmp(tmp, "\037\036") || !strcmp(tmp, "BZh")) /* gzip/compress/bzip2 */
|
if (!memcmp(tmp, "\037\213", 2) || !memcmp(tmp, "\037\036", 2) || !memcmp(tmp, "BZh", 3)) /* gzip/compress/bzip2 */
|
||||||
return 0;
|
return 0;
|
||||||
if (!strcmp(tmp, "\177ELF")) /* elf binary */
|
if (!memcmp(tmp, "\177ELF", 4)) /* elf binary */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
head = convert_to_header(tmp);
|
head = convert_to_header(tmp);
|
||||||
@@ -1522,20 +1519,16 @@ SocketList *s;
|
|||||||
|
|
||||||
void nap_firewall_start(int snum)
|
void nap_firewall_start(int snum)
|
||||||
{
|
{
|
||||||
GetFile *gf;
|
GetFile *gf;
|
||||||
unsigned char buffer[NAP_BUFFER_SIZE+1];
|
char buffer[NAP_BUFFER_SIZE+1];
|
||||||
SocketList *s;
|
SocketList *s = get_socket(snum);
|
||||||
s = get_socket(snum);
|
|
||||||
if (!s || !(gf = (GetFile *)get_socketinfo(snum)))
|
if (!s || !(gf = (GetFile *)get_socketinfo(snum)))
|
||||||
return;
|
return;
|
||||||
if ((read(snum, buffer, 4)) < 1)
|
if ((read(snum, buffer, 4)) < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
if (!memcmp(buffer, "SEND", 4))
|
||||||
sprintf(buffer, "%s \"%s\" %lu", gf->nick, gf->filename, gf->filesize);
|
|
||||||
write(snum, convertnap_dos(buffer), strlen(buffer));
|
|
||||||
#endif
|
|
||||||
if (*buffer && !strcmp(buffer, "SEND"))
|
|
||||||
s->func_read = napfirewall_pos;
|
s->func_read = napfirewall_pos;
|
||||||
else
|
else
|
||||||
close_socketread(snum);
|
close_socketread(snum);
|
||||||
@@ -1543,15 +1536,15 @@ SocketList *s;
|
|||||||
|
|
||||||
void napfile_read(int snum)
|
void napfile_read(int snum)
|
||||||
{
|
{
|
||||||
GetFile *gf;
|
GetFile *gf;
|
||||||
unsigned char buffer[NAP_BUFFER_SIZE+1];
|
char buffer[NAP_BUFFER_SIZE+1];
|
||||||
int rc;
|
int rc;
|
||||||
SocketList *s;
|
SocketList *s = get_socket(snum);
|
||||||
s = get_socket(snum);
|
|
||||||
if (!(gf = (GetFile *)get_socketinfo(snum)))
|
if (!(gf = (GetFile *)get_socketinfo(snum)))
|
||||||
{
|
{
|
||||||
unsigned char buff[2*NAP_BUFFER_SIZE+1];
|
char buff[2*NAP_BUFFER_SIZE+1];
|
||||||
unsigned char fbuff[2*NAP_BUFFER_SIZE+1];
|
char fbuff[2*NAP_BUFFER_SIZE+1];
|
||||||
char *nick, *filename, *args;
|
char *nick, *filename, *args;
|
||||||
|
|
||||||
alarm(10);
|
alarm(10);
|
||||||
@@ -1624,9 +1617,10 @@ SocketList *s;
|
|||||||
|
|
||||||
void naplink_handleconnect(int snum)
|
void naplink_handleconnect(int snum)
|
||||||
{
|
{
|
||||||
unsigned char buff[2*NAP_BUFFER_SIZE+1];
|
char buff[2*NAP_BUFFER_SIZE+1];
|
||||||
SocketList *s;
|
SocketList *s;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset(buff, 0, sizeof(buff) - 1);
|
memset(buff, 0, sizeof(buff) - 1);
|
||||||
switch ((rc = recv(snum, buff, 4, MSG_PEEK)))
|
switch ((rc = recv(snum, buff, 4, MSG_PEEK)))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user