static void recordInput(sInput *input) { sInputRecord *rec = record + record_ofs; rec->x = input->x; rec->y = input->y; rec->btn_p = input->btn_p; rec->btn_td = input->btn_td; rec->btn_tu = input->btn_tu; if(++record_ofs == record_num) { if(record_num >= record_max) { input->rec_datamax = TRUE; PRINTF("InputRecord Datamax\n"); /* 打ち止め */ } else { record_num *= 2; if((record_max > 0) && (record_max < record_num)) record_num = record_max; record = (sInputRecord *)fsRealloc(record, sizeof(sInputRecord) * record_num, "record"); } } rec = record + record_ofs; rec->recNum = 0; }
static void putIntValue(FileBuffer *buffer, u_int value) { u_char *ptr = buffer->ptr; int ofs = buffer->ofs; int size = buffer->size; if((ofs + 4) >= size) { size = size * 2; ptr = (u_char *)fsRealloc(ptr, size, "byteValue"); buffer->ptr = ptr; buffer->size = size; } *(u_int *)(ptr + ofs) = htonl(value); ofs += sizeof(u_int); buffer->ofs = ofs; }
static void putCharValue(FileBuffer *buffer, u_char value) { u_char *ptr = buffer->ptr; int ofs = buffer->ofs; int size = buffer->size; if((ofs + 1) >= size) { size = size * 2; ptr = (u_char *)fsRealloc(ptr, size, "byteValue"); buffer->ptr = ptr; buffer->size = size; } *(ptr + ofs) = value; ofs += 1; buffer->ofs = ofs; }
static void* myRealloc(FT_Memory, long, long new_size, void* ptr) { return fsRealloc(ptr, new_size); }