示例#1
0
 void AFRA::setGlobalEntries(bool newVal) {
   if (newVal) {
     setInt8((getInt8(4) & 0xDF) + 0x20, 4);
   } else {
     setInt8((getInt8(4) & 0xDF), 4);
   }
 }
示例#2
0
 void ABST::setSegmentRunTable(ASRT & newSegment, uint32_t no) {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   int countLoc = tempLoc;
   tempLoc++; //skip segmentRuntableCount
   //attempt to reach the wanted position
   unsigned int i;
   for (i = 0; i < getInt8(countLoc) && i < no; ++i) {
     tempLoc += getBoxLen(tempLoc);
   }
   //we are now either at the end, or at the right position
   //let's reserve any unreserved space...
   if (no + 1 > getInt8(countLoc)) {
     int amount = no + 1 - getInt8(countLoc);
     if (!reserve(payloadOffset + tempLoc, 0, amount * 8)) {
       return;
     };
     //set empty erro boxes as contents
     for (int j = 0; j < amount; ++j) {
       memcpy(data + payloadOffset + tempLoc + j * 8, "\000\000\000\010erro", 8);
     }
     setInt8(no + 1, countLoc); //set new count
     tempLoc += (no - i) * 8;
   }
   //now, tempLoc is at position for string number no, and we have at least an erro box reserved.
   setBox(newSegment, tempLoc);
 }
示例#3
0
 void ABST::setQualityEntry(std::string & newEntry, uint32_t no) {
   int countLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     countLoc += getStringLen(countLoc) + 1;
   }
   int tempLoc = countLoc + 1;
   //attempt to reach the wanted position
   unsigned int i;
   for (i = 0; i < getInt8(countLoc) && i < no; ++i) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   //we are now either at the end, or at the right position
   //let's reserve any unreserved space...
   if (no + 1 > getInt8(countLoc)) {
     int amount = no + 1 - getInt8(countLoc);
     if (!reserve(payloadOffset + tempLoc, 0, amount)) {
       return;
     };
     memset(data + payloadOffset + tempLoc, 0, amount);
     setInt8(no + 1, countLoc); //set new qualityEntryCount
     tempLoc += no - i;
   }
   //now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
   setString(newEntry, tempLoc);
 }
示例#4
0
 void AFRA::setLongIDs(bool newVal) {
   if (newVal) {
     setInt8((getInt8(4) & 0x7F) + 0x80, 4);
   } else {
     setInt8((getInt8(4) & 0x7F), 4);
   }
 }
示例#5
0
 void AFRA::setLongOffsets(bool newVal) {
   if (newVal) {
     setInt8((getInt8(4) & 0xBF) + 0x40, 4);
   } else {
     setInt8((getInt8(4) & 0xBF), 4);
   }
 }
示例#6
0
Int8List* MtpDataPacket::getAInt8() {
    Int8List* result = new Int8List;
    int count = getUInt32();
    for (int i = 0; i < count; i++)
        result->push_back(getInt8());
    return result;
}
示例#7
0
 afrt_runtable AFRT::getFragmentRun(uint32_t no) {
   afrt_runtable res;
   if (no > getFragmentRunCount()) {
     return res;
   }
   int tempLoc = 9;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += 4;
   for (unsigned int i = 0; i < no; i++) {
     if (getInt32(tempLoc + 12) == 0) {
       tempLoc += 17;
     } else {
       tempLoc += 16;
     }
   }
   res.firstFragment = getInt32(tempLoc);
   res.firstTimestamp = getInt64(tempLoc + 4);
   res.duration = getInt32(tempLoc + 12);
   if (res.duration) {
     res.discontinuity = getInt8(tempLoc + 16);
   } else {
     res.discontinuity = 0;
   }
   return res;
 }
示例#8
0
 AFRT & ABST::getFragmentRunTable(uint32_t no) {
   static Box result;
   if (no >= getFragmentRunTableCount()) {
     static Box res;
     return (AFRT &)res;
   }
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   for (unsigned int i = getInt8(tempLoc++); i != 0; --i) {
     tempLoc += getBoxLen(tempLoc);
   }
   tempLoc++;
   for (unsigned int i = 0; i < no; i++) {
     tempLoc += getBoxLen(tempLoc);
   }
   return (AFRT &)getBox(tempLoc);
 }
示例#9
0
 uint32_t ABST::getFragmentRunTableCount() {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   for (unsigned int i = getInt8(tempLoc++); i != 0; --i) {
     tempLoc += getBoxLen(tempLoc);
   }
   return getInt8(tempLoc);
 }
示例#10
0
 uint32_t ABST::getQualityEntryCount() {
   int countLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     countLoc += getStringLen(countLoc) + 1;
   }
   return getInt8(countLoc);
 }
示例#11
0
 /** Return value as integer, depending on length.
   */
 int getInt()   {
    switch(mLength) {
    case sizeof(int8_t): return getInt8(); break;
    case sizeof(int16_t): return getInt16(); break;
    case sizeof(int32_t): default: return getInt32(); break;
    }
    return 0;
 }
示例#12
0
/*parse mysql coded length*/
static uint64_t decodeint(uint8_t *ev ,uint32_t *cur){
	uint8_t v = getInt8(ev);
	*cur += 1;
	if(v < 251) return v;
	if(v == 251) return 0;	
	if(v == 252){ *cur += 2; return getUint16(ev + 1); }
	if(v == 253){ *cur += 3; return getUint24(ev + 1); }
	if(v == 254){ *cur += 8; return getUint64(ev + 1); }
	return 0;
}
示例#13
0
Int8List* MtpDataPacket::getAInt8() {
    uint32_t count;
    if (!getUInt32(count))
        return NULL;
    Int8List* result = new Int8List;
    for (uint32_t i = 0; i < count; i++) {
        int8_t value;
        if (!getInt8(value)) {
            delete result;
            return NULL;
        }
        result->push(value);
    }
    return result;
}
示例#14
0
void printCell(Cell *cell){
	switch(cell->ctype){
		case INT32:
			printf("%d\t",getInt32(cell->value));
			break;
		case UINT32:
			printf("%d\t",getUint32(cell->value));
			break;
		case INT64:
			printf("%ld\t",getInt64(cell->value));
			break;
		case UINT64:
			printf("%lu\t",getUint64(cell->value));
			break;
		case INT8:
			printf("%d",getInt8(cell->value));
			break;
		case INT16:
			printf("%d",getInt16(cell->value));
			break;
		case FLOAT:
			printf("%f\t",getFloat(cell->value));
			break;
		case DOUBLE:
			printf("%f\t",getDouble(cell->value));
			break;
		case STRING: //MySQL type BINARY may be STRING
			{   
				char *value =(char *) cell->value;
				printf("%s\t",(char*)value);
				break;

			}   
		case BINARY:
			printf("BINARY\t");
			break;
		default:
			printf("UNKNOW\t");
			break;

	}
}
示例#15
0
 uint32_t SDTP::getValue(size_t index) {
   return getInt8(index);
 }
示例#16
0
 uint32_t SDTP::getVersion() {
   return getInt8(0);
 }
示例#17
0
 uint32_t UUID_TFXD::getVersion() {
   return getInt8(16);
 }
示例#18
0
 uint32_t UUID_TrackFragmentReference::getVersion() {
   return getInt8(16);
 }
示例#19
0
 uint32_t UUID_TrackFragmentReference::getFragmentCount() {
   return getInt8(20);
 }
 int8_t ClientMessage::get() {
     return getInt8();
 }
示例#21
0
static int
pcfIdentify(fontFile *f, char **name)
{
    int prop_position;
    PropPtr props = NULL;
    int format, count, nprops, i, string_size, rc;
    char *strings = NULL, *s;

    count = getLSB32(f);
    if(count <= 0)
        goto fail;

    prop_position = -1;
    for(i = 0; i < count; i++) {
        int type, offset;
        type = getLSB32(f);
        (void) getLSB32(f);
        (void) getLSB32(f);
        offset = getLSB32(f);
        if(type == PCF_PROPERTIES) {
            prop_position = offset;
            break;
        }
    }
    if(prop_position < 0)
        goto fail;

    rc = fontFileSeek(f, prop_position, SEEK_SET);
    if(rc < 0)
        goto fail;

    format = getLSB32(f);
    if((format & 0xFFFFFF00) != 0)
        goto fail;
    nprops = getInt32(f, format);
    if(nprops <= 0 || nprops > 1000)
        goto fail;
    props = malloc(nprops * sizeof(PropRec));
    if(props == NULL)
        goto fail;

    for(i = 0; i < nprops; i++) {
        props[i].name = getInt32(f, format);
        props[i].isString = getInt8(f, format);
        props[i].value = getInt32(f, format);
    }
    if(nprops & 3) {
	rc = fontFileSeek(f, 4 - (nprops & 3), SEEK_CUR);
        if(rc < 0)
            goto fail;
    }

    string_size = getInt32(f, format);
    if(string_size < 0 || string_size > 100000)
        goto fail;
    strings = malloc(string_size);
    if(!strings)
        goto fail;

    rc = fontFileRead(f, strings, string_size);
    if(rc != string_size)
        goto fail;

    for(i = 0; i < nprops; i++) {
        if(!props[i].isString ||
           props[i].name >= string_size - 4 ||
           props[i].value >= string_size)
            continue;
        if(strcmp(strings + props[i].name, "FONT") == 0)
            break;
    }

    if(i >= nprops)
        goto fail;

    s = malloc(strlen(strings + props[i].value) + 1);
    if(s == NULL)
        goto fail;
    strcpy(s, strings + props[i].value);
    *name = s;
    free(strings);
    free(props);
    fontFileClose(f);
    return 1;

 fail:
    if(strings) free(strings);
    if(props) free(props);
    fontFileClose(f);
    return 0;
}
示例#22
0
 uint32_t ASRT::getQualityEntryCount() {
   return getInt8(4);
 }
示例#23
0
 uint32_t ASRT::getVersion() {
   return getInt8(0);
 }
示例#24
0
static int8_t readInt8(EventCursor *evcur){
	int8_t v = getInt8(evcur->ev + evcur->cur);
	evcur->cur += 1;
	return v;
}
示例#25
0
 void ABST::setUpdate(bool newUpdate) {
   //update = bit 5 of byte 8.
   setInt8((getInt8(8) & 0xEF) + (newUpdate ? 0x08 : 0), 8);
 }
示例#26
0
 bool AFRA::getGlobalEntries() {
   return getInt8(4) & 0x20;
 }
示例#27
0
 bool ABST::getUpdate() {
   return (getInt8(8) & 0x08);
 }
示例#28
0
 bool AFRA::getLongOffsets() {
   return getInt8(4) & 0x40;
 }
示例#29
0
 uint32_t AFRA::getVersion() {
   return getInt8(0);
 }
示例#30
0
 bool AFRA::getLongIDs() {
   return getInt8(4) & 0x80;
 }