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

« back to all changes in this revision

Viewing changes to Opcodes/imageOpcodes.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:
84
84
    unsigned char header[8];
85
85
    png_structp png_ptr;
86
86
    png_infop info_ptr;
87
 
    png_infop end_ptr;
 
87
    /* png_infop end_ptr; */
88
88
    int is_png;
89
89
    png_uint_32 width, height, rowbytes;
90
90
    int bit_depth;
103
103
      return NULL;
104
104
    }
105
105
 
106
 
    fread(header, 1, hs, fp);
 
106
    if (UNLIKELY(hs!=fread(header, 1, hs, fp)))
 
107
      csound->InitError(csound,
 
108
                        Str("imageload: file %s is not in PNG format.\n"),
 
109
                        filename);
107
110
    is_png = !png_sig_cmp(header, 0, hs);
108
111
 
109
112
    if (UNLIKELY(!is_png)) {
128
131
      return NULL;
129
132
    }
130
133
 
131
 
    end_ptr = png_create_info_struct(png_ptr);
132
 
    if (UNLIKELY(!end_ptr)) {
133
 
      png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
134
 
      csound->InitError(csound, Str("imageload: out of memory.\n"));
135
 
      csound->FileClose(csound, fd);
136
 
      return NULL;
137
 
    }
 
134
    /* end_ptr = png_create_info_struct(png_ptr); */
 
135
    /* if (UNLIKELY(!end_ptr)) { */
 
136
    /*   png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); */
 
137
    /*   csound->InitError(csound, Str("imageload: out of memory.\n")); */
 
138
    /*   csound->FileClose(csound, fd); */
 
139
    /*   return NULL; */
 
140
    /* } */
138
141
 
139
142
    png_init_io(png_ptr, fp);
140
143
    png_set_sig_bytes(png_ptr, hs);
612
615
 
613
616
#define S(x)    sizeof(x)
614
617
 
615
 
static OENTRY localops[] = {
 
618
static OENTRY image_localops[] = {
616
619
  { "imageload",  S(IMGLOAD),  1, "i", "S",   (SUBR)imageload, NULL, NULL   },
617
620
  { "imagecreate",S(IMGCREATE),1, "i", "ii",  (SUBR)imagecreate, NULL, NULL },
618
621
  { "imagesize",  S(IMGSIZE),  1, "ii", "i",  (SUBR)imagesize, NULL, NULL   },
622
625
    (SUBR)imagesetpixel, (SUBR)imagesetpixel, (SUBR)imagesetpixel_a   },
623
626
  { "imagesave",  S(IMGSAVE),  1, "", "iS",   (SUBR)imagesave, NULL, NULL   },
624
627
  { "imagefree",  S(IMGFREE),  1, "", "i",    (SUBR)imagefree, NULL, NULL   },
625
 
 
626
628
};
627
629
 
628
630
 
629
 
LINKAGE
 
631
LINKAGE1(image_localops)
 
632