author | mjm <mjm> | 2003-01-05 11:18:27 (UTC) |
---|---|---|
committer | mjm <mjm> | 2003-01-05 11:18:27 (UTC) |
commit | 3eecce3109b543a5abd6a36a420fa3f53cc23023 (patch) (unidiff) | |
tree | 5e92d6ec8a4ebc58822bed5de48706ed51a7ebd0 /noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | |
parent | 4f45c61a4e778a8124ae362dd5339b329b171441 (diff) | |
download | opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.zip opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.tar.gz opie-3eecce3109b543a5abd6a36a420fa3f53cc23023.tar.bz2 |
general code cleanup, wrote configfileparser, ...
Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc index 664ba92..67dfc02 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc | |||
@@ -15,6 +15,7 @@ int add_field(char *buffer, const char *string, int len) | |||
15 | char newlen[5]; | 15 | char newlen[5]; |
16 | 16 | ||
17 | /* 3 Byte = Length */ | 17 | /* 3 Byte = Length */ |
18 | memset(newlen, 0, sizeof(newlen)); | ||
18 | snprintf(newlen, sizeof(newlen) - 1, "%.3d", len); | 19 | snprintf(newlen, sizeof(newlen) - 1, "%.3d", len); |
19 | memcpy(buffer, newlen, 3); | 20 | memcpy(buffer, newlen, 3); |
20 | 21 | ||
@@ -30,11 +31,11 @@ int get_field(const char *buffer, char *out, int maxlen) | |||
30 | char len[5]; | 31 | char len[5]; |
31 | 32 | ||
32 | /* Get length of value */ | 33 | /* Get length of value */ |
34 | memset(len, 0, sizeof(len)); | ||
33 | memcpy(len, buffer, 3); | 35 | memcpy(len, buffer, 3); |
34 | 36 | ||
35 | /* Copy buffer to out pointer */ | 37 | /* Copy buffer to out pointer */ |
36 | memset(out, 0, maxlen); | 38 | memset(out, 0, maxlen); |
37 | |||
38 | if(atoi(len) > maxlen -1) | 39 | if(atoi(len) > maxlen -1) |
39 | memcpy(out, buffer + 3, maxlen - 1); | 40 | memcpy(out, buffer + 3, maxlen - 1); |
40 | else | 41 | else |
@@ -53,6 +54,8 @@ int send_network_found (const char *guihost, int guiport, void *structure) | |||
53 | 54 | ||
54 | ptr = (wl_network_t *)structure; | 55 | ptr = (wl_network_t *)structure; |
55 | 56 | ||
57 | memcpy(buffer, 0, sizeof(buffer)); | ||
58 | |||
56 | /* Type = Found new net (without length field) */ | 59 | /* Type = Found new net (without length field) */ |
57 | memset(temp, 0, sizeof(temp)); | 60 | memset(temp, 0, sizeof(temp)); |
58 | snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND); | 61 | snprintf(temp, sizeof(temp), "%.2d", WL_NETFOUND); |