[maniadrive] - Fix story mode not working with php >= 5.3.5 (rhbz#668657)

Hans de Goede jwrdegoede at fedoraproject.org
Tue Jan 11 11:46:12 UTC 2011


commit e07c63357c1d16ef6f28613d118928328c4a9c33
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Jan 11 12:53:53 2011 +0100

    - Fix story mode not working with php >= 5.3.5 (rhbz#668657)

 ...rive-1.2-fix-modifying-php-strings-inline.patch |  121 ++++++++++++++++++++
 maniadrive.spec                                    |    9 +-
 2 files changed, 128 insertions(+), 2 deletions(-)
---
diff --git a/maniadrive-1.2-fix-modifying-php-strings-inline.patch b/maniadrive-1.2-fix-modifying-php-strings-inline.patch
new file mode 100644
index 0000000..2c1d5f0
--- /dev/null
+++ b/maniadrive-1.2-fix-modifying-php-strings-inline.patch
@@ -0,0 +1,121 @@
+diff -up ManiaDrive-1.2-src/mania_localtracks.php~ ManiaDrive-1.2-src/mania_localtracks.php
+--- ManiaDrive-1.2-src/mania_localtracks.php~	2006-08-16 23:15:49.000000000 +0200
++++ ManiaDrive-1.2-src/mania_localtracks.php	2011-01-11 11:56:20.764096983 +0100
+@@ -26,8 +26,7 @@ while( ($file = readdir($handle)) !== fa
+ closedir($handle);
+ }
+ 
+-$data_dir=str_pad('',1000);
+-raydium_file_home_path_cpy("data",$data_dir);
++$data_dir=raydium_file_home_path("data");
+ 
+ search_here(".");
+ search_here($data_dir);
+diff -up ManiaDrive-1.2-src/mania_story.php~ ManiaDrive-1.2-src/mania_story.php
+--- ManiaDrive-1.2-src/mania_story.php~	2006-07-06 21:50:47.000000000 +0200
++++ ManiaDrive-1.2-src/mania_story.php	2011-01-11 11:54:35.100096998 +0100
+@@ -45,8 +45,7 @@ return $best;
+ 
+ $story=file($story_file);
+ 
+-$state_file=str_pad('',1000);
+-raydium_file_home_path_cpy("mania_drive.state",$state_file);
++$state_file=raydium_file_home_path("mania_drive.state");
+ if(file_exists($state_file))
+     $scores=file($state_file);
+ 
+diff -up ManiaDrive-1.2-src/raydium/network.h~ ManiaDrive-1.2-src/raydium/network.h
+--- ManiaDrive-1.2-src/raydium/network.h~	2006-07-23 13:24:08.000000000 +0200
++++ ManiaDrive-1.2-src/raydium/network.h	2011-01-11 11:54:15.149097004 +0100
+@@ -29,7 +29,7 @@ signed char raydium_network_server_creat
+ void raydium_random_randomize(void);
+ signed char raydium_parser_db_get(char *key, char *value, char *def);
+ void raydium_register_function(void *addr,char *name);
+-void raydium_file_home_path_cpy(char *file, char *dest);
++char *raydium_file_home_path(char *name);
+ void raydium_timecall_init(void);
+ 
+ 
+@@ -43,7 +43,7 @@ exit(0);
+ // do the minimal reg_api job (this should not be done like this ! :/)
+ // part 1
+ PHP_i_sss(raydium_parser_db_get);
+-PHP_v_ss(raydium_file_home_path_cpy);
++PHP_s_s(raydium_file_home_path);
+ #endif
+ 
+ void raydium_network_only_init(int argc, char **argv)
+@@ -59,7 +59,7 @@ raydium_php_init();
+ // do the minimal reg_api job (this should not be done like this ! :/)
+ // part 2
+ raydium_register_function(C2PHP(raydium_parser_db_get),"raydium_parser_db_get");
+-raydium_register_function(C2PHP(raydium_file_home_path_cpy),"raydium_file_home_path_cpy");
++raydium_register_function(C2PHP(raydium_file_home_path),"raydium_file_home_path");
+         
+ #endif
+ raydium_network_init();
+diff -up ManiaDrive-1.2-src/raydium/php_wrappers.c~ ManiaDrive-1.2-src/raydium/php_wrappers.c
+--- ManiaDrive-1.2-src/raydium/php_wrappers.c~	2006-04-29 00:46:55.000000000 +0200
++++ ManiaDrive-1.2-src/raydium/php_wrappers.c	2011-01-11 11:59:41.067097001 +0100
+@@ -197,6 +197,17 @@ if (zend_parse_parameters(ZEND_NUM_ARGS(
+ fname(a);\
+ }
+ 
++// char* f(char *)
++#define PHP_s_s(fname)\
++ZEND_FUNCTION(fname)\
++{\
++char *a;\
++long s_len;\
++if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,\
++  "s", &a, &s_len) == FAILURE)  return;\
++RETURN_STRING(fname(a),1);\
++}
++
+ // int f(char *, char*, char *)
+ #define PHP_i_sss(fname)\
+ ZEND_FUNCTION(fname)\
+diff -up ManiaDrive-1.2-src/raydium/reg_api.c~ ManiaDrive-1.2-src/raydium/reg_api.c
+--- ManiaDrive-1.2-src/raydium/reg_api.c~	2006-08-11 15:26:53.000000000 +0200
++++ ManiaDrive-1.2-src/raydium/reg_api.c	2011-01-11 11:53:25.277097231 +0100
+@@ -19,7 +19,7 @@
+ // Part 1: create PHP wrappers
+ 
+ // file.c
+-PHP_v_ss(raydium_file_home_path_cpy);
++PHP_s_s(raydium_file_home_path);
+ 
+ // light.c
+ PHP_v_v(raydium_light_enable)
+@@ -191,7 +191,7 @@ if(done)
+     }
+ 
+ // file.c
+-raydium_register_function(C2PHP(raydium_file_home_path_cpy),"raydium_file_home_path_cpy");
++raydium_register_function(C2PHP(raydium_file_home_path),"raydium_file_home_path");
+ 
+ // light.c
+ raydium_register_function(C2PHP(raydium_light_enable),"raydium_light_enable");
+diff -up ManiaDrive-1.2-src/rayphp/libfile.php~ ManiaDrive-1.2-src/rayphp/libfile.php
+--- ManiaDrive-1.2-src/rayphp/libfile.php~	2006-08-11 15:26:53.000000000 +0200
++++ ManiaDrive-1.2-src/rayphp/libfile.php	2011-01-11 11:55:02.572096869 +0100
+@@ -98,8 +98,7 @@ function read_repositories_file($repos)
+ global $raydium_php_rayphp_path;
+ $repos_list=array();
+     
+-$tmp=str_pad("",256);
+-raydium_file_home_path_cpy($repos,$tmp);
++$tmp=raydium_file_home_path($repos);
+ 
+ if(file_exists($tmp))
+     read_repositories_file_internal($tmp,$repos_list);
+@@ -144,8 +143,7 @@ function valid_entry($r)
+ // unzip a given input
+ function gzdecode($in)
+ {
+-  $tmp=str_pad("",256);
+-  raydium_file_home_path_cpy("tmp.tmp.gz",$tmp);
++  $tmp=raydium_file_home_path("tmp.tmp.gz");
+   $fp=fopen($tmp,"wb");
+   if(!$fp) return false;
+   fwrite($fp,$in);
diff --git a/maniadrive.spec b/maniadrive.spec
index 01242e6..1ec4acf 100644
--- a/maniadrive.spec
+++ b/maniadrive.spec
@@ -1,6 +1,6 @@
 Name:           maniadrive
 Version:        1.2
-Release:        25%{?dist}
+Release:        26%{?dist}
 Summary:        3D stunt driving game
 Group:          Amusements/Games
 License:        GPLv2+
@@ -12,12 +12,13 @@ Source3:        %{name}-track-editor.desktop
 Patch0:         %{name}-1.2-fixes.patch
 Patch1:         %{name}-1.2-php-5.2.8-fix.patch
 Patch2:         %{name}-1.2-fix-ode-assert.h
+Patch3:         %{name}-1.2-fix-modifying-php-strings-inline.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  glew-devel ode-devel php-devel php-embedded-devel
 BuildRequires:  libjpeg-devel libXinerama-devel
 BuildRequires:  libvorbis-devel desktop-file-utils
 BuildRequires:  openal-soft-devel freealut-devel >= 1.1.0-10
-Requires:       %{name}-data = %{version}, php-soap, hicolor-icon-theme
+Requires:       %{name}-data >= 1.2-5, php-soap, hicolor-icon-theme
 Requires:       opengl-games-utils
 # for people who try to install this using upstream capitalization
 Provides:       ManiaDrive = %{version}-%{release}
@@ -72,6 +73,7 @@ developing applications that use raydium.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 rm -r rayphp/r3s rayphp/README
 
 
@@ -166,6 +168,9 @@ fi
 
 
 %changelog
+* Tue Jan 11 2011 Hans de Goede <hdegoede at redhat.com> 1.2-26
+- Fix story mode not working with php >= 5.3.5 (rhbz#668657)
+
 * Sun Jan 09 2011 Hans de Goede <hdegoede at redhat.com> 1.2-25
 - Fix a crash when pressing 't', which enables the drawing of ode
   wire frames (rhbz#657353)


More information about the scm-commits mailing list