[Tracker] GInputStream wrapper for libstreamanalyzer



Hello all,

I've made a deal with Philip van Hoof. I'd implement a wrapper to use
a Strigi stream that uses a GInputStream and he'd provide the reverse.
Here is the result. The meat of the matter is tiny:

int32_t
GioInputStream::fillBuffer(char* start, int32_t space) {
    GInputStream* const g((GInputStream*)p);
    GError* error = NULL;
    gsize nread = g_input_stream_read(g, start, space, 0, &error);
    if (error != NULL) {
        m_status = Strigi::Error;
        m_error.assign(error->message);
        g_error_free(error);
        return -1;
    }
    return nread;
}

It's trivial to make such a wrapper for any io api.
It allows one to use libstreamanalyzer with a GInputStream.

Cheers,
Jos

Attachment: gioinputstream.h
Description: Text Data

Attachment: gioinputstream.cpp
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]