[Qt-interest] Resizing static array data in struct fp_print_data? 0_o How?
Nicholas Shatokhin
n.shatokhin at gmail.com
Mon Mar 7 02:54:55 CET 2011
Hello.
I found this in structure:
enum fp_print_data_type {
PRINT_DATA_RAW = 0, /* memset-imposed default */
PRINT_DATA_NBIS_MINUTIAE,
};
struct fp_print_data {
uint16_t driver_id;
uint32_t devtype;
enum fp_print_data_type type;
size_t length;
unsigned char data[0]; // OK, it's array from one element
};
But when I enroll my finger, the data has the length 2404 elements. How it
change it's size?
I'm porting libfprint to qt4 and I need transform this struct to
QByteArray and back. I successfully write data to byteArray, but I have
difficult with backward procedure. See the function:
struct fp_print_data CFingerprintScanner::byteArrayToFpdata(QByteArray
byteArray)
{
quint16 driver_id;
quint32 devtype;
quint32 type;
quint64 length;
char * data;
struct fp_print_data fpdata;
QBuffer buffer(&byteArray);
buffer.open(QIODevice::ReadOnly);
QDataStream in(&buffer);
in >> driver_id;
in >> devtype;
in >> type;
in >> length;
data = (char *) malloc(length);
in.readRawData(data, length);
fpdata.driver_id = (uint16_t) driver_id;
fpdata.devtype = (uint32_t) devtype;
fpdata.type = (enum fp_print_data_type) type;
fpdata.length = (size_t) length;
// in this I must write data to fpdata.data, but how can I do it?
// it's not possible to convert char * (or unsigned char*) to
unsigned
char[0]
free(data);
return fpdata;
}
I'm disappointed. Somebody can tell me how can I change size of this array?
--
За використання революційного клієнта електронної пошти Opera:
http://www.opera.com/mail/
More information about the Qt-interest-old
mailing list