void CFX_CTTGSUBTable::ParseSingleSubstFormat1(FT_Bytes raw, TSingleSubstFormat1* rec) { FT_Bytes sp = raw; GetUInt16(sp); TT_uint16_t offset = GetUInt16(sp); ParseCoverage(&raw[offset], &rec->Coverage); rec->DeltaGlyphID = GetInt16(sp); }
void CFX_CTTGSUBTable::ParseFeature(FT_Bytes raw, TFeature* rec) { int i; FT_Bytes sp = raw; rec->FeatureParams = GetUInt16(sp); rec->LookupCount = GetUInt16(sp); if (rec->LookupCount <= 0) { return; } rec->LookupListIndex = new TT_uint16_t[rec->LookupCount]; for (i = 0; i < rec->LookupCount; i++) { rec->LookupListIndex[i] = GetUInt16(sp); } }
void CFX_CTTGSUBTable::ParseLookupList(FT_Bytes raw, TLookupList* rec) { int i; FT_Bytes sp = raw; rec->LookupCount = GetUInt16(sp); if (rec->LookupCount <= 0) { return; } rec->Lookup = new struct TLookup[rec->LookupCount]; for (i = 0; i < rec->LookupCount; i++) { TT_uint16_t offset = GetUInt16(sp); ParseLookup(&raw[offset], &rec->Lookup[i]); } }
void CFX_CTTGSUBTable::ParseCoverageFormat1(FT_Bytes raw, TCoverageFormat1 *rec) { int i; FT_Bytes sp = raw; GetUInt16(sp); rec->GlyphCount = GetUInt16(sp); if(rec->GlyphCount <= 0) { return; } rec->GlyphArray = new TT_uint16_t[rec->GlyphCount]; for(i = 0; i < rec->GlyphCount; i++) { rec->GlyphArray[i] = GetUInt16(sp); } }
void CFX_CTTGSUBTable::ParseScriptList(FT_Bytes raw, struct TScriptList* rec) { int i; FT_Bytes sp = raw; rec->ScriptCount = GetUInt16(sp); if (rec->ScriptCount <= 0) { return; } rec->ScriptRecord = new struct TScriptRecord[rec->ScriptCount]; for (i = 0; i < rec->ScriptCount; i++) { rec->ScriptRecord[i].ScriptTag = GetUInt32(sp); TT_uint16_t offset = GetUInt16(sp); ParseScript(&raw[offset], &rec->ScriptRecord[i].Script); } }
void CFX_CTTGSUBTable::ParseFeatureList(FT_Bytes raw, TFeatureList* rec) { int i; FT_Bytes sp = raw; rec->FeatureCount = GetUInt16(sp); if (rec->FeatureCount <= 0) { return; } rec->FeatureRecord = new struct TFeatureRecord[rec->FeatureCount]; for (i = 0; i < rec->FeatureCount; i++) { rec->FeatureRecord[i].FeatureTag = GetUInt32(sp); TT_uint16_t offset = GetUInt16(sp); ParseFeature(&raw[offset], &rec->FeatureRecord[i].Feature); } }
void CFX_CTTGSUBTable::ParseLangSys(FT_Bytes raw, struct TLangSys* rec) { FT_Bytes sp = raw; rec->LookupOrder = GetUInt16(sp); rec->ReqFeatureIndex = GetUInt16(sp); rec->FeatureCount = GetUInt16(sp); if (rec->FeatureCount <= 0) { return; } rec->FeatureIndex = new TT_uint16_t[rec->FeatureCount]; FXSYS_memset(rec->FeatureIndex, 0, sizeof(TT_uint16_t) * rec->FeatureCount); for (int i = 0; i < rec->FeatureCount; ++i) { rec->FeatureIndex[i] = GetUInt16(sp); } }
void CTreSubfile::Parse(CSubFile * pSubFile) { m_pSubFile = pSubFile; m_fSubdivisionsParsed = false; m_fLevelsParsed = false; // Read header with constant size { // Read header data Byte data[cnHeaderSize]; pSubFile->Read(data, 0x0, cnHeaderSize); // Get header length m_uiHeaderLength = GetUInt16(data + 0x0); // Read file type m_strType.assign((char*)(data + 0x2), 10); // General data // Read boundaries Int igNorthBoundary = GetInt24(data + 0x15) << (GPWIDTH - 24); Int igEastBoundary = GetInt24(data + 0x18) << (GPWIDTH - 24); Int igSouthBoundary = GetInt24(data + 0x1B) << (GPWIDTH - 24); Int igWestBoundary = GetInt24(data + 0x1E) << (GPWIDTH - 24); if (igEastBoundary <= igWestBoundary) igEastBoundary += (1 << GPWIDTH); m_grBound = GeoRect(igWestBoundary, igEastBoundary, igSouthBoundary, igNorthBoundary); // Get levels block info m_uiMapLevelsOffset = GetUInt32(data + 0x21); m_uiMapLevelsLen = GetUInt32(data + 0x25); // Get subdivisions block info m_uiSubdivisionOffset = GetUInt32(data + 0x29); m_uiSubdivisionLen = GetUInt32(data + 0x2D); // Get polyline block info m_uiPolylineOffset = GetUInt32(data + 0x4A); m_uiPolylineLen = GetUInt32(data + 0x4E); m_uiPolylineRecSize = GetUInt16(data + 0x52); // Get polygons block info m_uiPolygonOffset = GetUInt32(data + 0x58); m_uiPolygonLen = GetUInt32(data + 0x5C); m_uiPolygonRecSize = GetUInt16(data + 0x60); // Get points block info m_uiPointOffset = GetUInt32(data + 0x66); m_uiPointLen = GetUInt32(data + 0x6A); m_uiPointRecSize = GetUInt16(data + 0x6E); } }
void CFX_CTTGSUBTable::ParseScript(FT_Bytes raw, struct TScript* rec) { int i; FT_Bytes sp = raw; rec->DefaultLangSys = GetUInt16(sp); rec->LangSysCount = GetUInt16(sp); if (rec->LangSysCount <= 0) { return; } rec->LangSysRecord = new struct TLangSysRecord[rec->LangSysCount]; for (i = 0; i < rec->LangSysCount; i++) { rec->LangSysRecord[i].LangSysTag = GetUInt32(sp); TT_uint16_t offset = GetUInt16(sp); ParseLangSys(&raw[offset], &rec->LangSysRecord[i].LangSys); } }
void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, TSingleSubstFormat2* rec) { int i; FT_Bytes sp = raw; GetUInt16(sp); TT_uint16_t offset = GetUInt16(sp); ParseCoverage(&raw[offset], &rec->Coverage); rec->GlyphCount = GetUInt16(sp); if (rec->GlyphCount <= 0) { return; } rec->Substitute = new TT_uint16_t[rec->GlyphCount]; for (i = 0; i < rec->GlyphCount; i++) { rec->Substitute[i] = GetUInt16(sp); } }
void CFX_CTTGSUBTable::ParseCoverageFormat2(FT_Bytes raw, TCoverageFormat2 *rec) { int i; FT_Bytes sp = raw; GetUInt16(sp); rec->RangeCount = GetUInt16(sp); if(rec->RangeCount <= 0) { return; } rec->RangeRecord = new TRangeRecord[rec->RangeCount]; for(i = 0; i < rec->RangeCount; i++) { rec->RangeRecord[i].Start = GetUInt16(sp); rec->RangeRecord[i].End = GetUInt16(sp); rec->RangeRecord[i].StartCoverageIndex = GetUInt16(sp); } }
void CFGAS_FontMgr::GetNames(const uint8_t* name_table, CFX_WideStringArray& Names) { if (!name_table) return; uint8_t* lpTable = (uint8_t*)name_table; CFX_WideString wsFamily; uint8_t* sp = lpTable + 2; uint8_t* lpNameRecord = lpTable + 6; uint16_t nNameCount = GetUInt16(sp); uint8_t* lpStr = lpTable + GetUInt16(sp + 2); for (uint16_t j = 0; j < nNameCount; j++) { uint16_t nNameID = GetUInt16(lpNameRecord + j * 12 + 6); if (nNameID != 1) continue; uint16_t nPlatformID = GetUInt16(lpNameRecord + j * 12 + 0); uint16_t nNameLength = GetUInt16(lpNameRecord + j * 12 + 8); uint16_t nNameOffset = GetUInt16(lpNameRecord + j * 12 + 10); wsFamily.clear(); if (nPlatformID != 1) { for (uint16_t k = 0; k < nNameLength / 2; k++) { FX_WCHAR wcTemp = GetUInt16(lpStr + nNameOffset + k * 2); wsFamily += wcTemp; } Names.Add(wsFamily); continue; } for (uint16_t k = 0; k < nNameLength; k++) { FX_WCHAR wcTemp = GetUInt8(lpStr + nNameOffset + k); wsFamily += wcTemp; } Names.Add(wsFamily); } }
void CFX_CTTGSUBTable::ParseLookup(FT_Bytes raw, TLookup* rec) { int i; FT_Bytes sp = raw; rec->LookupType = GetUInt16(sp); rec->LookupFlag = GetUInt16(sp); rec->SubTableCount = GetUInt16(sp); if (rec->SubTableCount <= 0) { return; } rec->SubTable = new struct TSubTableBase*[rec->SubTableCount]; for (i = 0; i < rec->SubTableCount; i++) { rec->SubTable[i] = NULL; } if (rec->LookupType != 1) { return; } for (i = 0; i < rec->SubTableCount; i++) { TT_uint16_t offset = GetUInt16(sp); ParseSingleSubst(&raw[offset], &rec->SubTable[i]); } }
void CFX_CTTGSUBTable::ParseCoverage(FT_Bytes raw, TCoverageFormatBase** rec) { FT_Bytes sp = raw; TT_uint16_t Format = GetUInt16(sp); switch (Format) { case 1: *rec = new TCoverageFormat1(); ParseCoverageFormat1(raw, (TCoverageFormat1*)*rec); break; case 2: *rec = new TCoverageFormat2(); ParseCoverageFormat2(raw, (TCoverageFormat2*)*rec); break; } }
void CFX_CTTGSUBTable::ParseSingleSubst(FT_Bytes raw, TSubTableBase** rec) { FT_Bytes sp = raw; TT_uint16_t Format = GetUInt16(sp); switch (Format) { case 1: *rec = new TSingleSubstFormat1(); ParseSingleSubstFormat1(raw, (TSingleSubstFormat1*)*rec); break; case 2: *rec = new TSingleSubstFormat2(); ParseSingleSubstFormat2(raw, (TSingleSubstFormat2*)*rec); break; } }
Value *GetDefaultValue(CodeGenerator *codegen, AstTypeNode *typeNode) { switch (typeNode->getTypeType()) { default: return nullptr; case node_boolean: return codegen->getBuilder().getFalse(); case node_float: return GetFloat(codegen, 0.0f); case node_double: return GetDouble(codegen, 0.0); case node_signed_integer8: return GetInt8(codegen, 0); case node_signed_integer16: return GetInt16(codegen, 0); case node_signed_integer32: return GetInt32(codegen, 0); case node_signed_integer64: return GetInt64(codegen, 0); case node_unsigned_integer8: return GetUInt8(codegen, 0); case node_unsigned_integer16: return GetUInt16(codegen, 0); case node_unsigned_integer32: return GetUInt32(codegen, 0); case node_unsigned_integer64: return GetUInt64(codegen, 0); case node_string: return GetString(codegen, ""); } }
void CMdbResult::GetNumber(void* v, register uint32 nFieldNo) { switch(GetType(nFieldNo)) { case MDB_INT8_FIELD: *(int8*)v = GetInt8(nFieldNo); break; case MDB_INT16_FIELD: *(int16*)v = GetInt16(nFieldNo); break; case MDB_INT32_FIELD: *(int32*)v = GetInt32(nFieldNo); break; case MDB_INT64_FIELD: *(int64*)v = GetInt64(nFieldNo); break; case MDB_UINT8_FIELD: *(uint8*)v = GetUInt8(nFieldNo); break; case MDB_UINT16_FIELD: *(uint16*)v = GetUInt16(nFieldNo); break; case MDB_UINT32_FIELD: *(uint32*)v = GetUInt32(nFieldNo); break; case MDB_UINT64_FIELD: *(uint64*)v = GetUInt64(nFieldNo); break; case MDB_FLOAT_FIELD: *(float*)v = GetFloat(nFieldNo); break; case MDB_DOUBLE_FIELD: case MDB_DATETIME_FIELD: *(double*)v = GetDouble(nFieldNo); break; case MDB_DATE_FIELD: case MDB_TIME_FIELD: *(int32*)v = GetInt32(nFieldNo); break; } }
/* 扱えるMVNのデータかヘッダを確認 */ bool PacketParserNeuron::CheckHeader(const uint8* raw, const int32 length) { /* ヘッダ部の長さ未満なら不正として終了 */ if (length < 63) return false; int32 index = 0; /* 先頭の文字列を確認 */ if (GetUInt16(raw, 0) != 0xDDFF) return false; index += 2; /* バージョン番号 4バイト */ uint8 verBuildNumb = raw[index++]; uint8 verRevision = raw[index++]; uint8 verMinor = raw[index++]; uint8 verMajor = raw[index++]; /* Ver.1.x.x.x までのみ対応 */ if (verMajor > 1) return false; /* Ver.1.0 と Ver.1.1 でヘッダーの仕様が変わった */ if (verMinor < 1) { /* このパケット中のデータ数 4バイト */ uint32 dataCount = GetUInt32(raw, index); index += 4; /* データ数と受信された長さが一致しなければ不正として終了 */ if (length != (dataCount * 4 + 64)) return false; /* 変位もデータに含まれるか */ this->hasDisplacement = (GetUInt32(raw, index) != 0); index += 4; /* リファレンスが含まれるか */ this->hasReference = (GetUInt32(raw, index) != 0); index += 4; } else { /* このパケット中のデータ数 4バイト */ uint16 dataCount = GetUInt16(raw, index); index += 2; /* データ数と受信された長さが一致しなければ不正として終了 */ if (length != (dataCount * 4 + 64)) return false; /* 変位もデータに含まれるか */ this->hasDisplacement = (raw[index++] != 0); /* リファレンスが含まれるか */ this->hasReference = (raw[index++] != 0); } /* アバターID */ this->userId = GetUInt32(raw, index); index += 4; /* ヘッダーの終了を確認 */ index = 62; if (GetUInt16(raw, index) != 0xEEFF) return false; return true; }