Permalink
Browse files

cleaning up compiler warnings

  • Loading branch information...
1 parent 16dfb7e commit 8efd927ca6e07cb3a02698e4e30d09414b3e18a6 @tenderlove committed Sep 27, 2008
@@ -54,11 +54,11 @@ static int lame_decode_initfile(VALUE file, mp3data_struct * mp3data) {
short int pcm_l[1152], pcm_r[1152];
str = rb_funcall(file, rb_intern("read"), 1, INT2NUM(len));
- buf = StringValuePtr(str);
+ buf = (unsigned char *)StringValuePtr(str);
if(buf[0] == 'I' && buf[1] == 'D' && buf[2] == '3') {
len = 6;
str = rb_funcall(file, rb_intern("read"), 1, INT2NUM(len));
- buf = StringValuePtr(str);
+ buf = (unsigned char *)StringValuePtr(str);
buf[2] &= 127; buf[3] &= 127; buf[4] &= 127; buf[5] &= 127;
len = (((((buf[2] << 7) + buf[3]) << 7) + buf[4]) << 7) + buf[5];
@@ -70,7 +70,7 @@ static int lame_decode_initfile(VALUE file, mp3data_struct * mp3data) {
len = 4;
str = rb_funcall(file, rb_intern("read"), 1, INT2NUM(len));
- buf = StringValuePtr(str);
+ buf = (unsigned char *)StringValuePtr(str);
/* Check for Album ID */
if(0 == rb_str_cmp(str, rb_str_new2("AiD\1"))) {
@@ -96,7 +96,7 @@ static int lame_decode_initfile(VALUE file, mp3data_struct * mp3data) {
while(!mp3data->header_parsed) {
str = rb_funcall(file, rb_intern("read"), 1, INT2NUM(100));
- buf = StringValuePtr(str);
+ buf = (unsigned char *)StringValuePtr(str);
ret = lame_decode1_headersB(buf, 100, pcm_l, pcm_r, mp3data,&enc_delay,&enc_padding);
if(ret == -1)
rb_raise(rb_eRuntimeError, "Decode headers failed.\n");
@@ -252,10 +252,9 @@ static VALUE MpegEncoder_set_album(VALUE self, VALUE album) {
*/
static VALUE MpegEncoder_set_year(VALUE self, VALUE year) {
lame_global_flags * gfp;
- VALUE * year_string;
Data_Get_Struct(self, lame_global_flags, gfp);
- year_string = rb_funcall(year, rb_intern("to_s"), 0);
+ VALUE year_string = rb_funcall(year, rb_intern("to_s"), 0);
id3tag_set_year(gfp, StringValuePtr(year_string));
return year;
}
@@ -268,15 +267,13 @@ static VALUE MpegEncoder_set_year(VALUE self, VALUE year) {
*/
static VALUE MpegEncoder_set_track(VALUE self, VALUE track) {
lame_global_flags * gfp;
- int track_number;
- VALUE * track_string;
- track_number = NUM2INT(track);
+ int track_number = NUM2INT(track);
if(track < 0 || track > 255)
rb_raise(rb_eRuntimeError, "Track must be between 0 and 255.\n");
Data_Get_Struct(self, lame_global_flags, gfp);
- track_string = rb_funcall(track, rb_intern("to_s"), 0);
+ VALUE track_string = rb_funcall(track, rb_intern("to_s"), 0);
id3tag_set_track(gfp, StringValuePtr(track_string));
return track;
}
@@ -522,7 +519,7 @@ static VALUE MpegEncoder_encoder_buffer(VALUE self, VALUE left, VALUE right) {
else
rb_raise(rb_eRuntimeError, "internal error.\n");
}
- return rb_str_new(mp3buffer, imp3);
+ return rb_str_new((const char *)mp3buffer, imp3);
}
/*
@@ -544,7 +541,7 @@ static VALUE MpegEncoder_flush(VALUE self) {
else
rb_raise(rb_eRuntimeError, "internal error.\n");
}
- return rb_str_new(mp3buffer, imp3);
+ return rb_str_new((const char *)mp3buffer, imp3);
}
/*
@@ -1,7 +1,7 @@
#ifndef MPEG_ENCODER_H
#define MPEG_ENCODER_H
-#define LAME_MAXMP3BUFFER 16384
+#include <native.h>
void init_audio_mpeg_encoder();

0 comments on commit 8efd927

Please sign in to comment.