示例#1
0
GlueFileBinaryData::GlueFileBinaryData(const GlueFileBinaryData& rhs)
{
  AMJU_CALL_STACK;

  Copy(rhs);
  IncCount();
}
示例#2
0
GlueFileBinaryData::GlueFileBinaryData()
{
  AMJU_CALL_STACK;

  m_pBuf = 0;
  m_allocated = false;
  m_refCount = 0;
  IncCount();
}
示例#3
0
GlueFileBinaryData& GlueFileBinaryData::operator=(const GlueFileBinaryData& rhs)
{
  AMJU_CALL_STACK;

  DecCount();
  Copy(rhs);
  IncCount();
  
  return *this;
}
示例#4
0
void TaintWarning::WarnIfTainted(CStrRef s, const taint_t bit) {
  const TaintData& td = s.get()->getTaintDataRefConst();
  if (!(td.getTaint() & bit)) { return; }

  bool force_warning = false;
  std::string buf, aux;

  buf = "Using a ";
  switch (bit) {
    case TAINT_BIT_HTML:
      buf += "HTML-unsafe (tainted)";
      if (TaintTracer::IsTraceEnabled(TAINT_BIT_TRACE_HTML)) {
        force_warning = true;
        aux = TaintTracer::ExtractTrace(td.getTaintTrace());
      }
      break;

    case TAINT_BIT_MUTATED:
      buf += "non-static (tainted)";
      break;

    case TAINT_BIT_SQL:
      buf += "SQL-unsafe (tainted)";
      break;

    case TAINT_BIT_SHELL:
      buf += "shell-unsafe (tainted)";
      break;

    case TAINT_BIT_ALL:
      buf += "tainted";
      break;

    default:
      return;
  }
  buf += " string!\n";

  if (RuntimeOption::EnableTaintWarnings || force_warning) {
    buf += aux;
    buf += "\n";

    buf += "---begin output---\n";
    buf += s.c_str();
    buf += "\n";
    buf += "----end output----\n";

    ZeroCount(bit);
    raise_warning(buf);
  } else {
    IncCount(bit);
  }
}
示例#5
0
/**************************************************************
*	Purpose:
*		Returns current card then increments the card location
*		for next card.
*	Entry:
*		None.
*	Exit:
*		None.
****************************************************************/
const Card& Deck::Deal()
{
	if (m_current_card >= MAXCARDS) // is card not in deck?
	{
		Shuffle();
	}

	IncCount();

	return *m_deck[m_current_card++];	// returns current card, increments 
										// current card for next card
}
示例#6
0
/**************************************************************
*	Purpose:
*		Returns current card then increments the card location
*		for next card.
*	Entry:
*		None.
*	Exit:
*		None.
****************************************************************/
void Deck::DisplayAll()
{
	for (int row = 0; row < 13; row++)
	{
		for (int col = 0; col < 4; col++) // rank goes to 13 (King)
		{
			m_deck[row * 4 + col]->Display();
			IncCount();
		}
		cout << endl;
	}
}
示例#7
0
//
// CDDrawObject::UpdateAndFlipSurfaces(): Prepares the back buffer and flips.
//
HRESULT CDDrawObject::UpdateAndFlipSurfaces(void)
{
    DbgLog((LOG_TRACE, 5, TEXT("CDDrawObject::UpdateAndFlipSurfaces() entered"))) ;
    
    // Draw screen and color key on the current back buffer
    HRESULT  hr = FillSurface(m_pBackBuff) ;
    if (FAILED(hr))
    {
        DbgLog((LOG_ERROR, 1, TEXT("UpdateAndFlipSurfaces() skipped as FillSurface() failed"), hr)) ;
        return hr ;   // or return S_OK??
    }
    
    IncCount() ;                    // increment flip count first
    m_bFrontBuff = !m_bFrontBuff ;  // toggle flag
    DrawOnSurface(m_pBackBuff) ;  // draw next text on the back buffer
    
    // Keep trying to flip the buffers until successful
    while (1)
    {
        hr = m_pPrimary->Flip(NULL, 0) ;  // flip the surfaces
        if (DD_OK == hr)  // success!!
        {
            break ;
        }

        if (DDERR_SURFACELOST == hr)   // surface lost; try to restore
        {
            DbgLog((LOG_TRACE, 5, TEXT("DirectDraw surface was lost. Trying to restore..."))) ;
            hr = m_pPrimary->Restore() ;
            if (DD_OK != hr)  // couldn't restore surface
            {
                DbgLog((LOG_ERROR, 0, TEXT("IDirectDrawSurface::Restore() failed (Error 0x%lx)"), hr)) ;
                break ;
            }
        }

        if (DDERR_WASSTILLDRAWING != hr)  // some weird error -- bail out
        {
            DbgLog((LOG_ERROR, 0, TEXT("IDirectDrawSurface::Flip() failed (Error 0x%lx)"), hr)) ;
            break ;
        }
    }
    
    return hr ;
}