Пример #1
0
static IC_Entry 
readICEntry (void) 
{
    IC_Entry entry;

    MALLOCVAR(entry);

    if (entry == NULL)
        pm_error("Unable to allcoate memory for IC entry");

    entry->width         = readU1();
    entry->height        = readU1();
    entry->color_count   = readU1();
    entry->reserved      = readU1();
    entry->planes        = readU2();
    entry->bitcount      = readU2();
    entry->size_in_bytes = readU4();
    entry->file_offset   = readU4();
    entry->colors        = NULL;
    entry->ih            = NULL;
    entry->xorBitmap     = NULL;
    entry->andBitmap     = NULL;
    
    return entry;
}
Пример #2
0
static IC_InfoHeader 
readInfoHeader (IC_Entry entry) 
{
    IC_InfoHeader ih;

    MALLOCVAR(ih);
    
    if (ih == NULL)
        pm_error("Unable to allocate memory for info header");

    ih->size            = readU4();
    ih->width           = readU4();
    ih->height          = readU4();
    ih->planes          = readU2();
    ih->bitcount        = readU2();
    ih->compression     = readU4();
    ih->imagesize       = readU4();
    ih->x_pixels_per_m  = readU4();
    ih->y_pixels_per_m  = readU4();
    ih->colors_used     = readU4();
    ih->colors_important = readU4();
    
    if (!entry->bitcount) entry->bitcount = ih->bitcount;
    if (entry->color_count == 0 && 
        entry->bitcount <= 8) entry->color_count = 256;
    if (ih->compression) {
        pm_error("Can't handle compressed icons");
    }
    return ih;
}
Пример #3
0
	exceptionTable->startPc = readU2(fp);
	exceptionTable->endPc = readU2(fp);
	exceptionTable->handlerPc = readU2(fp);
	exceptionTable->catchType = readU2(fp);
}

/**
A funcao faz a leitura do atributo do tipo Code classfile
*/
void readCodeAttribute(ClassFile* class, FILE *fp, AttributeInfo *attributes)
{
	int i;

	attributes->AttributeType.CodeAttribute.maxStack = readU2(fp);
	attributes->AttributeType.CodeAttribute.maxLocals = readU2(fp);
	attributes->AttributeType.CodeAttribute.codeLength = readU4(fp);
	attributes->AttributeType.CodeAttribute.code = malloc((attributes->AttributeType.CodeAttribute.codeLength) * sizeof(u1));
	for(i = 0; i < attributes->AttributeType.CodeAttribute.codeLength; i++)
	{
		attributes->AttributeType.CodeAttribute.code[i] = readU1(fp);
	}
	attributes->AttributeType.CodeAttribute.exceptionTableLength = readU2(fp);
	attributes->AttributeType.CodeAttribute.exceptionTable = malloc((attributes->AttributeType.CodeAttribute.exceptionTableLength) * sizeof(ExceptionTable));
	for(i = 0; i < attributes->AttributeType.CodeAttribute.exceptionTableLength; i++)
	{
		readExceptionTable(fp, &(attributes->AttributeType.CodeAttribute.exceptionTable[i]));
	}
	attributes->AttributeType.CodeAttribute.attributesCount = readU2(fp);
	attributes->AttributeType.CodeAttribute.attributes = malloc((attributes->AttributeType.CodeAttribute.attributesCount) * sizeof(AttributeInfo));
	for(i = 0; i < attributes->AttributeType.CodeAttribute.attributesCount; i++)
	{