ext/jpeg_jpeg.c in jpeg-0.1.3 vs ext/jpeg_jpeg.c in jpeg-0.1.4
- old
+ new
@@ -1,8 +1,9 @@
#include <stdio.h>
#include <jpeglib.h>
#include "jpeg_jpeg.h"
+#inlcude "jpeg_error.h"
VALUE Jpeg;
static VALUE jpeg_jpeg_s_open(int argc, VALUE *argv, VALUE sef);
static VALUE jpeg_jpeg_alloc(VALUE klass);
@@ -10,10 +11,12 @@
static void jpeg_jpeg_free(struct jpeg_jpeg *p);
static VALUE jpeg_jpeg_width(VALUE self);
static VALUE jpeg_jpeg_height(VALUE self);
static VALUE jpeg_jpeg_size(VALUE self);
+extern VALUE Error;
+
void Init_jpeg_jpeg() {
Jpeg = rb_define_class("Jpeg", rb_cObject);
rb_define_alloc_func(Jpeg, jpeg_jpeg_alloc);
rb_define_singleton_method(Jpeg, "open", jpeg_jpeg_s_open, -1);
rb_define_method(Jpeg, "width", jpeg_jpeg_width, 0);
@@ -21,10 +24,10 @@
rb_define_method(Jpeg, "size", jpeg_jpeg_size, 0);
}
void jpeg_jpeg_exit(j_common_ptr jpeg) {
char buffer[JMSG_LENGTH_MAX];
jpeg->err->format_message(jpeg, buffer);
- rb_raise(rb_eRuntimeError, buffer);
+ rb_raise(Error, buffer);
}
static VALUE jpeg_jpeg_alloc(VALUE klass) {
struct jpeg_jpeg *jpeg = ALLOC(struct jpeg_jpeg);