diff options
author | juryben-fedora <jurybenx+fedora@gmail.com> | 2013-07-09 23:16:59 -0400 |
---|---|---|
committer | juryben-fedora <jurybenx+fedora@gmail.com> | 2013-07-09 23:16:59 -0400 |
commit | c600835ad363f371bee7a11e61f5fbf4d957d58f (patch) | |
tree | 65478a284364f4eb97180b1a138eab4d779ffb46 /testing | |
parent | e680d885d725cbc27ddbbdabe79860d51816f0cb (diff) |
cast parameters to unsigned char and terminal localhost regex without domain
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Messenger_test.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index ea32673d..0fd9c557 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * If it recieves a message from a friend it replies back. | 7 | * If it recieves a message from a friend it replies back. |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/DHT.c ../core/Messenger.c ../nacl/build/$HOSTNAME/lib/amd64/* Messenger_test.c | 10 | * This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/DHT.c ../core/Messenger.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/* Messenger_test.c |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * Command line arguments are the ip and port of a node (for bootstrapping). | 13 | * Command line arguments are the ip and port of a node (for bootstrapping). |
@@ -57,11 +57,11 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | |||
57 | } | 57 | } |
58 | printf("\nOf length: %u with data: %s \n", length, data); | 58 | printf("\nOf length: %u with data: %s \n", length, data); |
59 | 59 | ||
60 | if(length != sizeof("Install Gentoo")) | 60 | if(length != sizeof((uint8_t*)"Install Gentoo")) |
61 | { | 61 | { |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | if(memcmp(data ,"Install Gentoo", sizeof("Install Gentoo")) == 0 ) | 64 | if(memcmp(data , "Install Gentoo", sizeof("Install Gentoo")) == 0 ) |
65 | //if the request contained the message of peace the person is obviously a friend so we add him. | 65 | //if the request contained the message of peace the person is obviously a friend so we add him. |
66 | { | 66 | { |
67 | printf("Friend request accepted.\n"); | 67 | printf("Friend request accepted.\n"); |
@@ -72,7 +72,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | |||
72 | void print_message(int friendnumber, uint8_t * string, uint16_t length) | 72 | void print_message(int friendnumber, uint8_t * string, uint16_t length) |
73 | { | 73 | { |
74 | printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); | 74 | printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); |
75 | m_sendmessage(friendnumber, "Test1", 6); | 75 | m_sendmessage(friendnumber, (uint8_t*)"Test1", 6); |
76 | } | 76 | } |
77 | 77 | ||
78 | int main(int argc, char *argv[]) | 78 | int main(int argc, char *argv[]) |
@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) | |||
85 | m_callback_friendrequest(print_request); | 85 | m_callback_friendrequest(print_request); |
86 | m_callback_friendmessage(print_message); | 86 | m_callback_friendmessage(print_message); |
87 | 87 | ||
88 | m_setinfo("Install Gentoo", sizeof("Install Gentoo"));//The message we send is a message of peace | 88 | m_setinfo((uint8_t*)"Install Gentoo", sizeof((uint8_t*)"Install Gentoo"));//The message we send is a message of peace |
89 | 89 | ||
90 | printf("OUR ID: "); | 90 | printf("OUR ID: "); |
91 | uint32_t i; | 91 | uint32_t i; |
@@ -109,7 +109,7 @@ int main(int argc, char *argv[]) | |||
109 | 109 | ||
110 | while(1) | 110 | while(1) |
111 | { | 111 | { |
112 | m_sendmessage(num, "Test", 5); | 112 | m_sendmessage(num, (uint8_t*)"Test", 5); |
113 | doMessenger(); | 113 | doMessenger(); |
114 | c_sleep(30); | 114 | c_sleep(30); |
115 | } | 115 | } |