forked from len0rd/rockbox
FS#13539: Resync mikmod plugin with upstream
Brings it up to libmikmod 3.3.12, relased 2024-12-31 Also fix a segfault that only happened on simulators when using non-default samplerates. Change-Id: I2ade2d72a00edab5395328fe76a88a88516aac72
This commit is contained in:
parent
08c32cee7c
commit
af7ed73f31
29 changed files with 1860 additions and 706 deletions
|
@ -115,18 +115,20 @@ MIKMODAPI void MikMod_RegisterLoader(struct MLOADER* ldr)
|
|||
int ReadComment(UWORD len)
|
||||
{
|
||||
if(len) {
|
||||
int i;
|
||||
CHAR *ptr;
|
||||
|
||||
if(!(of.comment=(CHAR*)MikMod_malloc(len+1))) return 0;
|
||||
of.comment=(CHAR*)MikMod_calloc(1,len+1);
|
||||
if(!of.comment) return 0;
|
||||
_mm_read_UBYTES(of.comment,len,modreader);
|
||||
|
||||
/* translate IT linefeeds */
|
||||
for(i=0;i<len;i++)
|
||||
if(of.comment[i]=='\r') of.comment[i]='\n';
|
||||
|
||||
of.comment[len]=0; /* just in case */
|
||||
ptr=of.comment;
|
||||
while(*ptr) {
|
||||
if(*ptr=='\r') *ptr='\n';
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
if(!of.comment[0]) {
|
||||
if(of.comment && !of.comment[0]) {
|
||||
MikMod_free(of.comment);
|
||||
of.comment=NULL;
|
||||
}
|
||||
|
@ -142,16 +144,17 @@ int ReadLinedComment(UWORD len,UWORD linelen)
|
|||
if (!linelen) return 0;
|
||||
if (!len) return 1;
|
||||
|
||||
if (!(buf = (CHAR *) MikMod_malloc(len))) return 0;
|
||||
numlines = (len + linelen - 1) / linelen;
|
||||
cnt = (linelen + 1) * numlines;
|
||||
if (!(storage = (CHAR *) MikMod_malloc(cnt + 1))) {
|
||||
buf = (CHAR *) MikMod_calloc(1, len);
|
||||
if (!buf) return 0;
|
||||
storage = (CHAR *) MikMod_calloc(1, cnt + 1);
|
||||
if (!storage) {
|
||||
MikMod_free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_mm_read_UBYTES(buf,len,modreader);
|
||||
storage[cnt] = 0;
|
||||
for (line = 0, fpos = 0, cpos = 0; line < numlines; line++, fpos += linelen, cpos += (linelen + 1))
|
||||
{
|
||||
cnt = len - fpos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue