comparison tools/xm2jss.c @ 1195:4d27c4ec8d4d

Use %d instead of %i in formats.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Mar 2015 15:58:24 +0200
parents 1f2cfa0119aa
children 83693e2797dd
comparison
equal deleted inserted replaced
1194:1f2cfa0119aa 1195:4d27c4ec8d4d
432 if (m == NULL) 432 if (m == NULL)
433 JSSERROR(DMERR_NULLPTR, DMERR_NULLPTR, "Module pointer was NULL\n"); 433 JSSERROR(DMERR_NULLPTR, DMERR_NULLPTR, "Module pointer was NULL\n");
434 434
435 if (m->nchannels < 1 || m->npatterns < 1 || m->norders < 1) 435 if (m->nchannels < 1 || m->npatterns < 1 || m->norders < 1)
436 JSSERROR(DMERR_BOUNDS, DMERR_BOUNDS, 436 JSSERROR(DMERR_BOUNDS, DMERR_BOUNDS,
437 "Module had invalid values (nchannels=%i, npatterns=%i, norders=%i)\n", 437 "Module had invalid values (nchannels=%d, npatterns=%d, norders=%d)\n",
438 m->nchannels, m->npatterns, m->norders); 438 m->nchannels, m->npatterns, m->norders);
439 439
440 // Create the JSSMOD header 440 // Create the JSSMOD header
441 jssH.idMagic[0] = 'J'; 441 jssH.idMagic[0] = 'J';
442 jssH.idMagic[1] = 'M'; 442 jssH.idMagic[1] = 'M';
508 } 508 }
509 509
510 if (i != DMERR_OK) 510 if (i != DMERR_OK)
511 { 511 {
512 dmFree(patBuf); 512 dmFree(patBuf);
513 JSSERROR(i, i, "Error converting pattern data #%i\n", pattern); 513 JSSERROR(i, i, "Error converting pattern data #%d\n", pattern);
514 } 514 }
515 else 515 else
516 { 516 {
517 dmMsg(3, " - Pattern %d size %d bytes\n", pattern, finalSize); 517 dmMsg(3, " - Pattern %d size %d bytes\n", pattern, finalSize);
518 patHead.nrows = m->patterns[pattern]->nrows; 518 patHead.nrows = m->patterns[pattern]->nrows;
560 jssE.vibratoType = einst->vibratoType; 560 jssE.vibratoType = einst->vibratoType;
561 jssE.vibratoSweep = einst->vibratoSweep; 561 jssE.vibratoSweep = einst->vibratoSweep;
562 jssE.vibratoDepth = einst->vibratoDepth; 562 jssE.vibratoDepth = einst->vibratoDepth;
563 jssE.fadeOut = einst->fadeOut; 563 jssE.fadeOut = einst->fadeOut;
564 } else 564 } else
565 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, "Extended instrument #%i NULL!\n", instr); 565 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, "Extended instrument #%d NULL!\n", instr);
566 566
567 // Write to file 567 // Write to file
568 totalSize += sizeof(jssE); 568 totalSize += sizeof(jssE);
569 if (fwrite(&jssE, sizeof(jssE), 1, outFile) != 1) 569 if (fwrite(&jssE, sizeof(jssE), 1, outFile) != 1)
570 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, 570 JSSERROR(DMERR_FWRITE, DMERR_FWRITE,
571 "Could not write JSSMOD extended instrument #%i to file!\n", instr); 571 "Could not write JSSMOD extended instrument #%d to file!\n", instr);
572 } 572 }
573 dmMsg(1," * %d Extended Instruments, %d bytes.\n", m->nextInstruments, totalSize); 573 dmMsg(1," * %d Extended Instruments, %d bytes.\n", m->nextInstruments, totalSize);
574 574
575 575
576 // Write sample instrument headers 576 // Write sample instrument headers
595 jssI.EPanning = inst->EPanning; 595 jssI.EPanning = inst->EPanning;
596 jssI.hasData = (inst->data != NULL) ? TRUE : FALSE; 596 jssI.hasData = (inst->data != NULL) ? TRUE : FALSE;
597 jssI.convFlags = (inst->flags & jsf16bit) ? flags16 : flags8; 597 jssI.convFlags = (inst->flags & jsf16bit) ? flags16 : flags8;
598 } 598 }
599 else 599 else
600 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, "Instrument #%i NULL!\n", instr); 600 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, "Instrument #%d NULL!\n", instr);
601 601
602 // Write to file 602 // Write to file
603 totalSize += sizeof(jssI); 603 totalSize += sizeof(jssI);
604 if (fwrite(&jssI, sizeof(jssI), 1, outFile) != 1) 604 if (fwrite(&jssI, sizeof(jssI), 1, outFile) != 1)
605 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, 605 JSSERROR(DMERR_FWRITE, DMERR_FWRITE,
606 "Could not write JSSMOD instrument #%i to file!\n", instr); 606 "Could not write JSSMOD instrument #%d to file!\n", instr);
607 } 607 }
608 dmMsg(1," * %d Instrument headers, %d bytes.\n", m->ninstruments, totalSize); 608 dmMsg(1," * %d Instrument headers, %d bytes.\n", m->ninstruments, totalSize);
609 609
610 // Write sample data 610 // Write sample data
611 for (totalSize = instr = 0; instr < m->ninstruments; instr++) 611 for (totalSize = instr = 0; instr < m->ninstruments; instr++)
627 } 627 }
628 628
629 totalSize += inst->size; 629 totalSize += inst->size;
630 if (res != (size_t) inst->size) 630 if (res != (size_t) inst->size)
631 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, 631 JSSERROR(DMERR_FWRITE, DMERR_FWRITE,
632 "Could not write JSSMOD sample #%i to file!\n", instr); 632 "Could not write JSSMOD sample #%d to file!\n", instr);
633 } 633 }
634 } 634 }
635 dmMsg(1," * %d samples, %d bytes.\n", m->ninstruments, totalSize); 635 dmMsg(1," * %d samples, %d bytes.\n", m->ninstruments, totalSize);
636 636
637 return DMERR_OK; 637 return DMERR_OK;
994 dmMsg(1, "Reading XM-format file ...\n"); 994 dmMsg(1, "Reading XM-format file ...\n");
995 result = jssLoadXM(inFile, &sm, FALSE); 995 result = jssLoadXM(inFile, &sm, FALSE);
996 dmf_close(inFile); 996 dmf_close(inFile);
997 if (result != 0) 997 if (result != 0)
998 { 998 {
999 dmErrorMsg("Error while loading XM file (%i), ", result); 999 dmErrorMsg("Error while loading XM file (%d), ", result);
1000 if (optIgnoreErrors) 1000 if (optIgnoreErrors)
1001 fprintf(stderr, "ignoring. This may cause problems.\n"); 1001 fprintf(stderr, "ignoring. This may cause problems.\n");
1002 else 1002 else
1003 { 1003 {
1004 fprintf(stderr, "giving up. Use --ignore if you want to try to convert anyway.\n"); 1004 fprintf(stderr, "giving up. Use --ignore if you want to try to convert anyway.\n");