char future[8]; // for future expantion
int32 datatype; // 1 = float32 (XDR), 2 = unsigned int (XDR), 3 = RGBA, 4 = signed integer (XDR)
- // 11 = float32(NDR), 22 = unsigned int (NDR), 44 = signed integer (NDR)
+ // 101 = float32(NDR), 102 = unsigned int (NDR), 104 = signed integer (NDR)
+ // 6 = signed 16 bit (XDR), 7 = unsigned 16 bit(XDR), 8 = unsigned 8(XDR/NDR)
+ // 106 = signed 16 bit (NDR), 107 = unsigned 16 bit (NDR), 108 = unsigned 8 (XDR/NDR)
int32 height;
int32 width;
int32 compression; // 0 = no compression
// this is provided for convenience, it should be set to
// sizeof(chip) bytes into the struct because the serialized form is:
// <header><data>
- unsigned int *data; // data[0] = bottm left, data[width] = 1st pixel, 2nd row
+ void *data; // data[0] = bottm left, data[width] = 1st pixel, 2nd row
+ // THIS MAY NOT ACTUALLY BE 32 bit data!!! watch out!
} CHIP;
int size;
int t;
int input_str_len;
+ int datum_size;
//printf("chip_in called\n");
elog(ERROR,"CHIP_in parser - bad data (endian flag != 1)!");
PG_RETURN_NULL();
}
- if (result->size != (sizeof(CHIP) + 4 * result->width*result->height) )
+ datum_size = 4;
+
+ if ( (result->datatype == 6) || (result->datatype == 7) || (result->datatype == 106) || (result->datatype == 107) )
+ {
+ datum_size = 2;
+ }
+ if ( (result->datatype == 8) || (result->datatype == 108) )
+ {
+ datum_size=1;
+ }
+
+ if (result->size != (sizeof(CHIP) + datum_size * result->width*result->height) )
{
elog(ERROR,"CHIP_in parser - bad data (actual size != computed size)!");
PG_RETURN_NULL();
}
-
-
-
PG_FUNCTION_INFO_V1(height_chip);
Datum height_chip(PG_FUNCTION_ARGS)
{