Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2011 10:24:24 GMT
From:      Eric Freeman <freebsdports@chillibear.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/156467: [PATCH] audio/ruby-audiofile (patch to enable compiling with RUBY_VER 1.9)
Message-ID:  <201104181024.p3IAOOX6086166@red.freebsd.org>
Resent-Message-ID: <201104181030.p3IAU9hH082817@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         156467
>Category:       ports
>Synopsis:       [PATCH] audio/ruby-audiofile (patch to enable compiling with RUBY_VER 1.9)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 18 10:30:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Eric Freeman
>Release:        8.2
>Organization:
>Environment:
FreeBSD BSD8R.local 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Patch to enable audio/ruby-audiofile to compile when RUBY_VER is 1.9

Added a patchfile to correct some structures in audiofile.c, mainly a case of changing: RSTRING(var)->ptr type structures to RSTRING_PTR(var).
>How-To-Repeat:
Try installing Ruby 1.9 and:

cd /usr/ports/audio/ruby-audiofile && make build RUBY_VER=1.9

fails.
>Fix:
diff -ruN ruby-audiofile.orig/files/patch-audiofile.c ruby-audiofile/files/patch-audiofile.c
--- ruby-audiofile.orig/files/patch-audiofile.c	1970-01-01 01:00:00.000000000 +0100
+++ ruby-audiofile/files/patch-audiofile.c	2011-04-18 06:59:17.000000000 +0100
@@ -0,0 +1,96 @@
+--- audiofile.c.orig	2003-08-10 00:29:57.000000000 +0100
++++ audiofile.c	2011-04-18 06:58:15.000000000 +0100
+@@ -161,7 +161,7 @@
+ 
+             /* get mode into a C-string */
+             mode = malloc(2);
+-            mode[0] = *(RSTRING(v_mode)->ptr);
++            mode[0] = *(RSTRING_PTR(v_mode));
+             mode[1] = '\0';
+ 
+             switch(*mode) {
+@@ -188,7 +188,7 @@
+     switch(*mode) {
+         case 'r':
+ 
+-            fh = afOpenFile(RSTRING(v_fn)->ptr, mode, AF_NULL_FILESETUP);
++            fh = afOpenFile(RSTRING_PTR(v_fn), mode, AF_NULL_FILESETUP);
+             if(fh != AF_NULL_FILEHANDLE) {
+                 afp = ALLOC(struct af_data);
+                 DATA_PTR(obj) = afp;
+@@ -212,8 +212,8 @@
+ 
+         case 'w':
+             
+-            fn = malloc(RSTRING(v_fn)->len+1);
+-            strcpy(fn, RSTRING(v_fn)->ptr);
++            fn = malloc(RSTRING_LEN(v_fn)+1);
++            strcpy(fn, RSTRING_PTR(v_fn));
+ 
+             afp = ALLOC(struct af_data);
+             DATA_PTR(obj) = afp;
+@@ -335,8 +335,8 @@
+     
+ 
+     Check_Type(readIntoString, T_STRING);
+-    bytes = RSTRING(readIntoString)->len;
+-    buf = RSTRING(readIntoString)->ptr;
++    bytes = RSTRING_LEN(readIntoString);
++    buf = RSTRING_PTR(readIntoString);
+ 
+     frame_size = afGetFrameSize(afp->handle, AF_DEFAULT_TRACK, EXPAND_3TO4);
+     frames = bytes / frame_size;
+@@ -357,8 +357,8 @@
+     GetAFP(obj, afp);
+ 
+     Check_Type(writeFromString, T_STRING);
+-    bytes = RSTRING(writeFromString)->len;
+-    buf = RSTRING(writeFromString)->ptr;
++    bytes = RSTRING_LEN(writeFromString);
++    buf = RSTRING_PTR(writeFromString);
+ 
+     frame_size = afGetFrameSize(afp->handle, AF_DEFAULT_TRACK, EXPAND_3TO4);
+     frames = bytes / frame_size;
+@@ -679,18 +679,18 @@
+     struct af_data *afp;
+ 
+     Check_Type(args, T_ARRAY);
+-    if(RARRAY(args)->len != 1) {
++    if(RARRAY_LEN(args) != 1) {
+         rb_raise(rb_eArgError, "incorrect argument(s) to AudioFile#pcm_mapping=");
+     }
+-    args = *(RARRAY(args)->ptr);
+-    if(RARRAY(args)->len != 4) {
++    args = *(RARRAY_PTR(args));
++    if(RARRAY_LEN(args) != 4) {
+         rb_raise(rb_eArgError, "incorrect argument(s) to AudioFile#pcm_mapping=");
+     }
+ 
+-    v_slope     = RARRAY(args)->ptr[0];
+-    v_intercept = RARRAY(args)->ptr[1];
+-    v_min_clip  = RARRAY(args)->ptr[2];
+-    v_max_clip  = RARRAY(args)->ptr[3];
++    v_slope     = RARRAY_PTR(args)[0];
++    v_intercept = RARRAY_PTR(args)[1];
++    v_min_clip  = RARRAY_PTR(args)[2];
++    v_max_clip  = RARRAY_PTR(args)[3];
+     Check_Type(v_slope, T_FLOAT);
+     Check_Type(v_intercept, T_FLOAT);
+     Check_Type(v_min_clip, T_FLOAT);
+@@ -700,12 +700,12 @@
+ 
+     if(af_is_open(afp)) {
+         afSetTrackPCMMapping(afp->handle, AF_DEFAULT_TRACK, 
+-                RFLOAT(v_slope)->value, RFLOAT(v_intercept)->value,
+-                RFLOAT(v_min_clip)->value, RFLOAT(v_max_clip)->value);
++                RFLOAT_VALUE(v_slope), RFLOAT_VALUE(v_intercept),
++                RFLOAT_VALUE(v_min_clip), RFLOAT_VALUE(v_max_clip));
+     } else {
+         afInitPCMMapping(afp->setup, AF_DEFAULT_TRACK, 
+-                RFLOAT(v_slope)->value, RFLOAT(v_intercept)->value,
+-                RFLOAT(v_min_clip)->value, RFLOAT(v_max_clip)->value);
++                RFLOAT_VALUE(v_slope), RFLOAT_VALUE(v_intercept),
++                RFLOAT_VALUE(v_min_clip), RFLOAT_VALUE(v_max_clip));
+     }
+ 
+     return Qnil;

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104181024.p3IAOOX6086166>