Decompressing a compressed buffer loses data

57E

Member
Can somebody tell me what I doing wrong in this?

GML:
before = buffer_create(1024,buffer_fast,1);
buffer_poke(before,0,buffer_u8,255);    buffer_poke(before,1,buffer_u8,127);    buffer_poke(before,2,buffer_u8,63);        buffer_poke(before,3,buffer_u8,31);

show_debug_message("size: "+string(buffer_get_size(before)));
show_debug_message("type: "+string(buffer_get_type(before)));
show_debug_message("align: "+string(buffer_get_alignment(before)));
show_debug_message("BEFORE: "+string(buffer_peek(before,0,buffer_u8))+"|"+string(buffer_peek(before,1,buffer_u8))+"|"+string(buffer_peek(before,2,buffer_u8))+"|"+string(buffer_peek(before,3,buffer_u8)));

zip = buffer_compress(before,0,buffer_get_size(before));
after = buffer_decompress(zip);

show_debug_message("size: "+string(buffer_get_size(after)));
show_debug_message("type: "+string(buffer_get_type(after)));
show_debug_message("align: "+string(buffer_get_alignment(after)));
show_debug_message("AFTER:   "+string(buffer_peek(after,0,buffer_u8))+"|"+string(buffer_peek(after,1,buffer_u8))+"|"+string(buffer_peek(after,2,buffer_u8))+"|"+string(buffer_peek(after,3,buffer_u8)));
The "before" and "after" -buffers are supposed to be identical, but instead the output looks like this:
Code:
size: 1024
type: 3
align: 1
BEFORE: 255|127|63|31
size: 3
type: 0
align: 1
AFTER:  255|127|63|undefined
 

57E

Member
buffer_grow and buffer_fixed do not lose the last number, but are you not supposed to compress buffer_fast then?
I couldn't find any info on the matter.
Code:
size: 1024
type: 0
align: 1
BEFORE: 255|127|63|31
size: 4
type: 0
align: 1
AFTER:   255|127|63|31
 

Homunculus

Member
Not sure honestly, there’s nothing telling us that we can’t compress fast buffers. We have to consider though that the compressed buffer does not store any information on the type it was before compression, so this might have something to do with how fast buffers are stored. It still doesn’t sound right, I’d file a bug report
 
Top