IStream *New_IStream(const char *sname, const unsigned int stype)
{
	Pointer<IStream> istreamptr(POV_PLATFORM_BASE.CreateIStream(stype));

	if(istreamptr == NULL)
		return NULL;

	if(istreamptr->open(sname) == 0)
		return NULL;

	return istreamptr.release();
}
Exemple #2
0
IStream *NewIStream(const Path& p, const unsigned int stype)
{
    Pointer<IStream> istreamptr(POV_PLATFORM_BASE.CreateIStream(stype));

    if(istreamptr == NULL)
        return NULL;

    if (POV_ALLOW_FILE_READ(p().c_str(), stype) == false) // TODO FIXME - this is handled by the frontend, but that code isn't completely there yet [trf]
    {
        string str ("IO Restrictions prohibit read access to '") ;
        str += UCS2toASCIIString(p());
        str += "'";
        throw POV_EXCEPTION(kCannotOpenFileErr, str);
    }
    if(istreamptr->open(p().c_str()) == 0)
        return NULL;

    return istreamptr.release();
}