Patches: Browse | Submit New | Admin

[#3157] Fix for 64 bit Ruby

Date:
2005-12-31 16:37
Priority:
3
Submitted By:
Daniel Berger (djberg96)
Assigned To:
Guillaume Pierronnet (moumar)
Category:
None
State:
Closed
Summary:
Fix for 64 bit Ruby

Detailed description
Hi,

The following patches allows mp3info to work on 64 bit versions of Ruby:

> diff -u mp3info.orig mp3info.rb
--- mp3info.orig        2006-01-04 19:05:36.000000000 -0700
+++ mp3info.rb  2006-01-04 19:16:04.000000000 -0700
@@ -8,7 +8,15 @@
 require "mp3info/extension_modules"
 require "mp3info/id3v2"

-# ruby -d to display debugging infos
+# ruby -d to display debugging info
+
+class Fixnum
+  def bits(b,a)
+    t = 0
+    b.downto(a) { |i| t += t + self[i] }
+    t
+  end
+end

 # Raised on any kind of error related to ruby-mp3info
 class Mp3InfoError < StandardError ; end
@@ -203,7 +211,6 @@

       5.times do
        head = find_next_frame()
-       head.extend(NumericBits)
        @mpeg_version = [2, 1][head[19]]
        @layer = LAYER[head.bits(18,17)]
        next if @layer.nil?

> diff -u extension_modules.orig extension_modules.rb
--- extension_modules.orig      2006-01-04 19:05:58.000000000 -0700
+++ extension_modules.rb        2006-01-04 19:14:28.000000000 -0700
@@ -13,16 +13,6 @@
     end
   end

-  module NumericBits #:nodoc:
-    ### returns the selected bit range (b, a) as a number
-    ### NOTE: b > a  if not, returns 0
-    def bits(b, a)
-      t = 0
-      b.downto(a) { |i| t += t + self[i] }
-      t
-    end
-  end
-
   module Mp3FileMethods #:nodoc:
     def get32bits
       (getc << 24) + (getc << 16) + (getc << 8) + getc

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-04-15 14:18
Sender: Guillaume Pierronnet

fixed in svn repository
Date: 2007-02-16 12:04
Sender: Gopal balaji

Dan,

i am currently using my Macbook.

Ruby - 1.8.5

Installed ruby gem ruby-mp3info (0.5)

Summary of patch:

Remove the NumericBits module from extension_modules.rb.
Remove "head.extend(NumericBits)" from mp3info.rb
Add this to the top of mp3info.rb:

class Fixnum
   def bits(b, a)
      t = 0
      b.downto(a){ |i| t += t + self[i] }
      t
   end
end

and when i run a test i get the following error,

test.rb:1:in `require': no such file to load -- mp3info
(LoadError)
        from test.rb:1

Please suggest me a solution.
Date: 2007-02-06 14:54
Sender: Peter Sloots

I noticed that back on 32bit, errors occurred with Bignum.
By doing the same trick for Bignum these errors went away.

class Bignum
  def bits(b,a)
    t = 0
    b.downto(a) { |i| t += t + self[i] }
    t
  end
endeix ghex
Date: 2006-03-22 02:17
Sender: Nobody

Thanks a lot, that helped me a lot.
Date: 2006-01-26 08:29
Sender: Nobody

ys now it works, but musicextras still cannot get any lyric.
Date: 2006-01-26 04:02
Sender: Daniel Berger

Summary of patch:

Remove the NumericBits module from extension_modules.rb.
Remove "head.extend(NumericBits)" from mp3info.rb
Add this to the top of mp3info.rb:

class Fixnum
   def bits(b, a)
      t = 0
      b.downto(a){ |i| t += t + self[i] }
      t
   end
end

Hope that helps.

Dan
Date: 2006-01-25 21:44
Sender: Nobody

I use 64 bit version of mp3info with musicextras and after doing
the test that comes with the library, I have seen that this program
doesn't work well for this library. The problem that I have is
that I don't know how to apply the patch you have published.
Sorry for my bad english.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
status_idOpen2007-04-15 14:18moumar
assigned_tonone2007-04-15 14:18moumar
close_date2007-04-15 14:182007-04-15 14:18moumar