[DRE-commits] [ruby-exif] 01/11: restore orginal upstream files in master branch (broken import of debian diff)
Jonas Genannt
jonas at brachium-system.net
Thu Dec 19 16:39:33 UTC 2013
This is an automated email from the git hooks/post-receive script.
hggh-guest pushed a commit to branch master
in repository ruby-exif.
commit ec13b045b0d49a6c06ccb45da9df4caa40c1b46c
Author: Jonas Genannt <jonas at brachium-system.net>
Date: Wed Dec 18 21:54:45 2013 +0100
restore orginal upstream files in master branch (broken import of debian diff)
---
exif.c | 42 ++++++++++++++++++++----------------------
extconf.rb | 2 +-
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/exif.c b/exif.c
index b1f5a71..af4d82d 100644
--- a/exif.c
+++ b/exif.c
@@ -7,10 +7,10 @@ vim:sts=4:ts=4:sw=4
*******************************************************************************/
-#include <ruby.h>
+#include "ruby.h"
#include <libexif/exif-ifd.h>
#include <libexif/exif-data.h>
-/* #include <libexif/exif-note.h> */
+#include <libexif/exif-note.h>
#include <libexif/exif-utils.h>
#include <libexif/exif-tag.h>
@@ -62,16 +62,16 @@ rb_exif_data_new_from_file(VALUE fpath)
{
ExifData *data;
Check_Type(fpath, T_STRING);
- data = exif_data_new_from_file(RSTRING_PTR(fpath));
+ data = exif_data_new_from_file(RSTRING(fpath)->ptr);
if (!data){
FILE *f;
- f = fopen(RSTRING_PTR(fpath),"rb");
+ f = fopen(RSTRING(fpath)->ptr,"rb");
if (!f)
rb_raise(rb_eArgError, "unable to open file - '%s'",
- RSTRING_PTR(fpath));
+ RSTRING(fpath)->ptr);
fclose(f);
rb_raise(eExifInvalidFormat,
- "'%s' does not contain EXIF data", RSTRING_PTR(fpath));
+ "'%s' does not contain EXIF data", RSTRING(fpath)->ptr);
}
return data;
}
@@ -100,7 +100,7 @@ rb_exif_data_new_from_data(ExifData *ed, VALUE str)
exif_data_free(ed);
ed = NULL;
}
- ed = exif_data_new_from_data((unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
+ ed = exif_data_new_from_data((unsigned char *)RSTRING(str)->ptr, RSTRING(str)->len);
}
static VALUE
@@ -134,12 +134,11 @@ rb_exif_yield_tag_value(ExifEntry *entry, void *data)
{
VALUE k, v;
char buf[7];
- char value[1024];
unsigned char *ids = data;
memset(buf, 0, sizeof(buf));
sprintf(buf, "0x%04x", entry->tag);
k = *ids ? rb_str_new2(buf) : rb_str_new2(exif_tag_get_title(entry->tag));
- v = rb_str_new2(exif_entry_get_value(entry, value, sizeof(value)));
+ v = rb_str_new2(exif_entry_get_value(entry));
rb_yield(rb_assoc_new(k, v));
}
@@ -180,9 +179,9 @@ rb_exif_set_ifd(VALUE obj, VALUE ifd)
}
break;
case T_STRING:
- i = exif_ifd_from_string(RSTRING_PTR(ifd));
+ i = exif_ifd_from_string(RSTRING(ifd)->ptr);
if (i == -1){
- rb_raise(rb_eRuntimeError, "unknown IFD: '%s'", RSTRING_PTR(ifd));
+ rb_raise(rb_eRuntimeError, "unknown IFD: '%s'", RSTRING(ifd)->ptr);
}
break;
default:
@@ -216,14 +215,13 @@ rb_exif_get_tag(VALUE obj, VALUE tagid)
ExifEntry *e;
const char *found;
int i;
- char value[1024];
Get_Exif(obj, exif);
switch (TYPE(tagid)) {
case T_STRING:
- tag = exif_tag_from_string(RSTRING_PTR(tagid));
+ tag = exif_tag_from_string(RSTRING(tagid)->ptr);
if (!tag){
- rb_raise(eExifError, "invalid tag: '%s'", RSTRING_PTR(tagid));
+ rb_raise(eExifError, "invalid tag: '%s'", RSTRING(tagid)->ptr);
}
break;
case T_FIXNUM:
@@ -243,14 +241,14 @@ rb_exif_get_tag(VALUE obj, VALUE tagid)
"IFD '%s' does not contain tag '%s'(0x%04x)",
exif_ifd_get_name(exif->ifd), exif_tag_get_title(tag), tag);
}
- return rb_str_new2(exif_entry_get_value(e, value, sizeof(value)));
+ return rb_str_new2(exif_entry_get_value(e));
}
for (i = 0; i < EXIF_IFD_COUNT; i++){
e = exif_content_get_entry(exif->ed->ifd[i], tag);
if (e)
break;
}
- found = exif_entry_get_value(e, value, sizeof(value));
+ found = exif_entry_get_value(e);
return found ? rb_str_new2(found) : Qnil;
}
@@ -274,9 +272,9 @@ rb_exif_set_tag(VALUE obj, VALUE tagid, VALUE val)
Check_Type(tagid, T_STRING);
Check_Type(val, T_STRING);
Get_Exif(obj, exif);
- tag = exif_tag_from_string(RSTRING_PTR(tagid));
+ tag = exif_tag_from_string(RSTRING(tagid)->ptr);
if (!tag || !exif_tag_get_name(tag)){
- rb_raise(eExifError, "invalid tag: '%s'", RSTRING_PTR(tagid));
+ rb_raise(eExifError, "invalid tag: '%s'", RSTRING(tagid)->ptr);
}
e = exif_content_get_entry(exif->ed->ifd[exif->ifd], tag);
if (!e){
@@ -328,9 +326,9 @@ rb_exif_s_get_tag_description(VALUE klass, VALUE tagid)
FIX2INT(tagid), FIX2INT(tagid));
break;
case T_STRING:
- tag = exif_tag_from_string(RSTRING_PTR(tagid));
+ tag = exif_tag_from_string(RSTRING(tagid)->ptr);
if (!tag || !exif_tag_get_name(tag)) {
- rb_raise(eExifError, "invalid tag: '%s'", RSTRING_PTR(tagid));
+ rb_raise(eExifError, "invalid tag: '%s'", RSTRING(tagid)->ptr);
}
break;
default:
@@ -368,9 +366,9 @@ rb_exif_set_thumbnail(VALUE obj, VALUE src)
exif->ed->size = 0;
}
Check_Type(src, T_STRING);
- exif->ed->size = RSTRING_LEN(src);
+ exif->ed->size = RSTRING(src)->len;
exif->ed->data = xmalloc(sizeof(char)*exif->ed->size);
- MEMMOVE(exif->ed->data, RSTRING_PTR(src), char, exif->ed->size);
+ MEMMOVE(exif->ed->data, RSTRING(src)->ptr, char, exif->ed->size);
return obj;
}
diff --git a/extconf.rb b/extconf.rb
index 437f85d..9269679 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -5,7 +5,7 @@ dir_config("exif", "/usr/local/include", "/usr/local/lib")
def have_libexif_header
have_header('libexif/exif-ifd.h') and
have_header('libexif/exif-data.h') and
-# have_header('libexif/exif-note.h') and
+ have_header('libexif/exif-note.h') and
have_header('libexif/exif-utils.h') and
have_header('libexif/exif-tag.h')
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-exif.git
More information about the Pkg-ruby-extras-commits
mailing list