Skip to content

Commit

Permalink
large file support added
Browse files Browse the repository at this point in the history
  • Loading branch information
candicenonsense committed Jul 5, 2015
1 parent 6c8f854 commit 397ee43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion map_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ processed_file_t *process_file(const char *fname) {

mfile->buffer = (uint8_t*)alloc_check(ALLOC_ZERO,sizeof(uint8_t)*file_stat.st_size, "read_file", "mfile", ERROR_EXIT);
is->read((char*)mfile->buffer,file_stat.st_size);
int res=is->gcount();
uint64_t res=is->gcount();
if( res != file_stat.st_size) {
fprintf( stderr, "read failed: %s.\n", strerror( errno));
free( mfile);
Expand Down
11 changes: 5 additions & 6 deletions nullfinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ g++ -std=c++0x -o nullf nullfinder.cc map_file.cc error.cc



#define VERSION "nullfind 0.1 by Candice Quates May 2015"
#define VERSION "nullfind 0.2 by Candice Quates July 2015"


#include "util.h"
Expand Down Expand Up @@ -108,14 +108,13 @@ std::cout <<"null size "<< nullssize << std::endl;
int error=0;
std::cout << "nullf processing: "<< filename << std::endl;
uint8_t current=0;
// There is some integer size mismatching to be fixed here.
int range=0;
int nullcount=0;
int startaddr=0;
uint64_t range=0;
uint64_t nullcount=0;
uint64_t startaddr=0;
// I am well aware that there are prettier and more
// elegant ways to do this, but this is much faster
// than I expected it to be (ie, a few minutes on a VM for 2gb file)
for (int n=0; n < mfile->size ; n++) {
for (uint64_t n=0; n < mfile->size ; n++) {
current=(uint8_t)*(mfile->buffer+n);
if (n==0 && current != 0)
std::cout<< std::hex <<n <<" data begins ";
Expand Down

0 comments on commit 397ee43

Please sign in to comment.