Changeset 72 in libcf
- Timestamp:
- 04/15/13 10:02:52 (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cf_codec.c
r68 r72 17 17 #define IS_UPPERCASE(x) (x >= 'A' && x <= 'F') 18 18 19 typedef unsigned char __uchar; 20 19 21 /** 20 22 * 바이너리 데이터를 16진수 문자열로 변환 … … 33 35 char * hex) 34 36 { 35 size_t iter = 0;36 size_t count = len * 2 + 1;37 size_t iter = 0; 38 size_t count = len * 2 + 1; 37 39 38 c har hexchar[] = {'0', '1', '2', '3',39 '4', '5', '6', '7',40 '8', '9', 'a', 'b',41 'c', 'd', 'e', 'f'};40 const char hexchar[] = {'0', '1', '2', '3', 41 '4', '5', '6', '7', 42 '8', '9', 'a', 'b', 43 'c', 'd', 'e', 'f'}; 42 44 43 const unsignedchar * ptr = bin;45 const __uchar * ptr = bin; 44 46 45 47 ASSERT_ARGS (bin == NULL); … … 72 74 size_t * len) 73 75 { 74 typedef unsigned char __uchar;75 76 76 int result = 0; 77 77 -
trunk/test/codec.c
r70 r72 16 16 size_t length = 0; 17 17 18 CF_DEBUG_PRINT (stderr, " = Convert binary to hex = \n"); 18 CF_DEBUG_PRINT (stderr, "data : %s\n", data); 19 CF_DEBUG_PRINT (stderr, "= Convert binary to hex =\n"); 19 20 CF_Codec_BinaryToHex ((unsigned char *)data, strlen (data), hex); 20 CF_DEBUG_PRINT (stderr, "data : %s\n", data); 21 CF_DEBUG_PRINT (stderr, "hex : %s\n", hex); 22 CF_DEBUG_PRINT_BIN (stderr, (unsigned char *) data, strlen (data), "data : %s\n", data); 21 CF_DEBUG_PRINT (stderr, "hex : %s\n", hex); 22 CF_DEBUG_PRINT_BIN (stderr, (unsigned char *) data, strlen (data), "data : %s\n", data); 23 23 24 CF_DEBUG_PRINT (stderr, " = Convert hex to binary =\n");24 CF_DEBUG_PRINT (stderr, "= Convert hex to binary =\n"); 25 25 CF_Codec_HexToBinary (hex, bin, &length); 26 CF_DEBUG_PRINT (stderr, "bin : %s\n", bin); 27 CF_DEBUG_PRINT_BIN (stderr, bin, length, "bin : %s\n", bin); 26 CF_DEBUG_PRINT_BIN (stderr, bin, length, "bin : %s\n", bin); 28 27 29 28 return 0; -
trunk/test/test.c
r70 r72 238 238 CF_Log_Write (LOG_SOCKET, "SERVER", "accepted\n"); 239 239 240 for (i = 0 ; i < 10 0; i++)240 for (i = 0 ; i < 10 ; i++) 241 241 { 242 242 if ((recvd = CF_Socket_Recv (clntsock, buf, sizeof (buf))) < 0) … … 246 246 } 247 247 CF_Log_Write (LOG_SOCKET, "SERVER", "recv {%s}\n", buf); 248 CF_DEBUG_PRINT (stderr, "[SERVER] recv {%s}\n", buf); 248 249 249 250 if (CF_Socket_Send (clntsock, buf, recvd) < 0) … … 252 253 } 253 254 CF_Log_Write (LOG_SOCKET, "SERVER", "resp {%s}\n", buf); 255 CF_DEBUG_PRINT (stderr, "[SERVER] resp {%s}\n", buf); 254 256 } 255 257 … … 278 280 CF_Log_Write (LOG_SOCKET, "CLIENT", "connected\n"); 279 281 280 for (i = 0 ; i < 10 0; i++)282 for (i = 0 ; i < 10 ; i++) 281 283 { 282 284 if (CF_Socket_Send (sock, buf, sizeof (buf)) < 0) … … 286 288 } 287 289 CF_Log_Write (LOG_SOCKET, "CLIENT", "sent {%s}\n", buf); 290 CF_DEBUG_PRINT (stderr, "[CLIENT] sent {%s}\n", buf); 288 291 289 292 memset (buf, 0x00, sizeof (buf)); … … 295 298 } 296 299 CF_Log_Write (LOG_SOCKET, "CLIENT", "recv {%s}\n", buf); 300 CF_DEBUG_PRINT (stderr, "[CLIENT] recv {%s}\n", buf); 297 301 } 298 302 … … 387 391 size_t length = 0; 388 392 389 CF_DEBUG_PRINT (stderr, " = Convert binary to hex = \n"); 393 CF_DEBUG_PRINT (stderr, "data : %s\n", data); 394 CF_DEBUG_PRINT (stderr, "= Convert binary to hex =\n"); 390 395 CF_Codec_BinaryToHex ((unsigned char *)data, strlen (data), hex); 391 CF_DEBUG_PRINT (stderr, "data : %s\n", data); 392 CF_DEBUG_PRINT (stderr, "hex : %s\n", hex); 393 CF_DEBUG_PRINT_BIN (stderr, (unsigned char *) data, strlen (data), "data : %s\n", data); 394 395 CF_DEBUG_PRINT (stderr, " = Convert hex to binary = \n"); 396 CF_DEBUG_PRINT (stderr, "hex : %s\n", hex); 397 CF_DEBUG_PRINT_BIN (stderr, (unsigned char *) data, strlen (data), "data : %s\n", data); 398 399 CF_DEBUG_PRINT (stderr, "= Convert hex to binary =\n"); 396 400 CF_Codec_HexToBinary (hex, bin, &length); 397 CF_DEBUG_PRINT (stderr, "bin : %s\n", bin); 398 CF_DEBUG_PRINT_BIN (stderr, bin, length, "bin : %s\n", bin); 399 } 401 CF_DEBUG_PRINT_BIN (stderr, bin, length, "bin : %s\n", bin); 402 }
Note:
See TracChangeset
for help on using the changeset viewer.