Print this page
11227 smb code needs smatch fixes
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/smbsrv/test-msgbuf/test_main.c
+++ new/usr/src/cmd/smbsrv/test-msgbuf/test_main.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
14 + * Copyright 2019 Joyent, Inc.
14 15 */
15 16
16 17 /*
17 18 * Test & debug program for smb_msgbuf.c and smb_mbuf_marshaling.c
18 19 */
19 20
20 21 #include <sys/types.h>
21 22 #include <sys/debug.h>
22 23
23 24 #include <stdio.h>
24 25 #include <stdlib.h>
25 26 #include <string.h>
26 27 #include <strings.h>
27 28 #include <unistd.h>
28 29
29 30 #include "test_defs.h"
30 31
31 32
32 33 int
33 34 main(int argc, char *argv[])
34 35 {
35 36
36 37 test_conv();
37 38 test_mbmarshal();
38 39 test_msgbuf();
39 40
40 41 return (0);
41 42 }
42 43
43 44 void
44 45 hexdump(const uchar_t *buf, int len)
45 46 {
46 47 int idx;
47 48 char ascii[24];
48 49 char *pa = ascii;
49 50
50 51 memset(ascii, '\0', sizeof (ascii));
51 52
52 53 idx = 0;
53 54 while (len--) {
54 55 if ((idx & 15) == 0) {
55 56 printf("%04X: ", idx);
56 57 pa = ascii;
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
57 58 }
58 59 if (*buf > ' ' && *buf <= '~')
59 60 *pa++ = *buf;
60 61 else
61 62 *pa++ = '.';
62 63 printf("%02x ", *buf++);
63 64
64 65 idx++;
65 66 if ((idx & 3) == 0) {
66 67 *pa++ = ' ';
67 - putchar(' ');
68 + (void) putchar(' ');
68 69 }
69 70 if ((idx & 15) == 0) {
70 71 *pa = '\0';
71 72 printf("%s\n", ascii);
72 73 }
73 74 }
74 75
75 76 if ((idx & 15) != 0) {
76 77 *pa = '\0';
77 78 /* column align the last ascii row */
78 79 while ((idx & 15) != 0) {
79 80 if ((idx & 3) == 0)
80 - putchar(' ');
81 + (void) putchar(' ');
81 82 printf(" ");
82 83 idx++;
83 84 }
84 85 printf("%s\n", ascii);
85 86 }
86 87 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX