[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-dev
Subject:    [Gnash-dev] Why do FBAggGlue::init() have code after its return statement?
From:       Petter Reinholdtsen <pere () hungry ! com>
Date:       2014-04-24 21:47:39
Message-ID: 2fly4yuiemc.fsf () diskless ! uio ! no
[Download RAW message or body]


Anyone know what is going on in this function from fb_glue_agg.cpp?
This is Coverity CID 1149302 - Structurally dead code, and there is a
large block of code after the return statement in the middle.  The code
was written by Rob and last touched in 2011 (except a warning fix by
Bastiaan in 2012).

bool
FBAggGlue::init (int argc, char ***argv)
{
//    GNASH_REPORT_FUNCTION;    

    // The device must be initialized before the renderer. AGG only supports
    // The Raw framebuffer, so we use that.
    _device.reset(new renderer::rawfb::RawFBDevice);
    _device->initDevice(argc, *argv);    

    renderer::rawfb::RawFBDevice *rawfb = reinterpret_cast
        <renderer::rawfb::RawFBDevice *>(_device.get());

    // You must pass in the file descriptor to the opened
    // framebuffer when creating a window.
    return _device->attachWindow(rawfb->getHandle());

    // Set the renderer for the AGG glue layer
    gnash::Renderer *rend = reinterpret_cast<gnash::Renderer *>
                                                (createRenderHandler());
    if (rend) {
        _renderer.reset(rend);
    } else {
        log_error(_("failed to create a render handler for AGG!"));
        return false;
    }

    // Set grayscale for 8 bit modes
    if (_varinfo.bits_per_pixel == 8) {
	if (!rawfb->setGrayscaleLUT8())
	    return false;
    }

    return true;
}

Should the code after the first return statement be deleted?

-- 
Happy hacking
Petter Reinholdtsen

_______________________________________________
Gnash-dev mailing list
Gnash-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnash-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic