<commit_before>/*
 * Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/).
 * All Rights Reserved.
 *
 * This software is licensed as OpenSource, under the Apache License, Version
 * 2.0.
 * This license is available at: http://opensource.org/licenses/Apache-2.0.
 */

#include "ac.h"
#include "machinedep.h"

extern AC_REPORTFUNCPTR libReportCB;
static char S0[512];

double
FixToDbl(Fixed f)
{
    float r;
    acfixtopflt(f, &r);
    return r;
}

void
PrintMessage(char* s)
{
    char msgBuffer[512];
    if ((libReportCB != NULL) && (strlen(s) > 0)) {
        sprintf(msgBuffer, "\t%s", s);
        libReportCB(msgBuffer);
    }
}

void
ReportError(char* s)
{
    if (reportErrors && (libReportCB != NULL))
        PrintMessage(s);
}

void
ReportSmoothError(Fixed x, Fixed y)
{
    (void)sprintf(S0, "Junction at %g %g may need smoothing.",
                  FixToDbl(itfmx(x)), FixToDbl(itfmy(y)));
    ReportError(S0);
}

void
ReportAddFlex(void)
{
    if (hasFlex)
        return;
    hasFlex = true;
    PrintMessage("FYI: added flex operators to this character.");
}
<commit_msg>Use MAXMSGLEN here as well<commit_after>/*
 * Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/).
 * All Rights Reserved.
 *
 * This software is licensed as OpenSource, under the Apache License, Version
 * 2.0.
 * This license is available at: http://opensource.org/licenses/Apache-2.0.
 */

#include "ac.h"
#include "machinedep.h"

extern AC_REPORTFUNCPTR libReportCB;
static char S0[MAXMSGLEN + 1];

double
FixToDbl(Fixed f)
{
    float r;
    acfixtopflt(f, &r);
    return r;
}

void
PrintMessage(char* s)
{
    char msgBuffer[MAXMSGLEN + 1];
    if ((libReportCB != NULL) && (strlen(s) > 0)) {
        sprintf(msgBuffer, "\t%s", s);
        libReportCB(msgBuffer);
    }
}

void
ReportError(char* s)
{
    if (reportErrors && (libReportCB != NULL))
        PrintMessage(s);
}

void
ReportSmoothError(Fixed x, Fixed y)
{
    (void)sprintf(S0, "Junction at %g %g may need smoothing.",
                  FixToDbl(itfmx(x)), FixToDbl(itfmy(y)));
    ReportError(S0);
}

void
ReportAddFlex(void)
{
    if (hasFlex)
        return;
    hasFlex = true;
    PrintMessage("FYI: added flex operators to this character.");
}

{'fraction_non_alphanumeric': 0.14049217002237135, 'fraction_numerical': 0.014317673378076063, 'mean_word_length': 3.226843100189036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1024910', 'n_tokens_mistral': 846, 'n_tokens_neox': 807, 'n_words': 204}