X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=plocate-build.cpp;h=028a1ee06c620d8274ae707ba1905041ac288a17;hb=fd6198891d6fd9642effc0843fef6f23b991af3e;hp=02b18d0e42e00dc577ad9d7160d2f53d05433bfb;hpb=a73ad8311c5b272888c17829f390e1c35a5d624d;p=plocate diff --git a/plocate-build.cpp b/plocate-build.cpp index 02b18d0..028a1ee 100644 --- a/plocate-build.cpp +++ b/plocate-build.cpp @@ -83,10 +83,10 @@ void handle_directory(FILE *fp, DatabaseReceiver *receiver) int type = getc(fp); if (type == DBE_NORMAL) { string filename = read_cstr(fp); - receiver->add_file(dir_path + "/" + filename); + receiver->add_file(dir_path + "/" + filename, unknown_dir_time); } else if (type == DBE_DIRECTORY) { string dirname = read_cstr(fp); - receiver->add_file(dir_path + "/" + dirname); + receiver->add_file(dir_path + "/" + dirname, unknown_dir_time); } else { return; // Probably end. } @@ -116,7 +116,7 @@ void read_plaintext(FILE *fp, DatabaseReceiver *receiver) } if (!s.empty() && s.back() == '\n') s.pop_back(); - receiver->add_file(move(s)); + receiver->add_file(move(s), unknown_dir_time); } } @@ -166,8 +166,8 @@ void do_build(const char *infile, const char *outfile, int block_size, bool plai } string dictionary = builder.train(1024); - DatabaseBuilder db(outfile, block_size, dictionary); - Corpus *corpus = db.start_corpus(); + DatabaseBuilder db(outfile, /*owner=*/-1, block_size, dictionary, /*check_visibility=*/true); + DatabaseReceiver *corpus = db.start_corpus(/*store_dir_times=*/false); if (plaintext) { read_plaintext(infp, corpus); } else { @@ -175,7 +175,7 @@ void do_build(const char *infile, const char *outfile, int block_size, bool plai } fclose(infp); - dprintf("Read %zu files from %s\n", corpus->num_files, infile); + dprintf("Read %zu files from %s\n", corpus->num_files_seen(), infile); db.finish_corpus(); } @@ -195,7 +195,7 @@ void usage() void version() { - printf("plocate-build %s\n", PLOCATE_VERSION); + printf("plocate-build %s\n", PACKAGE_VERSION); printf("Copyright 2020 Steinar H. Gunderson\n"); printf("License GPLv2+: GNU GPL version 2 or later .\n"); printf("This is free software: you are free to change and redistribute it.\n");