Beispiel #1
0
const char* IndexMetaDataKey::decode(const char* start, const char* limit, IndexMetaDataKey* result)
{
    KeyPrefix prefix;
    const char* p = KeyPrefix::decode(start, limit, &prefix);
    if (!p)
        return 0;
    ASSERT(prefix.m_databaseId);
    ASSERT(!prefix.m_objectStoreId);
    ASSERT(!prefix.m_indexId);
    if (p == limit)
        return 0;
    unsigned char typeByte = 0;
    p = decodeByte(p, limit, typeByte);
    ASSERT_UNUSED(typeByte, typeByte == IndexMetaDataTypeByte);
    if (p == limit)
        return 0;
    p = decodeVarInt(p, limit, result->m_objectStoreId);
    if (!p)
        return 0;
    p = decodeVarInt(p, limit, result->m_indexId);
    if (!p)
        return 0;
    if (p == limit)
        return 0;
    return decodeByte(p, limit, result->m_metaDataType);
}
Beispiel #2
0
	static ErrorStatus decodeData()
	{
		ErrorStatus byteStatus = decodeByte();
		switch(byteStatus)
		{
		case failure:
			return failure;
		case unfinished:
			return unfinished;
		case success:
			break;
		}

		if(itsAdbPacket->datalen >= 8)
		{
			signalError(19);

			// too much data!
			return failure;
		}

		itsAdbPacket->data[itsAdbPacket->datalen] = decodeData_byte;
		itsAdbPacket->datalen++;

		initDecodeByte(&decodeData_byte);

		return unfinished;
	}
Beispiel #3
0
uint8_t MagStripe::saveByte(uint8_t thisByte[]) {
#if MAGSTRIPE_DEBUG
  for (int i = 0; i < 5; i = i + 1) {
    Serial.print(thisByte[i], DEC);
  }
  Serial.print("\t");
  Serial.print(decodeByte(thisByte));
  Serial.println("");
#endif
  uint8_t value = decodeByte(thisByte);
  if (value == ';') return ';'; // Ignore start sentinel
  if (value == '?') return '?'; // Ignore end sentinel
  _cardData[_dataSize] = value;
  _dataSize++;
  return value;
}
bool decode(void)
{
    validMIRP_rx = 0;
    if(!PORTBbits.RB5)
    {
        if(checkStart()) 
        {
            /*mirpRx.id_h = decodeByte();
            mirpRx.id_l = decodeByte();
            mirpRx.spell_id = decodeByte();
            mirpRx.str = decodeByte();
            mirpRx.uuid = decodeByte();
            mirpRx.crc = decodeByte();*/
            /*mirp[0] = decodeByte(); //id_h
            mirp[1] = decodeByte(); //id_l
            mirp[2] = decodeByte(); //spell
            mirp[3] = decodeByte(); //str
            mirp[4] = decodeByte(); //uuid
            mirp[5] = decodeByte(); //crc*/
            IDH = decodeByte();
            IDL = decodeByte();
            SPELL = decodeByte();
            STR = decodeByte();
            UID = decodeByte();
            CRC = decodeByte();
        }
        validMIRP_rx = checkCRC();
    }
    counter_rx = 0; //move this out here
    return validMIRP_rx;
}
Beispiel #5
0
// FIXME: We never use this to look up object store ids, because a mapping
// is kept in the IDBDatabaseBackendImpl. Can the mapping become unreliable?
// Can we remove this?
const char* ObjectStoreNamesKey::decode(const char* start, const char* limit, ObjectStoreNamesKey* result)
{
    KeyPrefix prefix;
    const char* p = KeyPrefix::decode(start, limit, &prefix);
    if (!p)
        return 0;
    ASSERT(prefix.m_databaseId);
    ASSERT(!prefix.m_objectStoreId);
    ASSERT(!prefix.m_indexId);
    if (p == limit)
        return 0;
    unsigned char typeByte = 0;
    p = decodeByte(p, limit, typeByte);
    ASSERT_UNUSED(typeByte, typeByte == ObjectStoreNamesTypeByte);
    return decodeStringWithLength(p, limit, result->m_objectStoreName);
}
Beispiel #6
0
HUFF *decodeTree(BYTE **data)
{
    HUFF *next;
    switch(decodeBit(data))
    {
        case 0:
            next = calloc(sizeof(HUFF),1);
            next->ch = -1;
            next->children[0] = decodeTree(data);
            next->children[1] = decodeTree(data);
            break;
        case 1:
            next = &freqs[decodeByte(data)];
            break;
    }
    return next;
}