Exemplo n.º 1
0
static int results_cmp (const results_t *r1, const results_t *r2)
{
	const char *r1name = results_name (r1);
	const char *r2name = results_name (r2);
	if (!r1name || !r2name) {
		return 0;
	}
	return strcmp (r1name, r2name);
}
Exemplo n.º 2
0
static time_t results_installdate (const results_t *r)
{
	const char *r_name;
	alpm_pkg_t *pkg = NULL;
	time_t idate=0;
	if (r->type==R_AUR_PKG) return 0;
	r_name = results_name (r);
	pkg = alpm_db_get_pkg(alpm_get_localdb(config.handle), r_name);
	if (pkg) idate = alpm_pkg_get_installdate(pkg);
	return idate;
}
Exemplo n.º 3
0
static time_t results_installdate (const results_t *r)
{
	if (!r || r->type == R_AUR_PKG) {
		return 0;
	}
	time_t idate = 0;
	const char *r_name = results_name (r);
	alpm_pkg_t *pkg = alpm_db_get_pkg (alpm_get_localdb(config.handle), r_name);
	if (pkg) {
		idate = alpm_pkg_get_installdate (pkg);
	}
	return idate;
}
Exemplo n.º 4
0
void calculate_results_relevance (alpm_list_t *targets)
{
	for (const alpm_list_t *t = targets; t; t = alpm_list_next (t)) {
		const char *target = t->data;
		for (const alpm_list_t *r = results; r; r = alpm_list_next(r)) {
			const char *result = results_name (r->data);
			const size_t lev_dst = levenshtein_distance (target, result);
			if (lev_dst < ((results_t *) r->data)->rel) {
				((results_t *) r->data)->rel = lev_dst;
			}
		}
	}
}
Exemplo n.º 5
0
main(int argc, char *argv[]){

	/** Check the number of parameters */
	if (argc < 5) {
		/** Tell the user how to run the program */
		cerr << "Usage: " << argv[0] << " token encrows results num_threads" << endl;
        	return 1;
	}

	mr_init_threading();
	PFC pfc(AES_SECURITY);

	SecureSelect *db=NULL;

	int m=0;
	string query_name(argv[1]);
	string enctable_name(argv[2]);
	string results_name(argv[3]);
	int num_threads = atoi(argv[4]);

	db = new SecureSelect(&pfc,pfc.order());

	if (!ifstream(query_name+"_ptok")){
		cout << "Query file doesn't exist" << endl;
		return 0;
	}

	if (!ifstream(enctable_name+"_enc_msgs")){
		cout << "Enctable file doesn't exist" << endl;
		return 0;
	}

	#ifdef VERBOSE
	int start = getMilliCount();
	#endif
	int res_num = db->ApplyPTokenMT(query_name, enctable_name, results_name, num_threads);
	//int res_num = db->ApplyPToken(query_name, enctable_name, results_name);
	#ifdef VERBOSE
	int milliSecondsElapsed = getMilliSpan(start);
	cout << "\texec time " << milliSecondsElapsed << endl;
	#endif

	if(res_num >=0){
		cout << res_num << " result(s) found" << endl;
		return 1;
	}
	else
		return 0;

}
Exemplo n.º 6
0
static int results_cmp (const results_t *r1, const results_t *r2)
{
	return strcmp (results_name (r1), results_name (r2));
}