@@ -243,7 +243,7 @@ bool_field_write_entry(const vcz_field_t *VCZ_UNUSED(self), const void *VCZ_UNUS
243
243
244
244
static int64_t
245
245
int32_field_write_entry (const vcz_field_t * self , const void * restrict data , char * buf ,
246
- int64_t buflen , int64_t offset )
246
+ int64_t buflen , int64_t offset , char separator )
247
247
{
248
248
const int32_t * restrict source = (const int32_t * ) data ;
249
249
size_t column ;
@@ -253,7 +253,7 @@ int32_field_write_entry(const vcz_field_t *self, const void *restrict data, char
253
253
break ;
254
254
}
255
255
if (column > 0 ) {
256
- offset = append_char (buf , ',' , offset , buflen );
256
+ offset = append_char (buf , separator , offset , buflen );
257
257
if (offset < 0 ) {
258
258
goto out ;
259
259
}
@@ -302,7 +302,7 @@ vcz_field_write_entry(
302
302
{
303
303
if (self -> type == VCZ_TYPE_INT ) {
304
304
if (self -> item_size == 4 ) {
305
- return int32_field_write_entry (self , data , buf , buflen , offset );
305
+ return int32_field_write_entry (self , data , buf , buflen , offset , ',' );
306
306
}
307
307
} else if (self -> type == VCZ_TYPE_FLOAT ) {
308
308
assert (self -> item_size == 4 );
@@ -409,33 +409,9 @@ vcz_variant_encoder_write_sample_gt(const vcz_variant_encoder_t *self, size_t va
409
409
size_t source_offset = variant * self -> num_samples * ploidy + sample * ploidy ;
410
410
const int32_t * source = ((const int32_t * ) self -> gt .data ) + source_offset ;
411
411
const bool phased = self -> gt_phased_data [variant * self -> num_samples + sample ];
412
- int32_t value ;
413
- size_t ploid ;
414
412
char sep = phased ? '|' : '/' ;
415
413
416
- if (self -> gt .item_size != 4 ) {
417
- offset = VCZ_ERR_FIELD_UNSUPPORTED_TYPE ;
418
- goto out ;
419
- }
420
-
421
- for (ploid = 0 ; ploid < ploidy ; ploid ++ ) {
422
- value = source [ploid ];
423
- if (value == VCZ_INT_FILL ) {
424
- break ;
425
- }
426
- if (ploid > 0 ) {
427
- offset = append_char (buf , sep , offset , buflen );
428
- if (offset < 0 ) {
429
- goto out ;
430
- }
431
- }
432
- offset = append_int (buf , value , offset , buflen );
433
- if (offset < 0 ) {
434
- goto out ;
435
- }
436
- }
437
- out :
438
- return offset ;
414
+ return int32_field_write_entry (& self -> gt , source , buf , buflen , offset , sep );
439
415
}
440
416
441
417
static int64_t
@@ -656,7 +632,6 @@ vcz_variant_encoder_write_row(
656
632
size_t j ;
657
633
658
634
for (j = 0 ; j < VCZ_NUM_FIXED_FIELDS ; j ++ ) {
659
- // FIXME do we really need to do this check?
660
635
if (vcz_info_field_is_missing (& self -> fixed_fields [j ], variant )) {
661
636
offset = append_char (buf , '.' , offset , (int64_t ) buflen );
662
637
if (offset < 0 ) {
0 commit comments