GIDForums  

Go Back   GIDForums > Computer Forums > Computer Software Forum - Linux
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Jan-2008, 00:55
nasim751 nasim751 is offline
New Member
 
Join Date: Jan 2008
Posts: 12
nasim751 is on a distinguished road
Question

warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


hello Dave,
Thanks for your previous answer. I have few number of warning. some already solved but this can't come out. all are same problem. please see my code.

void
pt_delete(struct pt_context *pt, struct tcp_connection *c)
{
u_char key[KEY_BYTES];

/* if the trie is empty, just return */
if (pt->head == NULL)
{
return;
}

memset(key, NULL, KEY_BYTES);
pt_make_key(key, c);

/* call the recursive search and delete function */
if (pt_remove_r(pt, pt->head, key, NULL))
{
/*
* If we just deleted the last connection record in the trie
* then remove the last node so we have a totally empty trie.
*/
if (pt->n == 1 && (int)(pt->head->con) == CON_REMOVED)
{
free(pt->head);
pt->head = NULL;
pt->n = 0;
}
}
}
/**********************************/
int
pt_find(struct pt_context *pt, struct tcp_connection *c,
struct tcp_connection **rc)
{
u_char key[KEY_BYTES];
struct pt_node *rn;
int r;

if (pt->head == NULL)
{

*rc = NULL;
return (0);
}

/* get a key for this connection */
memset(key, NULL, KEY_BYTES);
pt_make_key(key, c);

rn = NULL;
r = pt_search_r(pt->head, key, &rn);

*rc = rn->con;

return (r);
}
/********************/
int
pt_insert(struct pt_context *pt, struct tcp_connection *c)
{
struct pt_node *rn = NULL;
u_char key1[KEY_BYTES], key2[KEY_BYTES];
int b;

if (pt->head == NULL)
{
/* make a new head node */
pt->head = pt_new(MIN_KEY_BIT -1, NULL, NULL, c);
if (pt->head == NULL)
{
perror("pt_insert(): malloc(): ");
return (0);
}
else
{
/* increment node counter and return success */
pt->n++;
return (1);
}
}
else
{
memset(key1, NULL, KEY_BYTES);
pt_make_key(key1, c);

switch (pt_search_r(pt->head, key1, &rn))
{
case 0:
memset(key2, NULL, KEY_BYTES);
pt_make_key(key2, rn->con);

/* find the first differing bit, and its value */
rn->bit = diff_bit(key1, key2, &b);

if (((b ? rn->r : rn->l) == pt_new(MIN_KEY_BIT - 1, NULL, NULL, c)) == 0)
{
return (0);
}

if (((b ? rn->l : rn->r) == pt_new(MIN_KEY_BIT - 1, NULL, NULL, rn->con)) == 0)
{
free(b ? rn->r : rn->l);
return (0);
}
rn->con = NULL;

pt->n += 2;
return (1);
case 1:
return (2);
}
}
return (0);
}


All are same problem.
warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast
  #2  
Old 30-Jan-2008, 08:10
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,621
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


Quote:
Originally Posted by nasim751
hello Dave,
Thanks for your previous answer...
All are same problem.warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast
Did you actually look at my previous answer? The part where I explained about NULL? Did you actually look (yes, look) at the code?

What is argument 2 of the memset statements that you posted?
What is the declared data type of the second parameter of memset?
What is NULL?

Sigh...

Regards,

Dave

Footnote: Since this is a continuation of your previous post, it is not (that's not) necessary to create a new thread.
  #3  
Old 30-Jan-2008, 17:25
nasim751 nasim751 is offline
New Member
 
Join Date: Jan 2008
Posts: 12
nasim751 is on a distinguished road

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


hello.
i already solved this problem. this problem was same like before [NULL instate of 0]
Thanks for your reply. But why i am not getting out put after compile.
Regards
Nasim
warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast
  #4  
Old 30-Jan-2008, 18:02
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,621
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


Quote:
Originally Posted by nasim751
...why...

1. SInce I have no way of knowing what you changed, there is no way that I could guess at what your program looks like.

2. I hate to repeat myself, but:

Quote:
Originally Posted by davekw7x
Instead of just saying, "no output...," you might consider giving us a little narrative about what the program is supposed to do. That is: What did you expect to see? How did you invoke the program (command-line arguments)? Stuff like that.

Maybe you didn't get it, but my question to you is, "What did you expect to happen?"

Or are we supposed to guess at that too?

Regards,

Dave
  #5  
Old 30-Jan-2008, 19:51
nasim751 nasim751 is offline
New Member
 
Join Date: Jan 2008
Posts: 12
nasim751 is on a distinguished road

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


Hello Dave,
i know you are busy guy. Actually using this i want to exhibits the network intrusion detection for defensive technique. it is a port scan detection tool that attempts to identify TCP port scans to open ports across a network segment by using a state transition analysis of TCP session initiation and teardown.
Basically this program will capture the TCP packets. when it sees SYN|ACK, it adds the connection to its database using (lpcap and lnet library) which already i install my system. here i will use my IP address and this program will check.
Regards
Nasim
  #6  
Old 30-Jan-2008, 21:31
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,621
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


Quote:
Originally Posted by nasim751
Hello Dave,
Actually using this i want t...
Thank you for that, at least.

However...

Well, I have asked you twice:
Quote:
Originally Posted by davekw7x
What did you expect to see? How did you invoke the program (command-line arguments)? Stuff like that.

My point here is to try to help you learn to help yourself. If you can't/won't even tell me what you are expecting and how you are invoking the program, I just can't see how. I am out of ideas.

I perceive that I am failing, and I don't see any way that I can do any more.

I don't know why you choose not to reply to my request. I see you posting at a number of sites on the web. That's OK with me, but so far I haven't seen much effort on your part in trying to learn how to fix your problems. Maybe you can go to whoever it is that wrote the code and ask that person.

I won't be responding again. Maybe the other guys on the other sites have more stamina, but I am just about out of steam. I'm sorry, but I'm done.


Regards,

Dave

"Over and out"
  #7  
Old 30-Jan-2008, 23:54
nasim751 nasim751 is offline
New Member
 
Join Date: Jan 2008
Posts: 12
nasim751 is on a distinguished road

Re: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast


Hello Dave,
Again thanks for this much help. any how i over come all the problem. now successfully getting actual result. Again many many thanks.
Regards
Nasim Ahmed
Research Student
Computer Engineering (Network Security)
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
Pointer Usage in C++: Beginner to Advanced varunhome CPP / C++ Forum 0 19-Aug-2005 09:25
[Tutorial] Pointers in C (Part II) Stack Overflow C Programming Language 0 27-Apr-2005 17:36
passing arg 1 of `write' makes integer from pointer withouta cast lung_sen C Programming Language 2 28-Mar-2005 21:10
My program can run,but warning were display on Vc++ fwongmc C Programming Language 5 08-Dec-2004 10:15

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:16.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.