<commit_before>#include "header.h"
#include "rpmlib.h"

#include <string.h>

void main(int argc, char **argv)
{
#if 0
    Header h;
    FILE *f;
    char *sa[] = {"one", "two", "three"};
    int_32 i32 = 400;
    int_32 i32a[] = {100, 200, 300};
    int_16 i16 = 1;
    int_16 i16a[] = {100, 200, 300};
    char ca[] = "char array";

    h = newHeader();

    addEntry(h, RPMTAG_NAME, STRING_TYPE, "MarcEwing", 1);
    addEntry(h, RPMTAG_VERSION, STRING_TYPE, "1.1", 1);
    addEntry(h, RPMTAG_VERSION, STRING_TYPE, sa, 3);
    addEntry(h, RPMTAG_SIZE, INT32_TYPE, &i32, 1);
    addEntry(h, RPMTAG_SIZE, INT16_TYPE, &i16, 1);
    addEntry(h, RPMTAG_SIZE, INT16_TYPE, i16a, 3);
    addEntry(h, RPMTAG_VENDOR, CHAR_TYPE, ca, strlen(ca));
    addEntry(h, RPMTAG_SIZE, INT32_TYPE, i32a, 3);

    f = fopen("test.out", "w");
    writeHeader(f, h);
    fclose(f);

    dumpHeader(h, stdout, 1);
#endif

    convertDB("");
}<commit_msg>change to test new copyHeader code<commit_after>#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

#include "header.h"
#include "rpmlib.h"

void main(int argc, char **argv)
{
    Header h, h2, h3, h4;
    int fd;
    char *sa[] = {"one", "two", "three"};
    int_32 i32 = 400;
    int_32 i32a[] = {100, 200, 300};
    int_16 i16 = 1;
    int_16 i16a[] = {100, 200, 300};
    char ca[] = "char array";

    h = newHeader();

    addEntry(h, RPMTAG_NAME, STRING_TYPE, "MarcEwing", 1);
    addEntry(h, RPMTAG_VERSION, STRING_TYPE, "1.1", 1);
    addEntry(h, RPMTAG_VERSION, STRING_ARRAY_TYPE, sa, 3);
    addEntry(h, RPMTAG_SIZE, INT32_TYPE, &i32, 1);
    addEntry(h, RPMTAG_SIZE, INT16_TYPE, &i16, 1);
    addEntry(h, RPMTAG_SIZE, INT16_TYPE, i16a, 3);
    addEntry(h, RPMTAG_VENDOR, CHAR_TYPE, ca, strlen(ca));
    addEntry(h, RPMTAG_SIZE, INT32_TYPE, i32a, 3);

    printf("Original = %d\n", sizeofHeader(h));
    fd = open("test.out", O_WRONLY|O_CREAT);
    writeHeader(fd, h);
    close(fd);
    h2 = copyHeader(h);
    printf("Copy     = %d\n", sizeofHeader(h2));

    fd = open("test.out", O_RDONLY);
    h3 = readHeader(fd);
    close(fd);
   
    printf("From disk    = %d\n", sizeofHeader(h3));
    h4 = copyHeader(h3);
    printf("Copy of disk = %d\n", sizeofHeader(h4));
   
    printf("=====================\n");
    printf("Original\n");
    dumpHeader(h, stdout, 1);
    printf("=====================\n");
    printf("From disk\n");
    dumpHeader(h3, stdout, 1);
    printf("=====================\n");
    printf("Copy of disk\n");
    dumpHeader(h4, stdout, 1);

#if 0
    convertDB("");
#endif
}
{'fraction_non_alphanumeric': 0.20171006607073455, 'fraction_numerical': 0.05596579867858531, 'mean_word_length': 3.5157894736842104, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7501077', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1048, 'n_words': 244}