by a meteor or spontaneously combust before this happens.) There
is no possibility of false negatives.</para>
+<para>This program handles a maximum of 65536 lines per file. A full
+integer line-number range would increase working-set size by
+20%.</para>
+
<para>You will get spurious results if you mix
<filename>.scf</filename> files with different shred sizes or
normalizations, or with settings for these that conflict with the
{
char **place, **list;
int file_count, progress, totalchunks;
- u_int32_t netfile_count, totallines = 0;
+ linecount_t netfile_count, totallines = 0;
char buf[BUFSIZ];
list = sorted_file_list(tree, &file_count);
fputs("%%\n", ofp);
netfile_count = htonl(file_count);
- fwrite(&netfile_count, sizeof(u_int32_t), 1, ofp);
+ fwrite(&netfile_count, sizeof(linecount_t), 1, ofp);
fprintf(stderr, "%% Reading %s... ", tree);
progress = totalchunks = 0;
for (place = list; place < list + file_count; place++)
/* the statistics trailer */
totallines = htonl(totallines);
- fwrite(&totallines, sizeof(u_int32_t), 1, ofp);
+ fwrite(&totallines, sizeof(linecount_t), 1, ofp);
}
static void read_scf(struct scf_t *scf)
/* merge hashes from specified files into an in-code list */
{
- u_int32_t filecount;
+ linecount_t filecount;
int hashcount = 0;
struct stat sb;
stat(scf->name, &sb);
fprintf(stderr, "%% Reading hash list %s... ", scf->name);
- fread(&filecount, sizeof(u_int32_t), 1, scf->fp);
+ fread(&filecount, sizeof(linecount_t), 1, scf->fp);
filecount = ntohl(filecount);
while (filecount--)
{
}
fprintf(stderr, "\b\b\b100%%...done, %d shreds\n", hashcount);
- fread(&scf->totallines, sizeof(u_int32_t), 1, scf->fp);
+ fread(&scf->totallines, sizeof(linecount_t), 1, scf->fp);
}
static int merge_tree(char *tree)
{
char **place, **list;
int old_entry_count, file_count, i;
- u_int32_t totallines = 0;
+ linecount_t totallines = 0;
old_entry_count = sort_count;
file_count = 0;
#include <sys/types.h>
#include <netinet/in.h>
+#ifndef LARGEFILES
/*
- * 65,536 lines should be enough, but maybe someday this will be 32 bits.
+ * 65,536 lines should be enough, but make it possible to compile with 32 bits.
* The point of making it a short is that the data sets can get quite large,
* so we want the hash_t and sorthash_t structures to be small.
*/
typedef u_int16_t linenum_t;
#define TONET htons
#define FROMNET ntohs
+#else
+typedef u_int32_t linenum_t;
+#define TONET htonl
+#define FROMNET ntohl
+#endif
#define UNIQUE_FLAG (linenum_t)-1 /* 2s-complement assumption */
+/* use this to hold total line count of the entire source tree set */
+typedef u_int32_t linecount_t;
+
#define HASHSIZE 16
struct hash_t
{