示例#1
0
文件: pm.c 项目: hukumka/cnos
void InitNewGDT(uint32 newAddr){
	SetupGDT(newAddr);
	AddDescriptor(0,0xf0000, GDT_CODE_PL0);
	AddDescriptor(0,0xf0000, GDT_DATA_PL0);

	UserSegmentsBase = GDTR.size;
	// Занмаем место для дескрипторов, которые могут понадобиться в будущем
	for(int i=0;i<USER_SEGMENTS_COUNT;++i)
		AddDescriptor(0,0,0);
	ApplyGDT();
}
示例#2
0
void Multipart_CacheStorage::ConstructL(Cache_Storage * initial_storage, OpStringS8 &content_encoding)
{
	StreamCache_Storage::ConstructL(initial_storage, content_encoding);

	desc = StreamCache_Storage::GetDescriptor(NULL, TRUE, FALSE, NULL);
	if(GetContentEncoding().HasContent())
	{
		OpStackAutoPtr<URL_DataDescriptor> desc1(OP_NEW_L(URL_DataDescriptor, (url, NULL)));
		LEAVE_IF_ERROR(desc1->Init(TRUE));
#ifdef _HTTP_COMPRESS
		desc1->SetupContentDecodingL(GetContentEncoding().CStr());
#endif
		
		if(desc1->GetFirstDecoder() != NULL)
		{
			desc1->SetSubDescriptor(desc);
			desc = desc1.release();
			AddDescriptor(desc);
		}
		// Auto cleanup
	}

	if(desc == NULL)
		LEAVE(OpStatus::ERR_NULL_POINTER);
}
示例#3
0
void MP4DescriptorProperty::Generate()
{
	// generate a default descriptor
	// if it is mandatory, and single
	if (m_mandatory && m_onlyOne) {
		MP4Descriptor* pDescriptor = 
			AddDescriptor(m_tagsStart);
		pDescriptor->Generate();
	}
}
示例#4
0
void MP4DescriptorProperty::Read(MP4File* pFile, u_int32_t index)
{
	ASSERT(index == 0);

	if (m_implicit) {
		return;
	}

	u_int64_t start = pFile->GetPosition();

	while (true) {
		// enforce size limitation
		if (m_sizeLimit && pFile->GetPosition() >= start + m_sizeLimit) {
			break;
		}

		u_int8_t tag;
		try {
			pFile->PeekBytes(&tag, 1);
		}
		catch (MP4Error* e) {
			if (pFile->GetPosition() >= pFile->GetSize()) {
				// EOF
				delete e;
				break;
			}
			throw e;
		}

		// check if tag is in desired range
		if (tag < m_tagsStart || tag > m_tagsEnd) {
			break;
		}

		MP4Descriptor* pDescriptor = 
			AddDescriptor(tag);

		pDescriptor->Read(pFile);
	}

	// warnings
	if (m_mandatory && m_pDescriptors.Size() == 0) {
		VERBOSE_READ(pFile->GetVerbosity(),
			printf("Warning: Mandatory descriptor 0x%02x missing\n",
				m_tagsStart));
	} else if (m_onlyOne && m_pDescriptors.Size() > 1) {
		VERBOSE_READ(pFile->GetVerbosity(),
			printf("Warning: Descriptor 0x%02x has more than one instance\n",
				m_tagsStart));
	}
}
示例#5
0
文件: pm.c 项目: hukumka/cnos
static void SetupGDT(uint32 newAddr){
	GDTR.gdt_pointer = (void*)newAddr;
	GDTR.size = 0;
	AddDescriptor(0,0,0);
} 
// Add descriptors to the index.
void FlannDescriptorKDTree::AddDescriptors(
    std::vector<Descriptor>& descriptors) {
  for (auto& descriptor : descriptors) {
    AddDescriptor(descriptor);
  }
}