summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-28 15:28:49 (UTC)
committer mjm <mjm>2002-12-28 15:28:49 (UTC)
commit94ac3da47b0b36316cff680d319dab23c9339308 (patch) (side-by-side diff)
tree5161a4da84fb05c53fd5225be5674ab75087ff3f
parent0ab4ac99bead80d8af18988045748fd2b3dd3a15 (diff)
downloadopie-94ac3da47b0b36316cff680d319dab23c9339308.zip
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.gz
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.bz2
cleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc46
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh2
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc6
3 files changed, 23 insertions, 31 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index 5317f52..ae6d406 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -45,7 +45,4 @@ int send_network_found (const char *guihost, int guiport, void *structure)
wl_network_t *ptr;
- char buffer[2048];
- char temp[128];
- int retval=0, len=0;
-
- memset(temp, 0, sizeof(temp));
+ char buffer[2048], temp[5];
+ int len = 0;
@@ -62,4 +59,3 @@ int send_network_found (const char *guihost, int guiport, void *structure)
snprintf(temp, sizeof(temp), "%d", ptr->net_type);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
@@ -68,4 +64,3 @@ int send_network_found (const char *guihost, int guiport, void *structure)
snprintf(temp, sizeof(temp), "%.2d", ptr->channel);
- retval = add_field(buffer + len, temp, 2);
- len += retval;
+ len += add_field(buffer + len, temp, 2);
@@ -74,11 +69,12 @@ int send_network_found (const char *guihost, int guiport, void *structure)
snprintf(temp, sizeof(temp), "%d", ptr->wep);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
/* Set Mac */
- retval = add_field(buffer + len, ptr->mac, 17);
- len += retval;
+ len += add_field(buffer + len, ptr->mac, 17);
/* Set ssid */
- retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len);
+ if(len + ptr->ssid_len < sizeof(buffer) - 1)
+ len += add_field(buffer + len, ptr->bssid, ptr->ssid_len);
+ else
+ len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1);
@@ -96,4 +92,4 @@ int get_network_found (void *structure, const char *buffer)
wl_network_t *ptr;
- char temp[512];
- int retval=0, len=0;
+ char temp[5];
+ int len = 0;
@@ -101,9 +97,8 @@ int get_network_found (void *structure, const char *buffer)
- /* packet type already determined */
+ /* packet type already determined, skip check */
len += 2;
- /* Get net type */
+ /* Get net type (accesspoint || ad-hoc || ...) */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->net_type = atoi(temp);
@@ -112,4 +107,3 @@ int get_network_found (void *structure, const char *buffer)
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->channel = atoi(temp);
@@ -118,4 +112,3 @@ int get_network_found (void *structure, const char *buffer)
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->wep = atoi(temp);
@@ -123,7 +116,6 @@ int get_network_found (void *structure, const char *buffer)
/* Set MAC address */
- retval = get_field(buffer + len, ptr->mac);
- len += retval;
+ len += get_field(buffer + len, ptr->mac);
/* Set BSSID */
- retval = get_field(buffer + len, ptr->bssid);
+ len += get_field(buffer + len, ptr->bssid);
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
index f755589..a196091 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
@@ -24,3 +24,3 @@ typedef struct {
char mac[64]; /* MAC address of Accesspoint */
- char bssid[128]; /* BSSID of Accesspoint */
+ char bssid[128]; /* BSSID of Net */
} wl_network_t;
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
index 4942fba..db6b7b8 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
@@ -15,3 +15,3 @@ int wl_setupsock(const char *host, int port)
- if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
@@ -55,3 +55,3 @@ int wl_send(const char *host, int port, const char *string, ...)
/* Setup socket */
- if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
@@ -78,3 +78,3 @@ int wl_recv(int *sock, char *out, int maxlen)
struct sockaddr_in *cliaddr;
- socklen_t len=sizeof(struct sockaddr);
+ socklen_t len = sizeof(struct sockaddr);
char retval[3];