<commit_before>#include <RSImg.h>
#include <stdlib.h>
#include <string.h>


int RSImgFreadPPMP6Header(FILE *file, uint32_t *width, uint32_t *height, uint32_t *headerSize) {

    const int prefixSize = 3;
    char prefix[prefixSize] = {'P', '6', '\n'};

    const int suffixSize = 4;
    char suffix[suffixSize] = {'2', '5', '5', '\n'};

    // "P6\n"
    char actualPrefix[prefixSize];
    if (fread(actualPrefix, prefixSize, 1, file) != 1) {
        return 0;
    }
    if (memcmp(actualPrefix, prefix, prefixSize) != 0) {
        return 0;
    }

    // "2880 1800\n"
    const int lineSize = 200;
    char line[lineSize];
    fgets(line, lineSize, file);
    *headerSize = 3 + strlen(line) + 4;
    char *tok = strtok(line, " ");
    *width = atol(tok);
    tok = strtok(NULL, " ");
    *height = atol(tok);

    // "255\n"
    char actualSuffix[suffixSize];
    if (fread(actualSuffix, suffixSize, 1, file) != 1) {
        return 0;
    }
    if (memcmp(actualSuffix, suffix, suffixSize) != 0) {
        return 0;
    }

    return 1;
}
<commit_msg>Oops.<commit_after>#include <RSImg.h>
#include <stdlib.h>
#include <string.h>


int RSImgFreadPPMP6Header(FILE *file, uint32_t *width, uint32_t *height, uint32_t *headerSize) {

    const int prefixSize = 3;
    char prefix[3] = {'P', '6', '\n'};

    const int suffixSize = 4;
    char suffix[4] = {'2', '5', '5', '\n'};

    // "P6\n"
    char actualPrefix[prefixSize];
    if (fread(actualPrefix, prefixSize, 1, file) != 1) {
        return 0;
    }
    if (memcmp(actualPrefix, prefix, prefixSize) != 0) {
        return 0;
    }

    // "2880 1800\n"
    const int lineSize = 200;
    char line[lineSize];
    fgets(line, lineSize, file);
    *headerSize = 3 + strlen(line) + 4;
    char *tok = strtok(line, " ");
    *width = atol(tok);
    tok = strtok(NULL, " ");
    *height = atol(tok);

    // "255\n"
    char actualSuffix[suffixSize];
    if (fread(actualSuffix, suffixSize, 1, file) != 1) {
        return 0;
    }
    if (memcmp(actualSuffix, suffix, suffixSize) != 0) {
        return 0;
    }

    return 1;
}

{'fraction_non_alphanumeric': 0.16682692307692307, 'fraction_numerical': 0.04038461538461539, 'mean_word_length': 2.6128472222222223, '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': '5942674', 'n_tokens_mistral': 851, 'n_tokens_neox': 771, 'n_words': 192}