Esempio n. 1
0
rpmRC wrXAR(const char * xarfn, rpmwf wf)
{
    rpmRC rc;

/*@-noeffect@*/
if (_rpmwf_debug) rpmwfDump(wf, "wrXAR", xarfn);
/*@=noeffect@*/

    wf->xar = rpmxarNew(xarfn, "w");
    if (wf->xar == NULL)
	return RPMRC_FAIL;

    if ((rc = rpmwfPushXAR(wf, "Lead")) != RPMRC_OK)
	goto exit;
    if ((rc = rpmwfPushXAR(wf, "Signature")) != RPMRC_OK)
	goto exit;
    if ((rc = rpmwfPushXAR(wf, "Header")) != RPMRC_OK)
	goto exit;
    if ((rc = rpmwfPushXAR(wf, "Payload")) != RPMRC_OK)
	goto exit;

exit:
    wf->xar = rpmxarFree(wf->xar, "wrXAR");
    return rc;
}
Esempio n. 2
0
/* --- Object ctors/dtors */
static rpmxar
rpmxar_init(JSContext *cx, JSObject *obj, const char * _fn, const char * _fmode)
{
    rpmxar xar = NULL;

    if (_fn) {
	if (_fmode == NULL) _fmode = "r";
	xar = rpmxarNew(_fn, _fmode);
    }

    if (!JS_SetPrivate(cx, obj, (void *)xar)) {
	/* XXX error msg */
	return NULL;
    }

if (_debug)
fprintf(stderr, "<== %s(%p,%p) xar(%s,%s) %p\n", __FUNCTION__, cx, obj, _fn, _fmode, xar);
    return xar;
}
Esempio n. 3
0
rpmwf rdXAR(const char * xarfn)
{
    rpmwf wf;
    rpmRC rc;

    if ((wf = rpmwfNew(xarfn)) == NULL)
	return wf;

    wf->xar = rpmxarNew(wf->fn, "r");
    if (wf->xar == NULL) {
	wf = rpmwfFree(wf);
	return NULL;
    }

    while (rpmxarNext(wf->xar) == 0)
	rc = rpmwfPullXAR(wf, NULL);
    wf->xar = rpmxarFree(wf->xar, "rdXAR");

/*@-noeffect@*/
if (_rpmwf_debug) rpmwfDump(wf, "rdXAR", xarfn);
/*@=noeffect@*/

    return wf;
}