MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / dump2_log

Function dump2_log

src/log.c:287–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void dump2_log(const void *dump_1, const void *dump_2, const unsigned int lng)
288{
289#ifndef DISABLED_FOR_FRAMAC
290 const char *ptr1=(const char*)dump_1;
291 const char *ptr2=(const char*)dump_2;
292 const unsigned int nbr_line=(lng+0x08-1)/0x08;
293 unsigned int i,j;
294 /* write dump to log file*/
295 /*@
296 @ loop invariant 0 <= i <= nbr_line;
297 @ loop assigns *log_handle, f_status, i, j;
298 @ loop variant nbr_line - i;
299 @*/
300 for (i=0; i<nbr_line; i++)
301 {
302 log_info("%04X ",i*0x08);
303 /*@
304 @ loop invariant 0 <= j <= 8;
305 @ loop assigns *log_handle, f_status, j;
306 @ loop variant 0x8 - j;
307 @*/
308 for(j=0; j<0x08;j++)
309 {
310 const unsigned int o=i*0x08+j;
311 if(o<lng)
312 {
313 log_info("%02x", ptr1[o]);
314 }
315 else
316 log_info(" ");
317 if(j%4==(4-1))
318 log_info(" ");
319 }
320 log_info(" ");
321 /*@
322 @ loop invariant 0 <= j <= 8;
323 @ loop assigns *log_handle, f_status, j;
324 @ loop variant 0x8 - j;
325 @*/
326 for(j=0; j<0x08;j++)
327 {
328 const unsigned int o=i*0x08+j;
329 if(o<lng)
330 {
331 const char car=ptr1[o];
332 if (car<32 || car >= 127)
333 log_info(".");
334 else
335 log_info("%c", car);
336 }
337 else
338 log_info(" ");
339 }
340 log_info(" ");
341 /*@
342 @ loop invariant 0 <= j <= 8;
343 @ loop assigns *log_handle, f_status, j;
344 @ loop variant 0x8 - j;

Callers 7

ntfs_dumpFunction · 0.85
dump_NTFSFunction · 0.85
exFAT_dumpFunction · 0.85
fat32_dumpFunction · 0.85
write_part_gptFunction · 0.85
dump_fat32Function · 0.85
hfs_dumpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected