ext/RMagick/rminfo.c in rmagick-2.0.0 vs ext/RMagick/rminfo.c in rmagick-2.1.0
- old
+ new
@@ -1,8 +1,8 @@
-/* $Id: rminfo.c,v 1.67 2007/10/28 23:43:24 rmagick Exp $ */
+/* $Id: rminfo.c,v 1.70 2008/01/02 15:52:19 rmagick Exp $ */
/*============================================================================\
-| Copyright (C) 2007 by Timothy P. Hunter
+| Copyright (C) 2008 by Timothy P. Hunter
| Name: rminfo.c
| Author: Tim Hunter
| Purpose: Info class method definitions for RMagick.
\============================================================================*/
@@ -185,12 +185,12 @@
char fkey[MaxTextExtent];
switch (argc)
{
case 2:
- format_p = rb_str2cstr(argv[0], &format_l);
- key_p = rb_str2cstr(argv[1], &key_l);
+ format_p = rm_str2cstr(argv[0], &format_l);
+ key_p = rm_str2cstr(argv[1], &key_l);
if (format_l > MAX_FORMAT_LEN || format_l + key_l > MaxTextExtent-1)
{
rb_raise(rb_eArgError, "can't reference %.60s:%.1024s - too long", format_p, key_p);
}
@@ -244,12 +244,12 @@
Data_Get_Struct(self, Info, info);
switch (argc)
{
case 3:
- format_p = rb_str2cstr(argv[0], &format_l);
- key_p = rb_str2cstr(argv[1], &key_l);
+ format_p = rm_str2cstr(argv[0], &format_l);
+ key_p = rm_str2cstr(argv[1], &key_l);
if (format_l > MAX_FORMAT_LEN || format_l+key_l > MaxTextExtent-1)
{
rb_raise(rb_eArgError, "%.60s:%.1024s not defined - too long", format_p, key_p);
}
@@ -329,25 +329,25 @@
VALUE
Info_authenticate_eq(VALUE self, VALUE passwd)
{
Info *info;
char *passwd_p = NULL;
- long passwd_len = 0;
+ long passwd_l = 0;
Data_Get_Struct(self, Info, info);
if (!NIL_P(passwd))
{
- passwd_p = rb_str2cstr(passwd, &passwd_len);
+ passwd_p = rm_str2cstr(passwd, &passwd_l);
}
if (info->authenticate)
{
magick_free(info->authenticate);
info->authenticate = NULL;
}
- if (passwd_len > 0)
+ if (passwd_l > 0)
{
magick_clone_string(&info->authenticate, passwd_p);
}
return self;
@@ -413,10 +413,29 @@
}
/*
+ Method: Info#caption=<aString>
+ Purpose: emulate the -caption option
+*/
+VALUE
+Info_caption(VALUE self)
+{
+ return get_option(self, "caption");
+}
+
+
+
+VALUE
+Info_caption_eq(VALUE self, VALUE caption)
+{
+ return set_option(self, "caption", caption);
+}
+
+
+/*
Method: Info#channel(channel [, channel...])
Purpose: Set the channels
Thanks: Douglas Sellers
*/
VALUE
@@ -522,12 +541,12 @@
case 3:
/* Allow any argument that supports to_s */
fmt_arg = rb_funcall(argv[2], rm_ID_to_s, 0);
value = StringValuePtr(fmt_arg);
case 2:
- key = rb_str2cstr(argv[1], &key_l);
- format = rb_str2cstr(argv[0], &format_l);
+ key = rm_str2cstr(argv[1], &key_l);
+ format = rm_str2cstr(argv[0], &format_l);
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
}
@@ -1353,11 +1372,11 @@
Data_Get_Struct(self, Info, info);
if (!NIL_P(sampling_factor))
{
- sampling_factor_p = rb_str2cstr(sampling_factor, &sampling_factor_len);
+ sampling_factor_p = rm_str2cstr(sampling_factor, &sampling_factor_len);
}
if (info->sampling_factor)
{
magick_free(info->sampling_factor);
@@ -1578,11 +1597,11 @@
Info *info;
char *format_p, *key_p;
long format_l, key_l;
char fkey[MaxTextExtent];
- format_p = rb_str2cstr(format, &format_l);
- key_p = rb_str2cstr(key, &key_l);
+ format_p = rm_str2cstr(format, &format_l);
+ key_p = rm_str2cstr(key, &key_l);
if (format_l > MAX_FORMAT_LEN || format_l + key_l > MaxTextExtent)
{
rb_raise(rb_eArgError, "can't undefine %.60s:%.1024s - too long", format_p, key_p);
}