[Webkit-unassigned] [Bug 95719] New: [WebGL] GraphicsContext3D::compileShader stores return value of string conversion in const reference

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 4 01:25:01 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=95719

           Summary: [WebGL] GraphicsContext3D::compileShader stores return
                    value of string conversion in const reference
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebGL
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: anilsson at rim.com


How can this code possibly work reliably?

void GraphicsContext3D::compileShader(Platform3DObject shader)
{
    ASSERT(shader);
    makeContextCurrent();

    String translatedShaderSource =
m_extensions->getTranslatedShaderSourceANGLE(shader);

    if (!translatedShaderSource.length())
        return;

    int translatedShaderLength = translatedShaderSource.length();

>>> const CString& translatedShaderCString = translatedShaderSource.utf8();
    const char* translatedShaderPtr = translatedShaderCString.data();


Also, I think it should be using translatedShaderSource.latin1() instead of utf8(), since the ANGLEWebKitBridge uses the String::String(char*) constructor, which assumes char* is latin1. That should yield an 8 bit internal representation of the string, and the later call to String::latin1() will be faster, no conversion involved like there is with String::utf8().

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list