comparison tests/encbr1test.c @ 2074:8cd012260976

Fix a bunch of warnings.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 10 Dec 2018 12:55:29 +0200
parents d5ea82da40ab
children 9807ae37ad69
comparison
equal deleted inserted replaced
2073:1ad8382e3670 2074:8cd012260976
33 const size_t count) 33 const size_t count)
34 { 34 {
35 if (count <= 0) 35 if (count <= 0)
36 return TRUE; 36 return TRUE;
37 37
38 #if BR_DEBUG != 0 || defined(BR_WRITE)
38 Uint8 tmp = count - 1; 39 Uint8 tmp = count - 1;
40 #endif
39 41
40 #if BR_DEBUG == 2 42 #if BR_DEBUG == 2
41 printf("L: %02x ", tmp); 43 printf("L: %02x ", tmp);
42 for (size_t n = 0; n < count; n++) 44 for (size_t n = 0; n < count; n++)
43 printf("%02x ", buf[offs + n]); 45 printf("%02x ", buf[offs + n]);
50 52
51 #ifdef BR_WRITE 53 #ifdef BR_WRITE
52 if (!dmf_write_byte(fp, tmp) || 54 if (!dmf_write_byte(fp, tmp) ||
53 !dmf_write_str(fp, buf + offs, count)) 55 !dmf_write_str(fp, buf + offs, count))
54 return FALSE; 56 return FALSE;
57 #else
58 (void) fp;
55 #endif 59 #endif
56 60
57 return TRUE; 61 return TRUE;
58 } 62 }
59 63
63 const size_t count) 67 const size_t count)
64 { 68 {
65 if (count <= 0) 69 if (count <= 0)
66 return TRUE; 70 return TRUE;
67 71
72 #if BR_DEBUG != 0 || defined(BR_WRITE)
68 Uint8 tmp = ((Uint8) count - 2) ^ 0xff; 73 Uint8 tmp = ((Uint8) count - 2) ^ 0xff;
69 Uint8 data = buf[offs]; 74 Uint8 data = buf[offs];
75 #endif
70 76
71 #if BR_DEBUG == 2 77 #if BR_DEBUG == 2
72 printf("R: %02x %02x [%" DM_PRIu_SIZE_T "]\n", tmp, data, count); 78 printf("R: %02x %02x [%" DM_PRIu_SIZE_T "]\n", tmp, data, count);
73 #elif BR_DEBUG == 1 79 #elif BR_DEBUG == 1
74 mprintbyte(tmp); 80 mprintbyte(tmp);
75 mprintbyte(data); 81 mprintbyte(data);
76 #endif 82 #endif
83
77 #ifdef BR_WRITE 84 #ifdef BR_WRITE
78 if (!dmf_write_byte(fp, tmp) || 85 if (!dmf_write_byte(fp, tmp) ||
79 !dmf_write_byte(fp, data)) 86 !dmf_write_byte(fp, data))
80 return FALSE; 87 return FALSE;
88 #else
89 (void) fp;
81 #endif 90 #endif
82 91
83 return TRUE; 92 return TRUE;
84 } 93 }
85 94
219 228
220 { 229 {
221 int cnt = 0; 230 int cnt = 0;
222 for (size_t xc = 0; xc < sizeof(test); xc++) 231 for (size_t xc = 0; xc < sizeof(test); xc++)
223 { 232 {
224 if (cnt == 0) printf("%04x | ", xc); 233 if (cnt == 0) printf("%04" DM_PRIx_SIZE_T " | ", xc);
225 printf("%02x ", *(test + xc)); 234 printf("%02x ", *(test + xc));
226 if (cnt++ >= 15) { printf("\n"); cnt = 0; } 235 if (cnt++ >= 15) { printf("\n"); cnt = 0; }
227 } 236 }
228 printf("\n\n"); 237 printf("\n\n");
229 238