Skip to content

Commit c952465

Browse files
author
Nick Briggs
committedJun 21, 2013
Refs #101015 Switch from magic number to manifest constant for maximum message bytes
1 parent 841c86b commit c952465

File tree

7 files changed

+8
-10
lines changed

7 files changed

+8
-10
lines changed
 

‎apps/HttpProxy/NetFetch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ ParseReplyHeader(NetRequest nr) {
13741374
static void
13751375
InitBuffer(NetRequest nr) {
13761376
// alloc the buffer and init the msg
1377-
int sz = 8800;
1377+
int sz = CCN_MAX_MESSAGE_BYTES;
13781378
nr->buf = ProxyUtil_Alloc(sz+4, char);
13791379
nr->bufSize = sz;
13801380
nr->iov.iov_base = nr->buf;

‎csrc/ccnr/ccnr_dispatch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ r_dispatch_process_input(struct ccnr_handle *h, int fd)
196196
}
197197
if (fdholder->inbuf->length == 0)
198198
memset(d, 0, sizeof(*d));
199-
buf = ccn_charbuf_reserve(fdholder->inbuf, 8800);
199+
buf = ccn_charbuf_reserve(fdholder->inbuf, CCN_MAX_MESSAGE_BYTES);
200200
memset(&sstor, 0, sizeof(sstor));
201201
if ((fdholder->flags & CCNR_FACE_SOCKMASK) != 0) {
202202
res = recvfrom(fdholder->filedesc, buf, fdholder->inbuf->limit - fdholder->inbuf->length,

‎csrc/ccnr/ccnr_store.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ r_store_content_read(struct ccnr_handle *h, struct content_entry *content)
150150
struct ccn_charbuf *cob = NULL;
151151
ssize_t rres = 0;
152152
int fd = -1;
153-
unsigned char buf[8800];
153+
unsigned char buf[CCN_MAX_MESSAGE_BYTES];
154154
struct ccn_skeleton_decoder decoder = {0};
155155
struct ccn_skeleton_decoder *d = &decoder;
156156
ssize_t dres;
@@ -182,7 +182,7 @@ r_store_content_read(struct ccnr_handle *h, struct content_entry *content)
182182
ccnr_msg(h, "r_store_content_read %u expected %d bytes, but got %d",
183183
fd, (int)content->size, (int)rres);
184184
} else {
185-
rres = pread(fd, buf, 8800, offset); // XXX - should be symbolic
185+
rres = pread(fd, buf, CCN_MAX_MESSAGE_BYTES, offset); // XXX - should be symbolic
186186
if (rres == -1) {
187187
ccnr_msg(h, "r_store_content_read %u :%s (errno = %d)",
188188
fd, strerror(errno), errno);

‎csrc/lib/basicparsetest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
int
4343
main (int argc, char **argv)
4444
{
45-
unsigned char buf[8800];
45+
unsigned char buf[CCN_MAX_MESSAGE_BYTES];
4646
ssize_t size;
4747
struct ccn_face_instance *face_instance;
4848
struct ccn_forwarding_entry *forwarding_entry;

‎csrc/lib/ccn_client.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ ccn_process_input(struct ccn *h)
18341834
h->inbuf = inbuf = ccn_charbuf_create();
18351835
if (inbuf->length == 0)
18361836
memset(d, 0, sizeof(*d));
1837-
buf = ccn_charbuf_reserve(inbuf, 8800);
1837+
buf = ccn_charbuf_reserve(inbuf, CCN_MAX_MESSAGE_BYTES);
18381838
res = read(h->sock, buf, inbuf->limit - inbuf->length);
18391839
if (res == 0) {
18401840
ccn_disconnect(h);

‎csrc/lib/ccnbtreetest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ test_btree_inserts_from_stdin(void)
620620

621621
c = ccn_charbuf_create();
622622
CHKPTR(c);
623-
CHKPTR(ccn_charbuf_reserve(c, 8800));
623+
CHKPTR(ccn_charbuf_reserve(c, CCN_MAX_MESSAGE_BYTES));
624624
while (fgets((char *)c->buf, c->limit, stdin)) {
625625
item++;
626626
c->length = strlen((char *)c->buf);

‎csrc/libexec/udplink.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848

4949
void udplink_fatal(int line, char *format, ...);
5050

51-
#define UDPMAXBUF 8800
52-
5351
#ifdef __CYGWIN__
5452
/* if_nametoindex() is unsupported on cygwin */
5553
unsigned if_nametoindex(const char *ifname) {
@@ -348,7 +346,7 @@ main (int argc, char * const argv[]) {
348346
struct ccn_skeleton_decoder *ld = &ldecoder;
349347
struct ccn_skeleton_decoder rdecoder = {0};
350348
struct ccn_skeleton_decoder *rd = &rdecoder;
351-
unsigned char rbuf[UDPMAXBUF];
349+
unsigned char rbuf[CCN_MAX_MESSAGE_BYTES];
352350
struct ccn_charbuf *charbuf;
353351
ssize_t msgstart = 0;
354352
ssize_t dres;

0 commit comments

Comments
 (0)
Please sign in to comment.