~ubuntu-branches/ubuntu/precise/csound/precise

« back to all changes in this revision

Viewing changes to OOps/dumpf.c

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2012-04-19 09:26:46 UTC
  • mfrom: (3.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20120419092646-96xbj1n6atuqosk2
Tags: 1:5.17.6~dfsg-1
* New upstream release
 - Do not build the wiimote opcodes (we need wiiuse).
* Add new API function to symbols file
* Disable lua opcodes, they were broken. Requires OpenMP to be enabled.
* Backport fixes from upstream:
  - Link dssi4cs with dl. Backport
  - Fix building of CsoundAC

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
 
140
140
static void nkdump(CSOUND *csound, MYFLT *kp, FILE *ofd, int format, int nk)
141
141
{
142
 
    char  buf1[128], outbuf[256];
 
142
    char  buf1[256], outbuf[256];
143
143
    int   len = 0;
144
144
 
145
145
    switch(format) {               /* place formatted kvals into outbuf */
192
192
      break;
193
193
    default: csound->Die(csound, Str("unknown kdump format"));
194
194
    }
195
 
    fwrite(outbuf, 1, len, ofd);                /* now write the buffer */
 
195
    if (UNLIKELY(fwrite(outbuf, len, 1, ofd)!=1)) { /* now write the buffer */
 
196
      csound->PerfError(csound, Str("write failure in dumpk"));
 
197
    }
196
198
}
197
199
 
198
200
int kdump(CSOUND *csound, KDUMP *p)
370
372
    case 1: {
371
373
      int8_t *bp = (int8_t*)inbuf;
372
374
      len = nk;
373
 
      fread(inbuf, 1, len, ifd);        /* now read the buffer */
374
 
      while (nk--) {
 
375
      len = fread(inbuf, 1, len, ifd);        /* now read the buffer */
 
376
      while (nk--)
375
377
        *kp++ = (MYFLT)*bp++;
376
 
        break;
377
 
      }
 
378
      break;
378
379
    }
379
380
    case 4: {
380
381
      int16_t *bp = (int16_t*)inbuf;
381
382
      len = nk * 2;
382
 
      fread(inbuf, 1, len, ifd);        /* now read the buffer */
 
383
      len = fread(inbuf, 1, len, ifd);        /* now read the buffer */
383
384
      while (nk--)
384
385
        *kp++ = (MYFLT)*bp++;
385
386
      break;
387
388
    case 5: {
388
389
      int32_t *bp = (int32_t*)inbuf;
389
390
      len = nk * 4;
390
 
      fread(inbuf, 1, len, ifd);        /* now read the buffer */
 
391
      len = fread(inbuf, 1, len, ifd);        /* now read the buffer */
391
392
      while (nk--)
392
393
        *kp++ = (MYFLT)*bp++;
393
394
      break;
395
396
    case 6: {
396
397
      float *bp = (float*)inbuf;
397
398
      len = nk * sizeof(float);
398
 
      fread(inbuf, 1, len, ifd);        /* now read the buffer */
 
399
      len = fread(inbuf, 1, len, ifd);        /* now read the buffer */
399
400
      while (nk--)
400
401
        *kp++ = (MYFLT)*bp++;
401
402
      break;
538
539
{
539
540
    if (--p->countdown <= 0) {
540
541
      p->countdown = p->timcount;
541
 
      fgets(p->lasts, csound->strVarMaxLen,  p->f);
 
542
      if (UNLIKELY(fgets(p->lasts, csound->strVarMaxLen,  p->f)==NULL)) {
 
543
        csound->PerfError(csound, "Read failure in readks");
 
544
      }
542
545
    }
543
546
    strncpy((char*) p->str, p->lasts, csound->strVarMaxLen);
544
547
    return OK;