Skip to content

Commit 12e1cc9

Browse files
committed
Add type casts to MALLOC calls and reformat
1 parent 3467082 commit 12e1cc9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

qoa.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void *qoa_encode(const short *sample_data, qoa_desc *qoa, unsigned int *out_len)
488488
num_frames * QOA_LMS_LEN * 4 * qoa->channels + /* 4 * 4 bytes lms state per channel */
489489
num_slices * 8 * qoa->channels; /* 8 byte slices */
490490

491-
unsigned char *bytes = QOA_MALLOC(encoded_size);
491+
unsigned char *bytes = (unsigned char *)QOA_MALLOC(encoded_size);
492492

493493
for (int c = 0; c < qoa->channels; c++) {
494494
/* Set the initial LMS weights to {0, 0, -1, 2}. This helps with the
@@ -643,7 +643,7 @@ short *qoa_decode(const unsigned char *bytes, int size, qoa_desc *qoa) {
643643

644644
/* Calculate the required size of the sample buffer and allocate */
645645
int total_samples = qoa->samples * qoa->channels;
646-
short *sample_data = QOA_MALLOC(total_samples * sizeof(short));
646+
short *sample_data = (short *)QOA_MALLOC(total_samples * sizeof(short));
647647

648648
unsigned int sample_index = 0;
649649
unsigned int frame_len;
@@ -719,7 +719,7 @@ void *qoa_read(const char *filename, qoa_desc *qoa) {
719719
bytes_read = fread(data, 1, size, f);
720720
fclose(f);
721721

722-
sample_data = qoa_decode(data, bytes_read, qoa);
722+
sample_data = qoa_decode((unsigned char *)data, bytes_read, qoa);
723723
QOA_FREE(data);
724724
return sample_data;
725725
}

0 commit comments

Comments
 (0)