[or-cvs] Note byte-order on result for parse_addr_port()

Nick Mathewson nickm at seul.org
Tue Oct 12 16:02:18 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv27731/src/or

Modified Files:
	test.c 
Log Message:
Note byte-order on result for parse_addr_port()

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- test.c	12 Oct 2004 15:48:30 -0000	1.122
+++ test.c	12 Oct 2004 16:02:15 -0000	1.123
@@ -640,12 +640,12 @@
   cp = NULL; u32 = 3; u16 = 3;
   test_assert(!parse_addr_port("1.2.3.4", &cp, &u32, &u16));
   test_streq(cp, "1.2.3.4");
-  test_eq(u32, 0x01020304u);
+  test_eq(u32, htonl(0x01020304u));
   test_eq(u16, 0);
   tor_free(cp);
   test_assert(!parse_addr_port("4.3.2.1:99", &cp, &u32, &u16));
   test_streq(cp, "4.3.2.1");
-  test_eq(u32, 0x04030201u);
+  test_eq(u32, htonl(0x04030201u));
   test_eq(u16, 99);
   tor_free(cp);
   test_assert(!parse_addr_port("nonexistent.address:4040", &cp, NULL, &u16));
@@ -654,7 +654,7 @@
   tor_free(cp);
   test_assert(!parse_addr_port("localhost:9999", &cp, &u32, &u16));
   test_streq(cp, "localhost");
-  test_eq(u32, 0x7f000001u);
+  test_eq(u32, htonl(0x7f000001u));
   test_eq(u16, 9999);
   tor_free(cp);
   u32 = 3;



More information about the tor-commits mailing list