Example #1
0
bool ll_register_foreign_func(LibLoader *ll,
                              char *lisp_func,
                              char *c_func)
{
    PrimFunc *func;

    func = (PrimFunc *)LIBRARY_GETSYM(ll->_prev_handle, c_func);

#ifndef WIN32
    {
        char *error;

        if((error = dlerror()) != NULL) {
            OUTPUT_ERR("problem finding symbol: %s\n", error);
            return false;
        }
    }
#else
    if(func == NULL) {
        OUTPUT_ERR("problem opening function: %s in library\n", c_func);
        return false;
    }
#endif

    if(strcmp(ll->_mod_name, "None") == 0) {
        /* need to first convert to String */
        String tmp_w[MAX_FUNCTION_LEN];
        mbsrtowcs((wchar_t *)tmp_w,
                  (const char **)&lisp_func,
                  MAX_FUNCTION_LEN,
                  NULL);

        REGISTER_FUNC("foreign", (wchar_t*)tmp_w, func);
    } else {
        char tmp[MAX_FUNCTION_LEN];
        char *tmp_p = tmp;
        String tmp_w[MAX_FUNCTION_LEN];

        snprintf(tmp_p, MAX_FUNCTION_LEN,
                 "%s:%s", ll->_mod_name, lisp_func);

        /* need to first convert to String */
        mbsrtowcs((wchar_t*)tmp_w,
                  (const char **)&tmp_p,
                  MAX_FUNCTION_LEN,
                  NULL);

        REGISTER_FUNC("foreign", (wchar_t*)tmp_w, func);
    }
    
    return true;
}
int LLVMFuzzerInitialize(int* /*argc*/, char*** argv)
{
    const char* exe_path = (*argv)[0];
    if( CPLGetConfigOption("GDAL_DATA", nullptr) == nullptr )
    {
        CPLSetConfigOption("GDAL_DATA", CPLGetPath(exe_path));
    }
    CPLSetConfigOption("CPL_TMPDIR", "/tmp");
    CPLSetConfigOption("DISABLE_OPEN_REAL_NETCDF_FILES", "YES");
    CPLSetConfigOption("GDAL_HTTP_TIMEOUT", "1");
    CPLSetConfigOption("GDAL_HTTP_CONNECTTIMEOUT", "1");
#ifdef OGR_SKIP
    CPLSetConfigOption("OGR_SKIP", OGR_SKIP);
#endif
    REGISTER_FUNC();
    return 0;
}
Example #3
0
    {INCHLAYOUT, OUTCHLAYOUT, PACKING, AV_SAMPLE_FMT_U8,  FUNC##_u8},   \
    {INCHLAYOUT, OUTCHLAYOUT, PACKING, AV_SAMPLE_FMT_S16, FUNC##_s16},  \
    {INCHLAYOUT, OUTCHLAYOUT, PACKING, AV_SAMPLE_FMT_S32, FUNC##_s32},  \
    {INCHLAYOUT, OUTCHLAYOUT, PACKING, AV_SAMPLE_FMT_FLT, FUNC##_flt},  \
    {INCHLAYOUT, OUTCHLAYOUT, PACKING, AV_SAMPLE_FMT_DBL, FUNC##_dbl},

#define REGISTER_FUNC(INCHLAYOUT, OUTCHLAYOUT, FUNC)                                \
    REGISTER_FUNC_PACKING(INCHLAYOUT, OUTCHLAYOUT, FUNC##_packed, AVFILTER_PACKED)  \
    REGISTER_FUNC_PACKING(INCHLAYOUT, OUTCHLAYOUT, FUNC##_planar, AVFILTER_PLANAR)

static const struct RematrixFunctionInfo {
    int64_t in_chlayout, out_chlayout;
    int planar, sfmt;
    void (*func)();
} rematrix_funcs[] = {
    REGISTER_FUNC        (AV_CH_LAYOUT_STEREO,  AV_CH_LAYOUT_5POINT1, stereo_to_surround_5p1)
    REGISTER_FUNC        (AV_CH_LAYOUT_5POINT1, AV_CH_LAYOUT_STEREO,  surround_5p1_to_stereo)
    REGISTER_FUNC_PACKING(AV_CH_LAYOUT_STEREO,  AV_CH_LAYOUT_MONO,    stereo_to_mono_packed, AVFILTER_PACKED)
    REGISTER_FUNC_PACKING(AV_CH_LAYOUT_MONO,    AV_CH_LAYOUT_STEREO,  mono_to_stereo_packed, AVFILTER_PACKED)
    REGISTER_FUNC        (0,                    AV_CH_LAYOUT_MONO,    mono_downmix)
    REGISTER_FUNC_PACKING(0,                    AV_CH_LAYOUT_STEREO,  stereo_downmix_packed, AVFILTER_PACKED)

    // This function works for all sample formats
    {0, AV_CH_LAYOUT_STEREO, AVFILTER_PLANAR, -1, stereo_remix_planar}
};

static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque)
{
    AConvertContext *aconvert = ctx->priv;
    char *arg, *ptr = NULL;
    int ret = 0;
Example #4
0
void register_uint(struct ne_handler *handler)
{
	REGISTER_FUNC(handler, UINT, SYM_FUNC);
}