Mercurial > hg > dmlib
comparison tools/xm2jss.c @ 2282:6c3c3355007d
Fix conversion of unoptimized modules in xm2jss.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 18 Jun 2019 12:31:29 +0300 |
parents | 7fb5470b5d45 |
children | dcf1016f3d27 |
comparison
equal
deleted
inserted
replaced
2281:167ec99e57a5 | 2282:6c3c3355007d |
---|---|
575 "Error allocating memory for pattern compression buffer.\n"); | 575 "Error allocating memory for pattern compression buffer.\n"); |
576 } | 576 } |
577 | 577 |
578 // Convert and write patterns | 578 // Convert and write patterns |
579 for (totalSize = index = 0; index < module->npatterns; index++) | 579 for (totalSize = index = 0; index < module->npatterns; index++) |
580 if (module->patterns[index] != NULL) | |
581 { | 580 { |
582 JSSPattern *pattern = module->patterns[index]; | 581 JSSPattern *pattern = module->patterns[index]; |
583 size_t dataSize = 0; | 582 size_t dataSize = 0; |
584 int ret; | 583 int ret; |
584 | |
585 if (pattern == NULL) | |
586 { | |
587 dmMsg(1, | |
588 "Pattern #%d is NULL.\n", index); | |
589 pattern = module->patterns[module->npatterns]; | |
590 } | |
585 | 591 |
586 if (pattern->nrows > jsetMaxRows) | 592 if (pattern->nrows > jsetMaxRows) |
587 { | 593 { |
588 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, | 594 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, |
589 "Pattern #%d has %d rows > %d max.\n", | 595 "Pattern #%d has %d rows > %d max.\n", |
647 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, | 653 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, |
648 "Error writing JSSMOD pattern data #%d.\n", | 654 "Error writing JSSMOD pattern data #%d.\n", |
649 index); | 655 index); |
650 } | 656 } |
651 } | 657 } |
652 else | |
653 { | |
654 JSSERROR(DMERR_NULLPTR, DMERR_NULLPTR, | |
655 "Pattern #%d was NULL.\n", index); | |
656 } | |
657 | 658 |
658 dmFree(patBuf); | 659 dmFree(patBuf); |
659 dmMsg(1," * %d patterns, %d bytes.\n", | 660 dmMsg(1," * %d patterns, %d bytes.\n", |
660 module->npatterns, totalSize); | 661 module->npatterns, totalSize); |
661 | 662 |
667 | 668 |
668 if (einst == NULL) | 669 if (einst == NULL) |
669 { | 670 { |
670 einst = &tmpEInst; | 671 einst = &tmpEInst; |
671 memset(&tmpEInst, 0, sizeof(tmpEInst)); | 672 memset(&tmpEInst, 0, sizeof(tmpEInst)); |
672 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, | 673 dmMsg(1, |
673 "Extended instrument #%d NULL!\n", | 674 "Extended instrument #%d is NULL!\n", |
674 index); | 675 index); |
675 } | 676 } |
676 | 677 |
677 // Misc data | 678 // Misc data |
678 BOOL ok = | 679 BOOL ok = |