<commit_before>#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xrender.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>

#define COMBINE_HI_8LO(a,b) ((((unsigned)a) << 8) | (unsigned)b)
#define COMBINE_HI_4LO(a,b) ((((unsigned)a) << 4) | (unsigned)b)

#define EDID_HEADER         0x00
#define EDID_HEADER_END     0x07
#define MANUFACTURER        0x08
#define MANUFACTURER_END    0x09
#define MODEL               0x0a
#define SERIAL              0x0c

static Display              *display;
static Window               root;
static int                  screen = -1;
static XRRScreenResources   *res;
typedef unsigned char       byte;

const byte edid_v1_header[] = {0x00, 0xff, 0x0ff, 0xff, 0xff, 0xff, 0xff, 0x00};

static char*
parse_vendor(byte const* vendorid) {
    static char sign[4];
    unsigned short h;

    h = COMBINE_HI_8LO(vendorid[0], vendorid[1]);
    sign[0] = ((h >> 0x0a) & 0x1f) + 'A' - 1;
    sign[1] = ((h >> 0x05) & 0x1f) + 'A' - 1;
    sign[2] = (h   & 0x1f) + 'A' - 1;
    sign[3] = 0;
    return sign;
}

static void
parse_edid(unsigned char *edid, unsigned long size) {
    if (strncmp(edid + EDID_HEADER, edid_v1_header, EDID_HEADER_END + 1)) {
        fprintf(stderr, "<corrupt EDID v1 header>");
        return;
    }

    printf(";%s", parse_vendor(edid + MANUFACTURER));
}

static void
get_outputs(void) {
    int i, j, np;
    Atom *p;

    for (i = 0; i < res->noutput; ++i) {
        XRROutputInfo *output_info = XRRGetOutputInfo(display, res,
            res->outputs[i]);
        if (!output_info) {
            continue;
        }
        p = XRRListOutputProperties(display, res->outputs[i], &np);
        for (j = 0; j < np; ++j) {
            unsigned char *prop;
            int actual_format;<commit_msg>Typofix<commit_after>#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xrender.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>

#define COMBINE_HI_8LO(a,b) ((((unsigned)a) << 8) | (unsigned)b)
#define COMBINE_HI_4LO(a,b) ((((unsigned)a) << 4) | (unsigned)b)

#define EDID_HEADER         0x00
#define EDID_HEADER_END     0x07
#define MANUFACTURER        0x08
#define MANUFACTURER_END    0x09
#define MODEL               0x0a
#define SERIAL              0x0c

static Display              *display;
static Window               root;
static int                  screen = -1;
static XRRScreenResources   *res;
typedef unsigned char       byte;

const byte edid_v1_header[] = {0x00, 0xff, 0x0ff, 0xff, 0xff, 0xff, 0xff, 0x00};

static char*
parse_vendor(byte const* vendorid) {
    static char sign[4];
    unsigned short h;

    h = COMBINE_HI_8LO(vendorid[0], vendorid[1]);
    sign[0] = ((h >> 0x0a) & 0x1f) + 'A' - 1;
    sign[1] = ((h >> 0x05) & 0x1f) + 'A' - 1;
    sign[2] = (h   & 0x1f) + 'A' - 1;
    sign[3] = 0;
    return sign;
}

static void
parse_edid(unsigned char *edid, unsigned long size) {
    if (strncmp(edid + EDID_HEADER, edid_v1_header, EDID_HEADER_END + 1)) {
        fprintf(stderr, "<corrupt EDID v1 header>");
        return;
    }

    printf(":%s", parse_vendor(edid + MANUFACTURER));
}

static void
get_outputs(void) {
    int i, j, np;
    Atom *p;

    for (i = 0; i < res->noutput; ++i) {
        XRROutputInfo *output_info = XRRGetOutputInfo(display, res,
            res->outputs[i]);
        if (!output_info) {
            continue;
        }
        p = XRRListOutputProperties(display, res->outputs[i], &np);
        for (j = 0; j < np; ++j) {
            unsigned char *prop;
            int actual_format;
{'fraction_non_alphanumeric': 0.14578947368421052, 'fraction_numerical': 0.039473684210526314, 'mean_word_length': 2.693877551020408, 'pattern_counts': {'":': 1, '<': 39, '<?xml version=': 0, '>': 41, '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': '590509', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1479, 'n_words': 347}