<commit_before>#include <stdlib.h>
#include <archive.h>
#include <archive_entry.h>

int main(void)
{
    struct archive* a = archive_read_new();
    struct archive_entry* e = archive_entry_new();

    archive_read_support_filter_all(a);
    archive_read_support_format_all(a);

    FILE *fh = fopen("test.gz", "rb");
    fseek(fh, 0L, SEEK_END);
    long l = ftell(fh);
    rewind(fh);
    char* content = malloc(l);
    fread(content, l, 1, fh);
    int retval;

    retval = archive_read_open_memory(a, content, l);
    printf("%d\n", retval);
    archive_read_next_header(a, &e);
    printf("%s\n", archive_entry_pathname(e));


    /*
        ignore (Archive.read_open_memory handle content l);
        ignore (Archive.read_next_header handle entry);
        (* print_endline (Archive.entry_pathname entry); *)
        ignore (Archive.read_data handle decompressed ldec);
        print_endline decompressed;
        Archive.read_free handle;
    */
    return 0;
}<commit_msg>Fixed up the C minigunzip to decompress properly<commit_after>#include <stdlib.h>
#include <archive.h>
#include <archive_entry.h>

int main(void)
{
    struct archive* a = archive_read_new();
    struct archive_entry* e = archive_entry_new();

    archive_read_support_filter_all(a);
    archive_read_support_format_all(a);
    archive_read_support_format_raw(a);

    FILE *fh = fopen("test.gz", "rb");
    fseek(fh, 0L, SEEK_END);
    long l = ftell(fh);
    rewind(fh);
    char* content = malloc(l);
    fread(content, l, 1, fh);
    int retval;

    retval = archive_read_open_memory(a, content, l);
    //retval = archive_read_open_filename(a, "test.gz", 512);
    //retval = archive_read_open_FILE(a, fh);
    printf("read_open retval: %d\n", retval);
    if (retval != ARCHIVE_OK) {
        printf("retval error: %s\n", archive_error_string(a));
    }

    archive_read_next_header(a, &e);
    printf("Pathname: %s\n", archive_entry_pathname(e));

    const void* b;
    size_t size;
    int64_t offset;
    retval = archive_read_data_block(a, &b, &size, &offset);
    printf("read_data_block retval: %d\n", retval);

    printf("buff: %s\n", b);

    return 0;
}
{'fraction_non_alphanumeric': 0.1390051139005114, 'fraction_numerical': 0.005113900511390051, 'mean_word_length': 3.6081370449678802, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3465981', 'n_tokens_mistral': 798, 'n_tokens_neox': 762, 'n_words': 165}