Source

mtdupefind / Win32Questions / HeapAllocAlignmentQ / FindDupes.cpp

Full commit
Rodney Schuler 3323b86 






























































































































#include "StdAfx.h"
#include "FindDupes.h"
#include "windows.h"

extern "C" {

static int pagesize=4*1024;
static int blocksize=4*1024;
static const int init_alloc=8;

/*  never actaully create a path instance always malloc
    sizeof(path)+sizeof(FC_CHAR)*(characters in path component+1) */
typedef struct path {
	path * parent;
	path * prev_alloced;
	int is_include; /* 0=waiting for answer, >0 include, <0 exclude */
} path;

typedef struct file_record {
	FD_BYTE_COUNT size; /* sort key */
	path * file_path;
	FILETIME last_mod;
	FD_GROUP_ID group;
} file_record;

typedef struct _FD_INSTANCE {
	/* Update these upon each dir visit completion */
	FD_PATH_COUNT dir_found_count;
	FD_PATH_COUNT dir_scaned_count;
	FD_PATH_COUNT dir_file_count;

	/* Update these upon each group completion */
	FD_GROUP_COUNT group_count;
	FD_BYTE_COUNT scaned_byte_count;
	FD_BYTE_COUNT duped_byte_count;

	/* head of path allocation singly linked list */
	path * path_alloc;

	/* alloced & sorted once at tree search completion */
	file_record * file_records;

	/* callback funcs & a BATON for each */
} FD_INSTANCE;

/* The actual functions */
FD_INSTANCE* fd_init(){
	return 0;
}

FD_ERROR fd_addpath(FD_INSTANCE*,FD_PATH_IN){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_start(FD_INSTANCE*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_cancel(FD_INSTANCE*, FD_COMPLETION_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_halt(FD_INSTANCE*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_free(FD_INSTANCE*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_error(FD_INSTANCE*, FD_ERROR_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_dirread_error(FD_INSTANCE*, FD_ERROR_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_fileread_error(FD_INSTANCE*, FD_FILEIO_ERROR_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_filesearch_complete(FD_INSTANCE*, FD_COMPLETION_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_compare_complete(FD_INSTANCE*, FD_COMPLETION_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_pathsearch_progress(FD_INSTANCE*, FD_PATH_COUNT granularity, FD_SEARCHPROGRESS_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_bytescompared_progress(FD_INSTANCE*, FD_PATH_COUNT granularity, FD_BYTEPROGRESS_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_new_group(FD_INSTANCE*, FD_NEW_GROUP_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_new_file_in_group(FD_INSTANCE*, FD_GROUP_ID, FD_NEW_FILE_IN_GROUP_CB, FD_BATON){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_get_first_group(FD_GROUP_ID*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_get_next_group(FD_GROUP_ID, FD_GROUP_ID*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_get_first_file_in_group(FD_GROUP_ID, FD_PATH_ID*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_get_next_file_in_group(FD_GROUP_ID, FD_PATH_ID, FD_PATH_ID*){
	return FD_NOT_IMPLEMENTED;
}

FD_ERROR fd_getpath(FD_INSTANCE, FD_PATH_ID, int* buffsize, FD_PATH_OUT buff){
	return FD_NOT_IMPLEMENTED;
}


} /* extern "c" */