updated on Tue Jan 10 00:10:07 UTC 2012
[aur-mirror.git] / ruby-rudl / gcc4-ruby-1.9.2.patch
blobbbf7ea340a5b931798114d126245784dc308900f
1 diff -aur rudl-0.8/flxplay.c rudl-0.8-patched//flxplay.c
2 --- rudl-0.8/flxplay.c 2004-10-24 00:40:26.000000000 +0200
3 +++ rudl-0.8-patched//flxplay.c 2010-09-02 10:10:35.000000000 +0200
4 @@ -42,10 +42,9 @@
5 int lastFrameTicks;
6 } FLC;
8 -#define ReadU16(tmp1, tmp2) (Uint16)*(tmp1) = ((Uint8)*(tmp2+1)<<8)+(Uint8)*(tmp2);
9 -#define ReadU32(tmp1, tmp2) (Uint32)*(tmp1) = (((((((Uint8)*(tmp2+3)<<8)+((Uint8)*(tmp2+2)))<<8)+((Uint8)*(tmp2+1)))<<8)+(Uint8)*(tmp2));
11 +#define ReadU16(tmp1, tmp2) *(Uint16 *)(tmp1) = ((Uint8)*(tmp2+1)<<8)+(Uint8)*(tmp2);
13 +#define ReadU32(tmp1, tmp2) *(Uint32 *)(tmp1) = (((((((Uint8)*(tmp2+3)<<8)+((Uint8)*(tmp2+2)))<<8)+((Uint8)*(tmp2+1)))<<8)+(Uint8)*(tmp2));
15 void FlcReadFile(FLC*flc, Uint32 size)
17 @@ -541,7 +540,7 @@
19 static VALUE flc_decoder_new(VALUE clas, VALUE filename)
21 - return createFLCObject(STR2CSTR(filename));
22 + return createFLCObject(StringValuePtr(filename));
25 static VALUE flc_decoder_destroy(VALUE self)
26 diff -aur rudl-0.8/rudl.c rudl-0.8-patched//rudl.c
27 --- rudl-0.8/rudl.c 2004-10-24 00:40:26.000000000 +0200
28 +++ rudl-0.8-patched//rudl.c 2010-09-02 10:10:35.000000000 +0200
29 @@ -104,7 +104,7 @@
30 VALUE tmp;
32 if(rb_obj_is_kind_of(flagsArg, rb_cArray)){
33 - for(i=0; i<RARRAY(flagsArg)->len; i++){
34 + for(i=0; i<RARRAY_LEN(flagsArg); i++){
35 tmp=rb_ary_entry(flagsArg, i);
36 flags|=NUM2UINT(tmp);
38 diff -aur rudl-0.8/rudl_audio.c rudl-0.8-patched//rudl_audio.c
39 --- rudl-0.8/rudl_audio.c 2004-10-24 00:40:26.000000000 +0200
40 +++ rudl-0.8-patched//rudl_audio.c 2010-09-02 10:10:35.000000000 +0200
41 @@ -305,7 +305,7 @@
43 initAudio();
45 - chunk=Mix_LoadWAV(STR2CSTR(filename));
46 + chunk=Mix_LoadWAV(StringValuePtr(filename));
47 SDL_VERIFY(chunk);
49 newObject=Data_Wrap_Struct(classSound, 0, SDL_FreeWAV, chunk);
50 @@ -333,10 +333,10 @@
51 Check_Type(sampledata, T_STRING);
53 chunk->allocated = 0;
54 - chunk->alen = RSTRING(sampledata)->len;
55 + chunk->alen = RSTRING_LEN(sampledata);
56 chunk->abuf = malloc(chunk->alen);
57 chunk->volume = MIX_MAX_VOLUME;
58 - memcpy(chunk->abuf, RSTRING(sampledata)->ptr, chunk->alen);
59 + memcpy(chunk->abuf, RSTRING_PTR(sampledata), chunk->alen);
61 newObject=Data_Wrap_Struct(classSound, 0, SDL_FreeWAV, chunk);
62 RUDL_VERIFY(newObject, "Sound.load_raw misbehaved");
63 @@ -396,8 +396,8 @@
67 - src_memory=RSTRING(src)->ptr;
68 - src_length=RSTRING(src)->len;
69 + src_memory=RSTRING_PTR(src);
70 + src_length=RSTRING_LEN(src);
72 unpack_audio_format_array(src_array, &src_rate, &src_format, &src_channels);
73 unpack_audio_format_array(dest_array, &dest_rate, &dest_format, &dest_channels);
74 @@ -423,7 +423,7 @@
77 char* new_sound=(char*)calloc(to_length, sizeof(char));
78 - memcpy(new_sound, RSTRING(input)->ptr, RSTRING(input)->len);
79 + memcpy(new_sound, RSTRING_PTR(input), RSTRING_LEN(input));
80 return new_sound;
83 @@ -438,15 +438,15 @@
85 Check_Type(v_data1, T_STRING);
86 Check_Type(v_data2, T_STRING);
87 - *data1=RSTRING(v_data1)->len;
88 - *data2=RSTRING(v_data2)->len;
89 + *data1=RSTRING_LEN(v_data1);
90 + *data2=RSTRING_LEN(v_data2);
92 - if(RSTRING(v_data1)->len > RSTRING(v_data2)->len){
93 - data2=sound_pad(v_data2, RSTRING(v_data1)->len);
94 + if(RSTRING_LEN(v_data1) > RSTRING_LEN(v_data2)){
95 + data2=sound_pad(v_data2, RSTRING_LEN(v_data1));
98 - if(RSTRING(v_data1)->len < RSTRING(v_data2)->len){
99 - data1=sound_pad(v_data1, RSTRING(v_data2)->len);
100 + if(RSTRING_LEN(v_data1) < RSTRING_LEN(v_data2)){
101 + data1=sound_pad(v_data1, RSTRING_LEN(v_data2));
103 Kopieer sdl_mixer.c
105 @@ -466,7 +466,7 @@
107 initAudio();
109 - rwops=SDL_RWFromMem(RSTRING(self)->ptr, RSTRING(self)->len);
110 + rwops=SDL_RWFromMem(RSTRING_PTR(self), RSTRING_LEN(self));
111 chunk=Mix_LoadWAV_RW(rwops, 0);
112 SDL_FreeRW(rwops);
113 SDL_VERIFY(chunk);
114 @@ -855,7 +855,7 @@
116 VALUE newObject;
117 initAudio();
118 - newObject=Data_Wrap_Struct(classMusic, 0, freemusic, Mix_LoadMUS(STR2CSTR(filename)));
119 + newObject=Data_Wrap_Struct(classMusic, 0, freemusic, Mix_LoadMUS(StringValuePtr(filename)));
120 rb_obj_call_init(newObject, 0, NULL);
121 return newObject;
123 diff -aur rudl-0.8/rudl_mouse.c rudl-0.8-patched//rudl_mouse.c
124 --- rudl-0.8/rudl_mouse.c 2004-10-24 00:40:26.000000000 +0200
125 +++ rudl-0.8-patched//rudl_mouse.c 2010-09-02 10:10:35.000000000 +0200
126 @@ -119,9 +119,9 @@
128 Check_Type(xormasks, T_ARRAY);
129 Check_Type(andmasks, T_ARRAY);
130 - sx=RARRAY(rb_ary_entry(xormasks,0))->len;
131 - sy=RARRAY(xormasks)->len;
132 - if((sx!=RARRAY(rb_ary_entry(andmasks,0))->len)||(sy!=RARRAY(xormasks)->len)){
133 + sx=RARRAY_LEN(rb_ary_entry(xormasks,0));
134 + sy=RARRAY_LEN(xormasks);
135 + if((sx!=RARRAY_LEN(rb_ary_entry(andmasks,0)))||(sy!=RARRAY_LEN(xormasks))){
136 SDL_RAISE_S("andmasks and xormasks should be the same size");
139 diff -aur rudl-0.8/rudl_movie.c rudl-0.8-patched//rudl_movie.c
140 --- rudl-0.8/rudl_movie.c 2004-10-24 00:40:26.000000000 +0200
141 +++ rudl-0.8-patched//rudl_movie.c 2010-09-02 10:10:35.000000000 +0200
142 @@ -73,7 +73,7 @@
144 //init_smpeg();
145 BIGSMPEG* smpeg=(BIGSMPEG*)malloc(sizeof(BIGSMPEG));
146 - smpeg->movie=SMPEG_new(STR2CSTR(filename), &(smpeg->info), true);
147 + smpeg->movie=SMPEG_new(StringValuePtr(filename), &(smpeg->info), true);
148 movie_check_error(smpeg);
149 return Data_Wrap_Struct(classMovie, 0, delete_BIGSMPEG, smpeg);
151 @@ -149,13 +149,13 @@
155 - mpeg = SMPEG_new(STR2CSTR(filename),NULL,SDL_WasInit(SDL_INIT_AUDIO));
156 + mpeg = SMPEG_new(StringValuePtr(filename),NULL,SDL_WasInit(SDL_INIT_AUDIO));
158 if( SMPEG_error(mpeg) ){
160 snprintf(error_msg,sizeof(error_msg),"Couldn't load %s: %s",
162 - STR2CSTR(filename),SMPEG_error(mpeg));
163 + StringValuePtr(filename),SMPEG_error(mpeg));
165 SMPEG_delete(mpeg);
167 diff -aur rudl-0.8/rudl_sfont.c rudl-0.8-patched//rudl_sfont.c
168 --- rudl-0.8/rudl_sfont.c 2004-10-24 00:40:26.000000000 +0200
169 +++ rudl-0.8-patched//rudl_sfont.c 2010-09-02 10:10:35.000000000 +0200
170 @@ -113,7 +113,7 @@
172 Sint16 x,y;
173 PARAMETER2COORD(coord, &x, &y);
174 - PutString(retrieveSurfacePointer(surface), retrieveFontInfoPointer(self), x, y, STR2CSTR(text));
175 + PutString(retrieveSurfacePointer(surface), retrieveFontInfoPointer(self), x, y, StringValuePtr(text));
176 return self;
179 @@ -140,7 +140,7 @@
180 static VALUE sfont_size(VALUE self, VALUE ruby_text)
182 SFont_FontInfo* font=retrieveFontInfoPointer(self);
183 - char* text=STR2CSTR(ruby_text);
184 + char* text=StringValuePtr(ruby_text);
185 int ofs=0;
186 int i=0,x=0;
188 diff -aur rudl-0.8/rudl_ttf.c rudl-0.8-patched//rudl_ttf.c
189 --- rudl-0.8/rudl_ttf.c 2004-10-24 00:40:26.000000000 +0200
190 +++ rudl-0.8-patched//rudl_ttf.c 2010-09-02 10:10:35.000000000 +0200
191 @@ -54,7 +54,7 @@
193 VALUE tmp;
194 if(rb_obj_is_kind_of(colorObject, rb_cArray)){
195 - switch(RARRAY(colorObject)->len){
196 + switch(RARRAY_LEN(colorObject)){
197 case 4:
198 case 3:
200 @@ -89,7 +89,7 @@
202 TTF_Font *font;
203 initTTF();
204 - font=TTF_OpenFont(STR2CSTR(filename), NUM2INT(size));
205 + font=TTF_OpenFont(StringValuePtr(filename), NUM2INT(size));
206 if(!font)TTF_RAISE;
207 return Data_Wrap_Struct(classTTF, 0, TTF_CloseFont, font);
209 @@ -128,7 +128,7 @@
211 aa=NUM2BOOL(aaValue);
213 - string=STR2CSTR(textValue);
214 + string=StringValuePtr(textValue);
215 if(aa){
216 if(argc==3){
217 surf = TTF_RenderText_Blended(font, string, foreg);
218 @@ -278,7 +278,7 @@
219 static VALUE truetypefont_size(VALUE self, VALUE text)
221 int w, h;
222 - TTF_SizeText(retrieveTTFPointer(self), STR2CSTR(text), &w, &h);
223 + TTF_SizeText(retrieveTTFPointer(self), StringValuePtr(text), &w, &h);
224 return rb_ary_new3(2, INT2NUM(w), INT2NUM(h));
226 #endif
227 diff -aur rudl-0.8/rudl_video.c rudl-0.8-patched//rudl_video.c
228 --- rudl-0.8/rudl_video.c 2004-10-24 00:40:26.000000000 +0200
229 +++ rudl-0.8-patched//rudl_video.c 2010-09-02 10:10:35.000000000 +0200
230 @@ -32,7 +32,7 @@
232 VALUE r,g,b,a;
233 if(rb_obj_is_kind_of(colorObject, rb_cArray)){
234 - switch(RARRAY(colorObject)->len){
235 + switch(RARRAY_LEN(colorObject)){
236 case 3:
237 r=rb_ary_entry(colorObject, 0);
238 g=rb_ary_entry(colorObject, 1);
239 @@ -65,7 +65,7 @@
241 if(rb_obj_is_kind_of(colorObject, rb_cArray)){
242 VALUE r,g,b,a;
243 - switch(RARRAY(colorObject)->len){
244 + switch(RARRAY_LEN(colorObject)){
245 case 3:
246 r=rb_ary_entry(colorObject, 0);
247 g=rb_ary_entry(colorObject, 1);
248 diff -aur rudl-0.8/rudl_video_display_surface.c rudl-0.8-patched//rudl_video_display_surface.c
249 --- rudl-0.8/rudl_video_display_surface.c 2004-10-24 00:40:26.000000000 +0200
250 +++ rudl-0.8-patched//rudl_video_display_surface.c 2010-09-02 10:10:35.000000000 +0200
251 @@ -393,7 +393,7 @@
252 return self;
253 case 1:
254 Check_Type(rectObject, T_ARRAY);
255 - total_rects=RARRAY(rectObject)->len;
256 + total_rects=RARRAY_LEN(rectObject);
257 rects=malloc(sizeof(SDL_Rect)*total_rects);
258 for(i=0; i<total_rects; i++){
259 PARAMETER2CRECT(rb_ary_entry(rectObject, i), rects+i);
260 @@ -462,10 +462,10 @@
261 rb_scan_args(argc, argv, "11", &titleObject, &iconTitleObject);
263 if(argc==2){
264 - iconTitle=STR2CSTR(iconTitleObject);
265 + iconTitle=StringValuePtr(iconTitleObject);
268 - title=STR2CSTR(titleObject);
269 + title=StringValuePtr(titleObject);
271 SDL_WM_SetCaption(title, iconTitle);
273 @@ -516,8 +516,8 @@
274 /* custom mask supplied? */
275 if (argc == 2) {
276 if (mask != Qnil) {
277 - RUDL_VERIFY(RSTRING(mask)->len >= surface->h*((surface->w + 7)/8), "Not enough data in mask_string");
278 - maskstr = STR2CSTR(mask);
279 + RUDL_VERIFY(RSTRING_LEN(mask) >= surface->h*((surface->w + 7)/8), "Not enough data in mask_string");
280 + maskstr = StringValuePtr(mask);
282 /* colorkey set? generate a working mask, unlike SDL currently :) */
283 } else if (surface->flags & SDL_SRCCOLORKEY) {
284 @@ -574,7 +574,7 @@
285 VALUE tmp;
287 if(rb_obj_is_kind_of(color, rb_cArray)){
288 - if(RARRAY(color)->len==3){
289 + if(RARRAY_LEN(color)==3){
290 tmp=rb_ary_entry(color, 0); r=NUM2FLT(tmp);
291 tmp=rb_ary_entry(color, 1); g=NUM2FLT(tmp);
292 tmp=rb_ary_entry(color, 2); b=NUM2FLT(tmp);
293 diff -aur rudl-0.8/rudl_video_rect.c rudl-0.8-patched//rudl_video_rect.c
294 --- rudl-0.8/rudl_video_rect.c 2004-10-24 00:40:26.000000000 +0200
295 +++ rudl-0.8-patched//rudl_video_rect.c 2010-09-02 10:10:35.000000000 +0200
296 @@ -173,8 +173,8 @@
297 Check_Type(list1Value, T_ARRAY);
298 Check_Type(list2Value, T_ARRAY);
300 - list1len=RARRAY(list1Value)->len;
301 - list2len=RARRAY(list2Value)->len;
302 + list1len=RARRAY_LEN(list1Value);
303 + list2len=RARRAY_LEN(list2Value);
305 if(list1len==0 || list2len==0) return self;
307 @@ -226,7 +226,7 @@
308 double l,r,t,b;
309 VALUE rect;
311 - if(RARRAY(other_rects)->len==0){
312 + if(RARRAY_LEN(other_rects)==0){
313 return Qnil;
316 @@ -236,7 +236,7 @@
317 top=array_get_y(rect);
318 bottom=array_get_h(rect)+top;
320 - for(i=1; i<RARRAY(other_rects)->len; i++){
321 + for(i=1; i<RARRAY_LEN(other_rects); i++){
322 rect=rb_ary_entry(other_rects, i);
323 l=array_get_x(rect);
324 r=array_get_w(rect)+l;
325 @@ -437,7 +437,7 @@
326 x2=array_get_x(thing);
327 y2=array_get_y(thing);
329 - if(RARRAY(thing)->len>3){ // It's a rectangle
330 + if(RARRAY_LEN(thing)>3){ // It's a rectangle
331 w2=array_get_w(thing);
332 h2=array_get_h(thing);
333 return INT2BOOL((x <= x2) && (y <= y2) &&
334 @@ -514,7 +514,7 @@
336 int i;
337 Check_Type(rects, T_ARRAY);
338 - for(i=0; i<RARRAY(rects)->len; i++){
339 + for(i=0; i<RARRAY_LEN(rects); i++){
340 if(rb_array_overlaps(self, rb_ary_entry(rects, i))==Qtrue){
341 return rb_ary_entry(rects, i);
343 @@ -531,7 +531,7 @@
344 int i;
345 VALUE retval=rb_ary_new();
346 Check_Type(rects, T_ARRAY);
347 - for(i=0; i<RARRAY(rects)->len; i++){
348 + for(i=0; i<RARRAY_LEN(rects); i++){
349 if(rb_array_overlaps(self, rb_ary_entry(rects, i))==Qtrue){
350 rb_ary_push(retval, rb_ary_entry(rects, i));
352 diff -aur rudl-0.8/rudl_video_sdl_gfx.c rudl-0.8-patched//rudl_video_sdl_gfx.c
353 --- rudl-0.8/rudl_video_sdl_gfx.c 2004-10-24 00:40:26.000000000 +0200
354 +++ rudl-0.8-patched//rudl_video_sdl_gfx.c 2010-09-02 10:10:35.000000000 +0200
355 @@ -259,7 +259,7 @@
357 static VALUE surface_polygon(VALUE self, VALUE coordlist, VALUE color)
359 - int numpoints=RARRAY(coordlist)->len;
360 + int numpoints=RARRAY_LEN(coordlist);
361 Sint16 *x=malloc(sizeof(Sint16)*numpoints);
362 Sint16 *y=malloc(sizeof(Sint16)*numpoints);
363 int i;
364 @@ -280,7 +280,7 @@
365 /** @method filled_polygon( coord_list, color ) -> self */
366 static VALUE surface_filled_polygon(VALUE self, VALUE coordlist, VALUE color)
368 - int numpoints=RARRAY(coordlist)->len;
369 + int numpoints=RARRAY_LEN(coordlist);
370 Sint16 *x=malloc(sizeof(Sint16)*numpoints);
371 Sint16 *y=malloc(sizeof(Sint16)*numpoints);
372 int i;
373 @@ -302,7 +302,7 @@
375 static VALUE surface_antialiased_polygon(VALUE self, VALUE coordlist, VALUE color)
377 - int numpoints=RARRAY(coordlist)->len;
378 + int numpoints=RARRAY_LEN(coordlist);
379 Sint16 *x=malloc(sizeof(Sint16)*numpoints);
380 Sint16 *y=malloc(sizeof(Sint16)*numpoints);
381 int i;
382 @@ -329,7 +329,7 @@
384 Sint16 x,y;
385 PARAMETER2COORD(coord, &x, &y);
386 - if(stringColor(retrieveSurfacePointer(self), x, y, STR2CSTR(text), VALUE2COLOR_NOMAP(color))) SDL_RAISE_S("failed");
387 + if(stringColor(retrieveSurfacePointer(self), x, y, StringValuePtr(text), VALUE2COLOR_NOMAP(color))) SDL_RAISE_S("failed");
388 return self;
390 #endif
391 diff -aur rudl-0.8/rudl_video_surface.c rudl-0.8-patched//rudl_video_surface.c
392 --- rudl-0.8/rudl_video_surface.c 2004-10-24 00:40:26.000000000 +0200
393 +++ rudl-0.8-patched//rudl_video_surface.c 2010-09-02 10:10:35.000000000 +0200
394 @@ -215,7 +215,7 @@
395 bpp = NUM2Sint16(surfaceOrDepthObject);
396 if(argc == 4){ // got masks
397 Check_Type(masksObject, T_ARRAY);
398 - RUDL_VERIFY(RARRAY(masksObject)->len==4, "Need 4 elements in masks array");
399 + RUDL_VERIFY(RARRAY_LEN(masksObject)==4, "Need 4 elements in masks array");
400 tmp = rb_ary_entry(masksObject, 0); Rmask = NUM2UINT(tmp);
401 tmp = rb_ary_entry(masksObject, 1); Gmask = NUM2UINT(tmp);
402 tmp = rb_ary_entry(masksObject, 2); Bmask = NUM2UINT(tmp);
403 @@ -274,9 +274,9 @@
404 SDL_Surface* surface=NULL;
405 initVideo();
406 #ifdef HAVE_SDL_IMAGE_H
407 - surface=IMG_Load(STR2CSTR(filename));
408 + surface=IMG_Load(StringValuePtr(filename));
409 #else
410 - surface=SDL_LoadBMP(STR2CSTR(filename));
411 + surface=SDL_LoadBMP(StringValuePtr(filename));
412 #endif
413 if(!surface) SDL_RAISE;
414 return createSurfaceObject(surface);
415 @@ -296,7 +296,7 @@
417 initVideo();
419 - rwops=SDL_RWFromMem(RSTRING(self)->ptr, RSTRING(self)->len);
420 + rwops=SDL_RWFromMem(RSTRING_PTR(self), RSTRING_LEN(self));
422 #ifdef HAVE_SDL_IMAGE_H
423 surface=IMG_Load_RW(rwops, 0);
424 @@ -558,7 +558,7 @@
426 static VALUE surface_save_bmp(VALUE self, VALUE filename)
428 - if(SDL_SaveBMP(retrieveSurfacePointer(self), STR2CSTR(filename))==-1) SDL_RAISE;
429 + if(SDL_SaveBMP(retrieveSurfacePointer(self), StringValuePtr(filename))==-1) SDL_RAISE;
430 return self;
433 @@ -827,7 +827,7 @@
435 RUDL_VERIFY(rb_obj_is_kind_of(colors, rb_cArray), "Need array of colors");
437 - amount=RARRAY(colors)->len;
438 + amount=RARRAY_LEN(colors);
440 if (!pal) return Qfalse;
442 @@ -1117,10 +1117,10 @@
444 RUDL_VERIFY(y >= 0 && y < surface->h, "coordinate out of bounds");
446 - RUDL_ASSERT(RSTRING(pixels)->len >= surface->w*surface->format->BytesPerPixel, "Not enough data for a complete row");
447 + RUDL_ASSERT(RSTRING_LEN(pixels) >= surface->w*surface->format->BytesPerPixel, "Not enough data for a complete row");
449 SDL_LockSurface(surface);
450 - copy_line_to_surface(surface, y, RSTRING(pixels)->ptr);
451 + copy_line_to_surface(surface, y, RSTRING_PTR(pixels));
452 SDL_UnlockSurface(surface);
453 return self;
455 @@ -1220,7 +1220,7 @@
456 SDL_LockSurface(surface);
458 dest = ((Uint8*) surface->pixels) + x*pixelsize;
459 - src = RSTRING(pixels)->ptr;
460 + src = RSTRING_PTR(pixels);
462 for (y=0; y<h; y++) {
463 memcpy(dest, src, pixelsize);
464 @@ -1302,9 +1302,9 @@
466 Check_Type(pixels, T_STRING);
467 size=surface->w*surface->h*surface->format->BytesPerPixel;
468 - pixelpointer=RSTRING(pixels)->ptr;
469 + pixelpointer=RSTRING_PTR(pixels);
471 - RUDL_ASSERT(RSTRING(pixels)->len>=size, "Not enough data in string");
472 + RUDL_ASSERT(RSTRING_LEN(pixels)>=size, "Not enough data in string");
474 if(surface->pitch==surface->w){
475 memcpy(surface->pixels, pixelpointer, size);