示例#1
0
void testReferenceStruct() {
  int x;
  RefWrapper w = { x };

  x = 42;
  clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
  useStruct(w);
  clang_analyzer_eval(x == 42); // expected-warning{{UNKNOWN}}
}
示例#2
0
void testPointerStruct() {
  int x;
  Wrapper w;

  w.ptr = &x;
  x = 42;
  clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
  useStruct(w);
  clang_analyzer_eval(x == 42); // expected-warning{{UNKNOWN}}

  w.ptr = &x;
  x = 42;
  clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
  useConstStruct(w);
  clang_analyzer_eval(x == 42); // expected-warning{{UNKNOWN}}
}
示例#3
0
// ////////////////////////////////////////////////////////////////////////////
bool startLimitScreen(void)
{
    UDWORD			numButtons = 0;
    UDWORD			i;

    addBackdrop();//background

    // load stats...
    if(!bLimiterLoaded)
    {
        initLoadingScreen(true);

        if (!resLoad("wrf/limiter_tex.wrf", 501))
        {
            return false;
        }

        if (!resLoad("wrf/piestats.wrf", 502))
        {
            return false;
        }

        if (!resLoad("wrf/limiter_data.wrf", 503))
        {
            return false;
        }

        bLimiterLoaded = true;

        closeLoadingScreen();
    }

    if (challengeActive)
    {
        // reset the sliders..
        // it's a HACK since the actual limiter structure was cleared in the startMultiOptions function
        for (i = 0; i < numStructureStats ; ++i)
        {
            asStructLimits[0][i].limit = asStructLimits[0][i].globalLimit;
        }

        // turn off the sliders
        sliderEnableDrag(false);
    }
    else
    {
        //enable the sliders
        sliderEnableDrag(true);
    }

    addSideText(FRONTEND_SIDETEXT1,LIMITSX-2,LIMITSY,"LIMITS");	// draw sidetext...

    W_FORMINIT sFormInit;
    sFormInit.formID	= FRONTEND_BACKDROP;
    sFormInit.id		= IDLIMITS;
    sFormInit.style		= WFORM_PLAIN;
    sFormInit.x			= LIMITSX;
    sFormInit.y			= LIMITSY;
    sFormInit.width		= LIMITSW;
    sFormInit.height	= LIMITSH;
    sFormInit.pDisplay	= intDisplayPlainForm;
    widgAddForm(psWScreen, &sFormInit);

    // return button.
    addMultiBut(psWScreen,IDLIMITS,IDLIMITS_RETURN,
                LIMITS_OKX-40,LIMITS_OKY,
                iV_GetImageWidth(FrontImages,IMAGE_RETURN),
                iV_GetImageHeight(FrontImages,IMAGE_RETURN),
                _("Apply Defaults and Return To Previous Screen"),IMAGE_NO,IMAGE_NO,true);

    // ok button
    addMultiBut(psWScreen,IDLIMITS,IDLIMITS_OK,
                LIMITS_OKX,LIMITS_OKY,
                iV_GetImageWidth(FrontImages,IMAGE_OK),
                iV_GetImageHeight(FrontImages,IMAGE_OK),
                _("Accept Settings"),IMAGE_OK,IMAGE_OK,true);

    // Count the number of minor tabs needed
    numButtons = 0;

    for(i=0; i<numStructureStats; i++ )
    {
        if(useStruct(numButtons,i))
        {
            numButtons++;
        }
    }

    if(numButtons >(4*BUTPERFORM)) numButtons =(4*BUTPERFORM);

    // add tab form..
    sFormInit = W_FORMINIT();
    sFormInit.formID = IDLIMITS;
    sFormInit.id = IDLIMITS_TABS;
    sFormInit.style = WFORM_TABBED;
    sFormInit.x = 50;
    sFormInit.y = 10;
    sFormInit.width = LIMITSW - 100;
    sFormInit.height =LIMITSH - 4;
    sFormInit.numMajor = numForms(numButtons, BUTPERFORM);
    sFormInit.majorPos = WFORM_TABTOP;
    sFormInit.minorPos = WFORM_TABNONE;
    sFormInit.majorSize = OBJ_TABWIDTH+3; //!!
    sFormInit.majorOffset = OBJ_TABOFFSET;
    sFormInit.tabVertOffset = (OBJ_TABHEIGHT/2);			//(DES_TAB_HEIGHT/2)+2;
    sFormInit.tabMajorThickness = OBJ_TABHEIGHT;
    sFormInit.pUserData = &StandardTab;
    sFormInit.pTabDisplay = intDisplayTab;

    // TABFIXME --unsure if needs fixing yet.
    for (i=0; i< sFormInit.numMajor; i++)
    {
        sFormInit.aNumMinors[i] = 1;
    }
    widgAddForm(psWScreen, &sFormInit);

    //Put the buttons on it
    W_FORMINIT sButInit;
    sButInit.formID   = IDLIMITS_TABS;//IDLIMITS;
    sButInit.style	  = WFORM_PLAIN;
    sButInit.width    = BARWIDTH;
    sButInit.height	  = BARHEIGHT;
    sButInit.pDisplay = displayStructureBar;
    sButInit.x		  = 2;
    sButInit.y		  = 5;
    sButInit.id	 	  = IDLIMITS_ENTRIES_START;

    numButtons =0;
    for(i=0; i<numStructureStats ; i++)
    {
        if(useStruct(numButtons,i))
        {
            numButtons++;
            sButInit.UserData= i;

            widgAddForm(psWScreen, &sButInit);
            sButInit.id	++;

            addFESlider(sButInit.id,sButInit.id-1, 290,11,
                        asStructLimits[0][i].globalLimit,
                        asStructLimits[0][i].limit);
            sButInit.id	++;

            if (sButInit.y + BARHEIGHT + 2 > (BUTPERFORM*(BARHEIGHT+2) - 4) )
            {
                sButInit.y = 5;
                sButInit.majorID += 1;
            }
            else
            {
                sButInit.y +=  BARHEIGHT +5;
            }
        }
    }

    return true;
}