コード例 #1
0
FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const {
  if (this == pOther)
    return TRUE;
  if (!pOther)
    return FALSE;
  if (pOther->m_Type != m_Type) {
    if (IsReference() && GetDirect())
      return GetDirect()->IsIdentical(pOther);
    if (pOther->IsReference())
      return IsIdentical(pOther->GetDirect());
    return FALSE;
  }
  switch (m_Type) {
    case PDFOBJ_BOOLEAN:
      return AsBoolean()->Identical(pOther->AsBoolean());
    case PDFOBJ_NUMBER:
      return AsNumber()->Identical(pOther->AsNumber());
    case PDFOBJ_STRING:
      return AsString()->Identical(pOther->AsString());
    case PDFOBJ_NAME:
      return AsName()->Identical(pOther->AsName());
    case PDFOBJ_ARRAY:
      return AsArray()->Identical(pOther->AsArray());
    case PDFOBJ_DICTIONARY:
      return AsDictionary()->Identical(pOther->AsDictionary());
    case PDFOBJ_NULL:
      return TRUE;
    case PDFOBJ_STREAM:
      return AsStream()->Identical(pOther->AsStream());
    case PDFOBJ_REFERENCE:
      return AsReference()->Identical(pOther->AsReference());
  }
  return FALSE;
}
コード例 #2
0
BOOL CIndexedMemory::PrivateGetDetail(OIndex oi, void** ppvData, unsigned int* puiSize, int* piIndex)
{
	if (asIndexCache[0].oi == oi)
	{
		*piIndex = asIndexCache[0].iIndex;
		return GetDirect(asIndexCache[0].iIndex, ppvData, puiSize);
	}
	else if (asIndexCache[1].oi == oi)
	{
		*piIndex = asIndexCache[1].iIndex;
		return GetDirect(asIndexCache[1].iIndex, ppvData, puiSize);
	}
	else if (asIndexCache[2].oi == oi)
	{
		*piIndex = asIndexCache[2].iIndex;
		return GetDirect(asIndexCache[2].iIndex, ppvData, puiSize);
	}
	else if (asIndexCache[3].oi == oi)
	{
		*piIndex = asIndexCache[3].iIndex;
		return GetDirect(asIndexCache[3].iIndex, ppvData, puiSize);
	}
	else
	{
		return GetNoCacheTest(oi, ppvData, puiSize, piIndex);
	}
}
コード例 #3
0
ファイル: direct.cpp プロジェクト: tchv71/ScadViewer
EXPORT void    DIRECT::GetDirect(WORD NumPP, double MKA[9], BYTE &Type, WORD &Qnt, WORD * *Lst )
{
	   DIRECT_LIST *pWork = GetDirect(NumPP);
	   if ( pWork == NULL ) return;
	   memcpy(MKA,pWork->MatrCos,9*sizeof(double));
	   Type = pWork->Type;
	   Qnt  = pWork->Quantity;
	  *Lst  = pWork->List;
}
コード例 #4
0
ファイル: cpdf_reference.cpp プロジェクト: hfiguiere/pdfium
CPDF_Object* CPDF_Reference::CloneNonCyclic(
    bool bDirect,
    std::set<const CPDF_Object*>* pVisited) const {
  pVisited->insert(this);
  if (bDirect) {
    auto* pDirect = GetDirect();
    return pDirect && !pdfium::ContainsKey(*pVisited, pDirect)
               ? pDirect->CloneNonCyclic(true, pVisited)
               : nullptr;
  }
  return new CPDF_Reference(m_pObjList, m_RefObjNum);
}
コード例 #5
0
FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const
{
    if (this == pOther) {
        return TRUE;
    }
    if (pOther == NULL) {
        return FALSE;
    }
    if (pOther->m_Type != m_Type) {
        if (m_Type == PDFOBJ_REFERENCE && GetDirect()) {
            return GetDirect()->IsIdentical(pOther);
        }
        if (pOther->m_Type == PDFOBJ_REFERENCE) {
            return IsIdentical(pOther->GetDirect());
        }
        return FALSE;
    }
    switch (m_Type) {
        case PDFOBJ_BOOLEAN:
            return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther));
        case PDFOBJ_NUMBER:
            return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther));
        case PDFOBJ_STRING:
            return (((CPDF_String*)this)->Identical((CPDF_String*)pOther));
        case PDFOBJ_NAME:
            return (((CPDF_Name*)this)->Identical((CPDF_Name*)pOther));
        case PDFOBJ_ARRAY:
            return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther));
        case PDFOBJ_DICTIONARY:
            return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther));
        case PDFOBJ_NULL:
            return TRUE;
        case PDFOBJ_STREAM:
            return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther));
        case PDFOBJ_REFERENCE:
            return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther));
    }
    return FALSE;
}
コード例 #6
0
ファイル: sslenc.cpp プロジェクト: prestocore/browser
SSL_Record_Base *SSL_Record_Base::Encrypt(SSL_CipherSpec *cipher)
{
	uint32 blocksize;
	if(cipher == NULL || (blocksize = cipher->Method->InputBlockSize()) == 0)
	{
		RaiseAlert(SSL_Fatal, SSL_InternalError);
		return NULL;
	}

	OpStackAutoPtr<SSL_Record_Base> encrypt_target(InitEncryptTarget());
	if(ErrorRaisedFlag)
		return NULL;

	LoadAndWritableList crypt_source;
	SSL_secure_varvector32 IV;
	SSL_secure_varvector16 payload_data;
	SSL_secure_varvector16 MAC_data;
	SSL_secure_varvector16 pad_data;

	crypt_source.ForwardTo(this);

	if(encrypt_target->IV_field && blocksize > 1)
	{
		crypt_source.AddItem(&IV);
		// Keep the IV from the previous record (option 2b from RFC 4346)
		IV.SetEnableRecord(TRUE);
		IV.FixedLoadLength(TRUE);
	
		SSL_RND(IV, blocksize);
	}

	crypt_source.AddItem(&payload_data);
	payload_data.SetExternal(GetDirect());
	payload_data.Resize(GetLength());
	payload_data.FixedLoadLength(TRUE);


	crypt_source.AddItem(&MAC_data);
	MAC_data.Resize(cipher->MAC->Size());
	MAC_data.FixedLoadLength(TRUE);


	if(ErrorRaisedFlag)
		return NULL;

	if(blocksize > 1)
	{
		uint16 plen = payload_data.GetLength() + MAC_data.GetLength();
		uint16 elen = cipher->Method->Calc_BufferSize(plen);

		uint16 paddinglength = (elen-plen);
		if(paddinglength == 0)
			paddinglength = blocksize;
		uint8 pad_char = (uint8) (paddinglength-1);

		crypt_source.AddItem(&pad_data);
		pad_data.Resize(paddinglength);
		pad_data.Blank(pad_char);
		pad_data.FixedLoadLength(TRUE);
	}

	{
		SSL_ContentType r_type;
		SSL_ProtocolVersion r_ver;

		r_type = GetType();
		r_ver = GetVersion();
		encrypt_target->SetType(r_type);
		encrypt_target->SetVersion(r_ver);

		if(MAC_data.GetLength())
		{
			SSL_TRAP_AND_RAISE_ERROR_THIS(cipher->MAC->CalculateRecordMAC_L(cipher->Sequence_number, r_ver,
				r_type, payload_data,pad_data.GetDirect(), pad_data.GetLength(), MAC_data));
		}
	}

	SSL_secure_varvector16 tempdata;

	SSL_TRAP_AND_RAISE_ERROR_THIS(crypt_source.WriteRecordL(&tempdata));
	if(ErrorRaisedFlag)
		return NULL;

	cipher->Method->EncryptVector(tempdata, *encrypt_target);

	cipher->Sequence_number++;
	if(ErrorRaisedFlag || cipher->Method->Error())
		return NULL;

	return encrypt_target.release();
}
コード例 #7
0
ファイル: cpdf_reference.cpp プロジェクト: hfiguiere/pdfium
CPDF_Object* CPDF_Reference::SafeGetDirect() const {
  CPDF_Object* obj = GetDirect();
  return (obj && !obj->IsReference()) ? obj : nullptr;
}