<commit_before>/*
 * This istream filter catches fatal errors and attempts to ignore
 * them.
 *
 * author: <NAME> <<EMAIL>>
 */

#include "istream_catch.hxx"
#include "ForwardIstream.hxx"
#include "util/Cast.hxx"

#include <daemon/log.h>

#include <assert.h>

class CatchIstream final : public ForwardIstream {
    off_t available = 0;

    GError *(*const callback)(GError *error, void *ctx);
    void *const callback_ctx;

public:
    CatchIstream(struct pool &pool, struct istream &_input,
                 GError *(*_callback)(GError *error, void *ctx), void *ctx)
        :ForwardIstream(pool, _input,
                        MakeIstreamHandler<CatchIstream>::handler, this),
         callback(_callback), callback_ctx(ctx) {}

    void SendSpace();

    /* virtual methods from class Istream */

    off_t GetAvailable(bool partial) override;

    off_t Skip(off_t length) override {
        off_t nbytes = ForwardIstream::Skip(length);<commit_msg>istream_catch: include cleanup<commit_after>/*
 * This istream filter catches fatal errors and attempts to ignore
 * them.
 *
 * author: <NAME> <<EMAIL>>
 */

#include "istream_catch.hxx"
#include "ForwardIstream.hxx"

#include <assert.h>

class CatchIstream final : public ForwardIstream {
    off_t available = 0;

    GError *(*const callback)(GError *error, void *ctx);
    void *const callback_ctx;

public:
    CatchIstream(struct pool &pool, struct istream &_input,
                 GError *(*_callback)(GError *error, void *ctx), void *ctx)
        :ForwardIstream(pool, _input,
                        MakeIstreamHandler<CatchIstream>::handler, this),
         callback(_callback), callback_ctx(ctx) {}

    void SendSpace();

    /* virtual methods from class Istream */

    off_t GetAvailable(bool partial) override;

    off_t Skip(off_t length) override {
        off_t nbytes = ForwardIstream::Skip(length);
{'fraction_non_alphanumeric': 0.11454448588172615, 'fraction_numerical': 0.0010655301012253596, 'mean_word_length': 3.3878504672897196, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '3371256', 'n_tokens_mistral': 588, 'n_tokens_neox': 567, 'n_words': 157}