diff --git a/Makefile.in b/Makefile.in index 30fb033..b9bb715 100644 --- a/Makefile.in +++ b/Makefile.in @@ -91,7 +91,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -249,13 +248,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/aclocal.m4 b/aclocal.m4 index 01dbba5..f6eb2a8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1433,7 +1433,6 @@ m4_include([macros/argz.m4]) m4_include([macros/esd.m4]) m4_include([macros/freetype2.m4]) m4_include([macros/gettext.m4]) -m4_include([macros/glib-2.0.m4]) m4_include([macros/gtk-2.0.m4]) m4_include([macros/iconv.m4]) m4_include([macros/lib-ld.m4]) diff --git a/config.h.in b/config.h.in index 6753ba0..92abc7c 100644 --- a/config.h.in +++ b/config.h.in @@ -39,9 +39,6 @@ /* Define this if you have freetype2 installed */ #undef ENABLE_FT2 -/* Define this if you have glib >= 2.0.0 */ -#undef ENABLE_GLIB - /* Define this if you have gtk+ >= 2.0.0 */ #undef ENABLE_GTK @@ -225,6 +222,9 @@ /* Define this if you have libXxf86vm installed */ #undef HAVE_XF86VMODE +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + /* joystick device */ #undef JOY_DEVICE diff --git a/configure b/configure index 8f7aa26..4a712fe 100755 --- a/configure +++ b/configure @@ -668,6 +668,8 @@ SDL SDL2_CONFIG SDL_LIBS SDL_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH SRC_MIDI SRC_CDROM SRC_AUDIO @@ -681,14 +683,6 @@ HAVE_GTK_FALSE HAVE_GTK_TRUE GTK_LIBS GTK_CFLAGS -GLIB_COMPILE_RESOURCES -GLIB_MKENUMS -GOBJECT_QUERY -GLIB_GENMARSHAL -GLIB_LIBS -GLIB_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH PKG_CONFIG ZLIB_LIBS X_EXTRA_LIBS @@ -872,7 +866,6 @@ with_libiconv_prefix enable_nls with_libintl_prefix with_x -enable_glibtest enable_gtk enable_gtktest enable_audio @@ -1570,7 +1563,6 @@ Optional Features: --enable-ltdl-install install libltdl --disable-rpath do not hardcode runtime library paths --disable-nls do not use Native Language Support - --disable-glibtest do not try to compile and run a test GLIB program --enable-gtk Enable gtk-based widget default=yes --disable-gtktest do not try to compile and run a test GTK+ program --enable-audio=mode_list Enable audio (Specify comma separated mode list): @@ -15504,363 +15496,160 @@ fi -# Check whether --enable-glibtest was given. -if test "${enable_glibtest+set}" = set; then : - enableval=$enable_glibtest; -else - enable_glibtest=yes -fi - pkg_config_args=glib-2.0 - for module in . - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gmodule-no-export) - pkg_config_args="$pkg_config_args gmodule-no-export-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - gio*) - pkg_config_args="$pkg_config_args $module-2.0" - ;; - esac + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi done - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.16 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi - - no_glib="" - - if test "x$PKG_CONFIG" = x ; then - no_glib=yes - PKG_CONFIG=no - fi - - min_glib_version=2.0.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 -$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" - rm -f conf.glibtest - if test "$cross_compiling" = yes; then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include #include - +#include int main () { - unsigned int major, minor, micro; - - fclose (fopen ("conf.glibtest", "w")); - - if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - no_glib=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 -$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; } - -$as_echo "#define ENABLE_GLIB 1" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed." + am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - GLIB_COMPILE_RESOURCES="" - as_fn_error $? "*** check for glib-2.x failed ***" "$LINENO" 5 + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= fi + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 +$as_echo_n "checking for iconv declaration... " >&6; } + if ${am_cv_proto_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif - rm -f conf.glibtest +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_cv_proto_iconv_arg1="" +else + am_cv_proto_iconv_arg1="const" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +$as_echo "${ac_t:- + }$am_cv_proto_iconv" >&6; } + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +_ACEOF + + fi # Check whether --enable-gtk was given. @@ -17098,6 +16887,126 @@ fi if test "x$enable_sdl" = xyes ; then + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + # Check whether --with-sdl-prefix was given. if test "${with_sdl_prefix+set}" = set; then : withval=$with_sdl_prefix; sdl_prefix="$withval" diff --git a/configure.ac b/configure.ac index c4eb65a..3234879 100644 --- a/configure.ac +++ b/configure.ac @@ -142,29 +142,9 @@ dnl [enable_pkgc=yes]) dnl fi dnl -dnl check glib +dnl check iconv dnl -AM_PATH_GLIB_2_0(2.0.0, - AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 2.0.0]), - AC_MSG_ERROR(*** check for glib-2.x failed ***) -) - - -dnl if test x"$enable_pkgc" = "xno"; then -dnl AM_PATH_GLIB(1.2.0, -dnl AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0]),must_gtk=yes) -dnl if test x"$must_gtk" = "xyes"; then -dnl AC_MSG_RESULT("May be 1.0.x ?. You can't be disable gtk") -dnl fi -dnl else -dnl AC_ARG_WITH(glib-target, -dnl [ --with-glib-target target glib [default=glib]], -dnl [glibtarget="glib$withval"],[glibtarget="glib"]) -dnl PKG_CHECK_MODULES(BASE_DEPENDENCEIS, $glibtarget >= 1.2.0) -dnl GLIB_CFLAGS="`$PKGCONFIG --cflags $glibtarget`" -dnl GLIB_LIBS="`$PKGCONFIG --libs $glibtarget`" -dnl AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0]) -dnl fi +AM_ICONV dnl dnl check for gtk diff --git a/macros/Makefile.am b/macros/Makefile.am index 5fcbc82..e2ef852 100644 --- a/macros/Makefile.am +++ b/macros/Makefile.am @@ -8,7 +8,6 @@ MACROS= \ esd.m4 \ freetype2.m4 \ gettext.m4 \ - glib-2.0.m4 \ glibc21.m4 \ gtk-2.0.m4 \ iconv.m4 \ diff --git a/macros/Makefile.in b/macros/Makefile.in index 9b6aa93..2267505 100644 --- a/macros/Makefile.in +++ b/macros/Makefile.in @@ -86,7 +86,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -164,13 +163,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -334,7 +327,6 @@ MACROS = \ esd.m4 \ freetype2.m4 \ gettext.m4 \ - glib-2.0.m4 \ glibc21.m4 \ gtk-2.0.m4 \ iconv.m4 \ diff --git a/macros/glib-2.0.m4 b/macros/glib-2.0.m4 deleted file mode 100644 index d8f03d4..0000000 --- a/macros/glib-2.0.m4 +++ /dev/null @@ -1,211 +0,0 @@ -# Configure paths for GLIB -# Owen Taylor 1997-2001 - -dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, -dnl gthread, or gio is specified in MODULES, pass to pkg-config -dnl -AC_DEFUN([AM_PATH_GLIB_2_0], -[dnl -dnl Get the cflags and libraries from pkg-config -dnl -AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], - , enable_glibtest=yes) - - pkg_config_args=glib-2.0 - for module in . $4 - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gmodule-no-export) - pkg_config_args="$pkg_config_args gmodule-no-export-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - gio*) - pkg_config_args="$pkg_config_args $module-2.0" - ;; - esac - done - - PKG_PROG_PKG_CONFIG([0.16]) - - no_glib="" - - if test "x$PKG_CONFIG" = x ; then - no_glib=yes - PKG_CONFIG=no - fi - - min_glib_version=ifelse([$1], ,2.0.0,$1) - AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" -dnl -dnl Now check if the installed GLIB is sufficiently new. (Also sanity -dnl checks the results of pkg-config to some extent) -dnl - rm -f conf.glibtest - AC_TRY_RUN([ -#include -#include -#include - -int -main () -{ - unsigned int major, minor, micro; - - fclose (fopen ("conf.glibtest", "w")); - - if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - GLIB_COMPILE_RESOURCES="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - AC_SUBST(GLIB_GENMARSHAL) - AC_SUBST(GOBJECT_QUERY) - AC_SUBST(GLIB_MKENUMS) - AC_SUBST(GLIB_COMPILE_RESOURCES) - rm -f conf.glibtest -]) diff --git a/modules/AliceLogo/Makefile.in b/modules/AliceLogo/Makefile.in index 858acfb..fcd3610 100644 --- a/modules/AliceLogo/Makefile.in +++ b/modules/AliceLogo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/Confirm/Makefile.in b/modules/Confirm/Makefile.in index 8867eb4..e702e4c 100644 --- a/modules/Confirm/Makefile.in +++ b/modules/Confirm/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/Gpx/Gpx.c b/modules/Gpx/Gpx.c index 44ab18d..cb85adc 100644 --- a/modules/Gpx/Gpx.c +++ b/modules/Gpx/Gpx.c @@ -28,7 +28,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" @@ -75,9 +74,9 @@ static int sf_free_one(int no) { s = suf[no]; if (s == NULL) return NG; - if (s->pixel) g_free(s->pixel); - if (s->alpha) g_free(s->alpha); - g_free(s); + if (s->pixel) free(s->pixel); + if (s->alpha) free(s->alpha); + free(s); suf[no] = NULL; pre_freesurfno = no; @@ -91,9 +90,9 @@ static int sf_free_all() { for (i = 1; i < MAX_SURFACE; i++) { if (suf[i] == NULL) continue; s = suf[i]; - if (s->pixel) g_free(s->pixel); - if (s->alpha) g_free(s->alpha); - g_free(s); + if (s->pixel) free(s->pixel); + if (s->alpha) free(s->alpha); + free(s); suf[i] = NULL; } diff --git a/modules/Gpx/Makefile.am b/modules/Gpx/Makefile.am index cff7509..ed20c7b 100644 --- a/modules/Gpx/Makefile.am +++ b/modules/Gpx/Makefile.am @@ -1,11 +1,11 @@ pkglib_LTLIBRARIES = Gpx.la Gpx_la_LDFLAGS = -module -export-dynamic -avoid-version -Gpx_la_LIBADD = ../lib/libgraph.la @GLIB_LIBS@ +Gpx_la_LIBADD = ../lib/libgraph.la Gpx_la_SOURCES = Gpx.c \ effectcopy.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/Gpx/Makefile.in b/modules/Gpx/Makefile.in index dce6276..24b8414 100644 --- a/modules/Gpx/Makefile.in +++ b/modules/Gpx/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -408,11 +401,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = Gpx.la Gpx_la_LDFLAGS = -module -export-dynamic -avoid-version -Gpx_la_LIBADD = ../lib/libgraph.la @GLIB_LIBS@ +Gpx_la_LIBADD = ../lib/libgraph.la Gpx_la_SOURCES = Gpx.c \ effectcopy.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/Makefile.in b/modules/Makefile.in index 40e7ba4..c5c20c5 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -86,7 +86,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -224,13 +223,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/Math/Makefile.in b/modules/Math/Makefile.in index d18b32a..7d90873 100644 --- a/modules/Math/Makefile.in +++ b/modules/Math/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/MsgSkip/Makefile.in b/modules/MsgSkip/Makefile.in index 3fef343..92c0566 100644 --- a/modules/MsgSkip/Makefile.in +++ b/modules/MsgSkip/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -250,13 +249,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/NIGHTDLL/Makefile.am b/modules/NIGHTDLL/Makefile.am index ff22fe5..2f315cf 100644 --- a/modules/NIGHTDLL/Makefile.am +++ b/modules/NIGHTDLL/Makefile.am @@ -1,7 +1,7 @@ pkglib_LTLIBRARIES = NIGHTDLL.la NIGHTDLL_la_LDFLAGS = -module -export-dynamic -avoid-version -NIGHTDLL_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la @GLIB_LIBS@ +NIGHTDLL_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la NIGHTDLL_la_SOURCES = \ NIGHTDLL.c \ nt_scenario.c \ @@ -17,7 +17,7 @@ NIGHTDLL_la_SOURCES = \ nt_graph.c \ nt_sound.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/NIGHTDLL/Makefile.in b/modules/NIGHTDLL/Makefile.in index 1c76152..c9125b2 100644 --- a/modules/NIGHTDLL/Makefile.in +++ b/modules/NIGHTDLL/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -247,13 +246,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -411,7 +404,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = NIGHTDLL.la NIGHTDLL_la_LDFLAGS = -module -export-dynamic -avoid-version -NIGHTDLL_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la @GLIB_LIBS@ +NIGHTDLL_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la NIGHTDLL_la_SOURCES = \ NIGHTDLL.c \ nt_scenario.c \ @@ -427,7 +420,7 @@ NIGHTDLL_la_SOURCES = \ nt_graph.c \ nt_sound.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/NIGHTDLL/NIGHTDLL.c b/modules/NIGHTDLL/NIGHTDLL.c index 0309dbb..a0ed580 100644 --- a/modules/NIGHTDLL/NIGHTDLL.c +++ b/modules/NIGHTDLL/NIGHTDLL.c @@ -1,7 +1,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" diff --git a/modules/NIGHTDLL/night.h b/modules/NIGHTDLL/night.h index 282d1be..1d9cd81 100644 --- a/modules/NIGHTDLL/night.h +++ b/modules/NIGHTDLL/night.h @@ -2,7 +2,6 @@ #define __NIGHT_H__ #include "config.h" -#include #include "portab.h" #include "graphics.h" #include "surface.h" @@ -61,7 +60,7 @@ struct _night { void (* cbmove)(agsevent_t *); void (* cbrelease)(agsevent_t *); } msg; - //GSList *strreplace; + //SList *strreplace; // sel int selmode; diff --git a/modules/NIGHTDLL/nt_event.c b/modules/NIGHTDLL/nt_event.c index 5c10c9b..a233fee 100644 --- a/modules/NIGHTDLL/nt_event.c +++ b/modules/NIGHTDLL/nt_event.c @@ -1,7 +1,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" diff --git a/modules/NIGHTDLL/nt_msg.c b/modules/NIGHTDLL/nt_msg.c index 6b9087d..a9bf32d 100644 --- a/modules/NIGHTDLL/nt_msg.c +++ b/modules/NIGHTDLL/nt_msg.c @@ -2,7 +2,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -356,7 +355,7 @@ static void set_align(char *msg, sprite_t *sp, int wSize) { while (*msg) { if (*msg == '\n') { line++; - maxchar = MAX(maxchar, c); + maxchar = max(maxchar, c); c = 0; msg++; continue; @@ -364,7 +363,7 @@ static void set_align(char *msg, sprite_t *sp, int wSize) { msg++; c++; } - maxchar = MAX(maxchar, c); + maxchar = max(maxchar, c); line++; sp->u.msg.dspcur.x = (sp->cursize.width - (maxchar * wSize/2)) /2; sp->u.msg.dspcur.y = (sp->cursize.height - (line * (wSize+2))) /2; diff --git a/modules/NIGHTDLL/sactcg.c b/modules/NIGHTDLL/sactcg.c index abb6571..c8c4488 100644 --- a/modules/NIGHTDLL/sactcg.c +++ b/modules/NIGHTDLL/sactcg.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "nact.h" @@ -78,14 +77,14 @@ cginfo_t *scg_loadcg_no(int no, boolean refinc) { return cgs[no]; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_LINKED; i->no = no; i->refcnt = (refinc ? 1 : 0); i->sf = sf_loadcg_no(no -1); if (i->sf == NULL) { WARNING("load fail (%d)\n", no -1); - g_free(i); + free(i); return NULL; } @@ -100,7 +99,7 @@ int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int spcg_assert_no(wNumCG); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 1; @@ -129,7 +128,7 @@ int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_REVERSE; i->no = wNumCG; i->refcnt = 0; @@ -157,7 +156,7 @@ int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) { return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_STRETCH; i->no = wNumCG; i->refcnt = 0; @@ -186,7 +185,7 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen blendcg = scg_loadcg_no(wNumBlendCG, FALSE); if (basecg == NULL || blendcg == NULL) return NG; - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -222,7 +221,7 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText) font->sel_font(FONT_GOTHIC, wSize); glyph = font->get_glyph(cText); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 0; @@ -261,7 +260,7 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, font->sel_font(FONT_GOTHIC, wSize); glyph = font->get_glyph(s); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 0; @@ -289,7 +288,7 @@ int scg_copy(int wNumDstCG, int wNumSrcCG) { return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -316,7 +315,7 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -357,7 +356,7 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -442,7 +441,7 @@ int scg_free_cgobj(cginfo_t *cg) { cgs[cg->no] = NULL; } - g_free(cg); + free(cg); return OK; } diff --git a/modules/NIGHTDLL/sactcg_stretch.c b/modules/NIGHTDLL/sactcg_stretch.c index b6c5c2d..9c280a1 100644 --- a/modules/NIGHTDLL/sactcg_stretch.c +++ b/modules/NIGHTDLL/sactcg_stretch.c @@ -1,6 +1,6 @@ // 拡大縮小 static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { - surface_t *dst = g_new0(surface_t, 1); + surface_t *dst = calloc(1, sizeof(surface_t)); float a1, a2, xd, yd; int sw, sh; int *row, *col; @@ -16,10 +16,10 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { dst->has_alpha = src->has_alpha; if (src->has_pixel) { - dst->pixel = g_malloc(dh * dst->bytes_per_line); + dst->pixel = malloc(dh * dst->bytes_per_line); } if (src->has_alpha) { - dst->alpha = g_malloc(dw * dh); + dst->alpha = malloc(dw * dh); } @@ -30,10 +30,10 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { a1 = (float)sw / (float)dw; a2 = (float)sh / (float)dh; - row = g_new(int, dw); + row = malloc(sizeof(int) * dw); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh +1); + col = calloc(dh +1, sizeof(int)); if (mirror & 1) { /* 上下反転 added by tajiri@wizard */ @@ -110,8 +110,8 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { } } - g_free(row); - g_free(col); + free(row); + free(col); return dst; } diff --git a/modules/NIGHTDLL/sactstring.c b/modules/NIGHTDLL/sactstring.c index c67c3f9..ff827a2 100644 --- a/modules/NIGHTDLL/sactstring.c +++ b/modules/NIGHTDLL/sactstring.c @@ -23,10 +23,11 @@ #include "config.h" #include -#include +#include #include #include "portab.h" #include "system.h" +#include "list.h" #include "variable.h" // 文字列置換用 @@ -43,7 +44,7 @@ static int idxmax; // stack pointerの最大 // 文字列置き換え用 (表示時にon-the-flyで変換して表示) #define REPLACEBUFSIZE 3000 static char repbuf[2][REPLACEBUFSIZE]; -static GSList *strreplace; +static SList *strreplace; static char *replacesrc; static char *replacedst; @@ -51,7 +52,7 @@ static char *replacedst; * 文字列変数スタックの初期化 */ int sstr_init() { - stack = g_new(char *, DEFSTACKSIZE); + stack = malloc(sizeof(char *) * DEFSTACKSIZE); idx = 0; idxmax = DEFSTACKSIZE; return OK; @@ -63,11 +64,11 @@ int sstr_init() { */ int sstr_push(char *str) { if (idx >= idxmax) { - stack = g_renew(char *, stack, idx*2); + stack = realloc(stack, sizeof(char *) * idx*2); idxmax = idx*2; } - stack[idx++] = g_strdup(str); + stack[idx++] = strdup(str); return OK; } @@ -80,7 +81,7 @@ int sstr_pop(char *str, int maxlen) { if (idx == 0) return NG; strncpy(str, stack[--idx], maxlen); - g_free(stack[idx]); + free(stack[idx]); return OK; } @@ -95,10 +96,10 @@ int sstr_regist_replace(char *sstr, char *dstr) { if (sstr == dstr) return NG; - ex = g_new(strexchange_t, 1); + ex = malloc(sizeof(strexchange_t)); ex->src = strdup(sstr); ex->dst = strdup(dstr); - strreplace = g_slist_append(strreplace, ex); + strreplace = slist_append(strreplace, ex); return OK; } @@ -123,7 +124,7 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) { } // 文字列の置き換え処理 -static void replacestr_cb(gpointer data, gpointer userdata) { +static void replacestr_cb(void* data, void* userdata) { strexchange_t *ex = (strexchange_t *)data; char *start, *next, *out; @@ -155,7 +156,7 @@ char *sstr_replacestr(char *msg) { strncpy(repbuf[0], msg, REPLACEBUFSIZE); replacesrc = repbuf[0]; replacedst = repbuf[1]; - g_slist_foreach(strreplace, replacestr_cb, NULL); + slist_foreach(strreplace, replacestr_cb, NULL); return (repbuf[0][0] == '\0') ? repbuf[1] : repbuf[0]; } diff --git a/modules/NIGHTDLL/sprite.c b/modules/NIGHTDLL/sprite.c index 87c647d..ce9b9d0 100644 --- a/modules/NIGHTDLL/sprite.c +++ b/modules/NIGHTDLL/sprite.c @@ -1,6 +1,5 @@ #include "config.h" #include -#include #include "portab.h" #include "sprite.h" @@ -12,7 +11,7 @@ sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type) { sprite_t *sp; - sp = g_new0(sprite_t, 1); + sp = calloc(1, sizeof(sprite_t)); sp->no = no; sp->type = type; @@ -50,7 +49,7 @@ sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type) { sprite_t *sp_msg_new(int no, int x, int y, int width, int height) { sprite_t *sp; - sp = g_new0(sprite_t, 1); + sp = calloc(1, sizeof(sprite_t)); sp->no = no; sp->type = SPRITE_MSG; @@ -80,7 +79,7 @@ void sp_free(sprite_t *sp) { sf_free(sp->u.msg.canvas); } - g_free(sp); + free(sp); } void sp_set_show(sprite_t *sp, boolean show) { diff --git a/modules/NIGHTDLL/sprite.h b/modules/NIGHTDLL/sprite.h index 9f7598f..9597872 100644 --- a/modules/NIGHTDLL/sprite.h +++ b/modules/NIGHTDLL/sprite.h @@ -2,8 +2,6 @@ #ifndef __SPRITE_H__ #define __SPRITE_H__ -#include - #include "portab.h" #include "surface.h" #include "graphics.h" @@ -128,7 +126,7 @@ extern int sp_draw_wall(sprite_t *sp, MyRectangle *r); /* in nt_sprite_draw.c */ extern int sp_draw(sprite_t *sp, MyRectangle *r); extern int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r); -extern void sp_draw_dmap(gpointer data, gpointer userdata); +extern void sp_draw_dmap(void* data, void* userdata); extern int sp_draw_scg(sprite_t *sp, MyRectangle *r); /* in nt_sprite_eupdate.c */ diff --git a/modules/NIGHTDLL/sprite_draw.c b/modules/NIGHTDLL/sprite_draw.c index 3caa4a3..7422c55 100644 --- a/modules/NIGHTDLL/sprite_draw.c +++ b/modules/NIGHTDLL/sprite_draw.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" diff --git a/modules/NIGHTDLL/sprite_eupdate.c b/modules/NIGHTDLL/sprite_eupdate.c index f19e214..bd4d6e6 100644 --- a/modules/NIGHTDLL/sprite_eupdate.c +++ b/modules/NIGHTDLL/sprite_eupdate.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -110,7 +109,7 @@ static void ec7_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC7DELTA); i++) { + for (i = 0; i < min(t + 1, EC7DELTA); i++) { y = i + EC7DELTA * (t - i); if (y < 0 || y >= sfsrc->height) continue; gr_copy(sf0, 0, y, @@ -138,7 +137,7 @@ static void ec8_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC8DELTA); i++) { + for (i = 0; i < min(t + 1, EC8DELTA); i++) { x = i + EC8DELTA * (t - i); if (x < 0 || x >= sfsrc->width) continue; gr_copy(sf0, x, 0, @@ -157,7 +156,7 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) { int curstep, maxstep; int i, t, x, y; - maxstep = MAX(sfsrc->height / EC9DELTA + EC9DELTA, + maxstep = max(sfsrc->height / EC9DELTA + EC9DELTA, sfsrc->width / EC9DELTA + EC9DELTA); curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime); @@ -169,13 +168,13 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC9DELTA); i++) { + for (i = 0; i < min(t + 1, EC9DELTA); i++) { y = i + EC9DELTA * (t - i); if (y < 0 || y >= sfsrc->height) continue; gr_copy(sf0, 0, y, sfdst, 0, y, sfsrc->width, 1); } - for (i = 0; i < MIN(t + 1, EC9DELTA); i++) { + for (i = 0; i < min(t + 1, EC9DELTA); i++) { x = i + EC9DELTA * (t - i); if (x < 0 || x >= sfsrc->width) continue; gr_copy(sf0, x, 0, @@ -201,8 +200,8 @@ static void ec12_cb(surface_t *src, surface_t *dst) { usleep(0); return; } - st_i = MAX(0, curstep - EC12DELTA + 1); - ed_i = MIN(src->height -1, curstep); + st_i = max(0, curstep - EC12DELTA + 1); + ed_i = min(src->height -1, curstep); l = ed_i - st_i + 1; for (j = st_i; j < ed_i; j++) { gre_Blend(sf0, 0, j, src, 0, j, dst, 0, j, src->width, 1, curstep - j); @@ -232,8 +231,8 @@ static void ec13_cb(surface_t *src, surface_t *dst) { usleep(0); return; } - st_i = MAX(0, curstep - EC13DELTA + 1); - ed_i = MIN(src->height -1, curstep); + st_i = max(0, curstep - EC13DELTA + 1); + ed_i = min(src->height -1, curstep); l = ed_i - st_i + 1; for (j = st_i; j < ed_i; j++) { gre_Blend(sf0, 0, dyy - j, src, 0, syy1-j, dst, 0, syy2-j, src->width, 1, curstep - j); diff --git a/modules/NIGHTDLL/sprite_update.c b/modules/NIGHTDLL/sprite_update.c index 60d8554..3cc4fef 100644 --- a/modules/NIGHTDLL/sprite_update.c +++ b/modules/NIGHTDLL/sprite_update.c @@ -24,10 +24,10 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" +#include "list.h" #include "counter.h" #include "ags.h" #include "graphics.h" @@ -37,15 +37,15 @@ #include "sprite.h" // スプライト再描画間の間に変更のあったスプライトの領域の和 -static GSList *updatearea; +static SList *updatearea; // 再描画するスプライトのリスト -static GSList *updatelist; +static SList *updatelist; static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst); -static void disjunction(gpointer region, gpointer data); +static void disjunction(void* region, void* data); static MyRectangle get_updatearea(); -static void do_update_each(gpointer data, gpointer userdata); +static void do_update_each(void* data, void* userdata); // 領域1と領域2の積を計算 static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst) { @@ -61,7 +61,7 @@ static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst) { } // 領域1と領域2をすべて含む矩形領域を計算 -static void disjunction(gpointer region, gpointer data) { +static void disjunction(void* region, void* data) { MyRectangle *r1 = (MyRectangle *)region; MyRectangle *r2 = (MyRectangle *)data; int x1, x2, y1, y2; @@ -96,9 +96,9 @@ static MyRectangle get_updatearea() { MyRectangle rsf0 = {0, 0, sf0->width, sf0->height}; MyRectangle result; - g_slist_foreach(updatearea, disjunction, &clip); + slist_foreach(updatearea, disjunction, &clip); - g_slist_free(updatearea); + slist_free(updatearea); updatearea = NULL; // surface0との領域の積をとる @@ -112,7 +112,7 @@ static MyRectangle get_updatearea() { } // updatelist に登録してあるすべてのスプライトを更新 -static void do_update_each(gpointer data, gpointer userdata) { +static void do_update_each(void* data, void* userdata) { sprite_t *sp = (sprite_t *)data; MyRectangle *r = (MyRectangle *)userdata; @@ -135,7 +135,7 @@ int sp_update_all(boolean syncscreen) { // updatelistに登録してあるスプライトを再描画 // updatelistはスプライトの番号順に並んでいる - g_slist_foreach(updatelist, do_update_each, &r); + slist_foreach(updatelist, do_update_each, &r); // このルーチンが呼ばれるときはスプライトはドラッグ中ではない @@ -163,7 +163,7 @@ int sp_update_clipped() { } // 更新領域に入っているスプライトの再描画 - g_slist_foreach(updatelist, do_update_each, &r); + slist_foreach(updatelist, do_update_each, &r); // 更新領域を Window に転送 ags_updateArea(r.x, r.y, r.width, r.height); @@ -181,13 +181,13 @@ int sp_updateme(sprite_t *sp) { if (sp == NULL) return NG; if (sp->cursize.width == 0 || sp->cursize.height == 0) return NG; - r = g_new(MyRectangle, 1); + r = malloc(sizeof(MyRectangle)); r->x = sp->cur.x; r->y = sp->cur.y; r->width = sp->cursize.width; r->height = sp->cursize.height; - updatearea = g_slist_append(updatearea, r); + updatearea = slist_append(updatearea, r); WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n", r->x, r->y, sp->no, r->width, r->height); @@ -209,13 +209,13 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) { if (sp == NULL) return NG; if (w == 0 || h == 0) return NG; - r = g_new(MyRectangle, 1); + r = malloc(sizeof(MyRectangle)); r->x = sp->cur.x + x; r->y = sp->cur.y + y; r->width = w; r->height = h; - updatearea = g_slist_append(updatearea, r); + updatearea = slist_append(updatearea, r); WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n", r->x, r->y, sp->no, r->width, r->height); @@ -224,7 +224,7 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) { } // スプライトの番号順に更新するためにリストに順番に要れるためのcallbck -static gint compare_spriteno_smallfirst(gconstpointer a, gconstpointer b) { +static int compare_spriteno_smallfirst(const void *a, const void *b) { sprite_t *sp1 = (sprite_t *)a; sprite_t *sp2 = (sprite_t *)b; @@ -238,11 +238,11 @@ static gint compare_spriteno_smallfirst(gconstpointer a, gconstpointer b) { } void sp_add_updatelist(sprite_t *sp) { - updatelist = g_slist_insert_sorted(updatelist, sp, compare_spriteno_smallfirst); + updatelist = slist_insert_sorted(updatelist, sp, compare_spriteno_smallfirst); } void sp_remove_updatelist(sprite_t *sp) { - updatelist = g_slist_remove(updatelist, sp); + updatelist = slist_remove(updatelist, sp); } // デフォルトの壁紙update diff --git a/modules/NightDemonDemo/Makefile.am b/modules/NightDemonDemo/Makefile.am index 5fb114e..deced98 100644 --- a/modules/NightDemonDemo/Makefile.am +++ b/modules/NightDemonDemo/Makefile.am @@ -2,9 +2,9 @@ pkglib_LTLIBRARIES = NightDemonDemo.la NightDemonDemo_la_LDFLAGS = -module -export-dynamic -avoid-version NightDemonDemo_la_SOURCES = NightDemonDemo.c ndd.c jpeg2surface.c -NightDemonDemo_la_LIBADD = ../lib/libgraph.la ../lib/libalk.la @GLIB_LIBS@ @JPEG_LIBS@ +NightDemonDemo_la_LIBADD = ../lib/libgraph.la ../lib/libalk.la @JPEG_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ @JPEG_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ @JPEG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/NightDemonDemo/Makefile.in b/modules/NightDemonDemo/Makefile.in index 4c5d43b..59c9b93 100644 --- a/modules/NightDemonDemo/Makefile.in +++ b/modules/NightDemonDemo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -246,13 +245,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -411,8 +404,8 @@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = NightDemonDemo.la NightDemonDemo_la_LDFLAGS = -module -export-dynamic -avoid-version NightDemonDemo_la_SOURCES = NightDemonDemo.c ndd.c jpeg2surface.c -NightDemonDemo_la_LIBADD = ../lib/libgraph.la ../lib/libalk.la @GLIB_LIBS@ @JPEG_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ @JPEG_CFLAGS@ +NightDemonDemo_la_LIBADD = ../lib/libgraph.la ../lib/libalk.la @JPEG_LIBS@ +AM_CFLAGS = @DEBUG_CFLAGS@ @JPEG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/modules/lib -I$(top_srcdir)/modules/lib \ diff --git a/modules/NightDemonDemo/jpeg2surface.c b/modules/NightDemonDemo/jpeg2surface.c index 085bb28..2bcee28 100644 --- a/modules/NightDemonDemo/jpeg2surface.c +++ b/modules/NightDemonDemo/jpeg2surface.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include #include "portab.h" diff --git a/modules/NightDemonDemo/ndd.c b/modules/NightDemonDemo/ndd.c index 94cba20..dd74877 100644 --- a/modules/NightDemonDemo/ndd.c +++ b/modules/NightDemonDemo/ndd.c @@ -22,7 +22,6 @@ /* $Id: ndd.c,v 1.2 2003/11/09 15:06:12 chikama Exp $ */ #include -#include #include "portab.h" #include "ags.h" @@ -54,7 +53,7 @@ extern surface_t *jpeg2surface(FILE *fp, int offset); // ALKファイルの登録 void ndd_init(char *files[], int n) { int i; - ndd.fn = g_new(char *, n); + ndd.fn = malloc(sizeof(char *) * n); for (i = 1; i <= n; i++) { ndd.fn[i] = files[i]; diff --git a/modules/RandMT/Makefile.in b/modules/RandMT/Makefile.in index d4933f3..35ce0b7 100644 --- a/modules/RandMT/Makefile.in +++ b/modules/RandMT/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/SACT/Makefile.am b/modules/SACT/Makefile.am index ec8d294..fb08285 100644 --- a/modules/SACT/Makefile.am +++ b/modules/SACT/Makefile.am @@ -1,7 +1,7 @@ pkglib_LTLIBRARIES = SACT.la SACT_la_LDFLAGS = -module -export-dynamic -avoid-version -SACT_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la @GLIB_LIBS@ +SACT_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la SACT_la_SOURCES = \ SACT.c \ sactcg.c \ @@ -32,7 +32,7 @@ SACT_la_SOURCES = \ sprite_xmenu.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/SACT/Makefile.in b/modules/SACT/Makefile.in index 1a68d17..3606424 100644 --- a/modules/SACT/Makefile.in +++ b/modules/SACT/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -251,13 +250,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -415,7 +408,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = SACT.la SACT_la_LDFLAGS = -module -export-dynamic -avoid-version -SACT_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la @GLIB_LIBS@ +SACT_la_LIBADD = ../lib/libgraph.la ../lib/libdrawtext.la SACT_la_SOURCES = \ SACT.c \ sactcg.c \ @@ -445,7 +438,7 @@ SACT_la_SOURCES = \ screen_quake.c \ sprite_xmenu.c -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/SACT/SACT.c b/modules/SACT/SACT.c index 12dbe55..e8a1b6e 100644 --- a/modules/SACT/SACT.c +++ b/modules/SACT/SACT.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" diff --git a/modules/SACT/sact.h b/modules/SACT/sact.h index 2ca9beb..4d5b764 100644 --- a/modules/SACT/sact.h +++ b/modules/SACT/sact.h @@ -26,8 +26,8 @@ #include "config.h" -#include #include "portab.h" +#include "list.h" #include "graphics.h" #include "surface.h" #include "sacttimer.h" @@ -154,7 +154,7 @@ struct _sprite { boolean focused; // forcusを得ているか boolean pressed; // このsprite上でマウスが押されているか - GSList *expsp; // 説明スプライトのリスト + SList *expsp; // 説明スプライトのリスト // move command 用パラメータ struct { @@ -201,7 +201,7 @@ struct _sprite { // メッセージスプライト struct { - GSList *buf; // 表示する文字のリスト + SList *buf; // 表示する文字のリスト surface_t *canvas; // 文字を描画するsurface MyPoint dspcur; // 現在の表示位置 } msg; @@ -217,10 +217,10 @@ struct _sact { // スプライト全体 sprite_t *sp[SPRITEMAX]; - GSList *sp_zhide; // Zキーで消すスプライトのリスト - GSList *sp_quake; // Quakeで揺らすスプライトのリスト + SList *sp_zhide; // Zキーで消すスプライトのリスト + SList *sp_quake; // Quakeで揺らすスプライトのリスト - GSList *updatelist; // 再描画するスプライトのリスト + SList *updatelist; // 再描画するスプライトのリスト cginfo_t *cg[CGMAX]; // cgまたはCG_xxで作った CG @@ -228,8 +228,8 @@ struct _sact { MyPoint origin; // 文字列 push/pop/replce 用 - GSList *strstack; - GSList *strreplace; + SList *strstack; + SList *strreplace; char *strreplacesrc; char *strreplacedst; @@ -253,12 +253,12 @@ struct _sact { } sel; // event listener - GSList *eventlisteners; - GSList *teventlisteners; - GSList *teventremovelist; + SList *eventlisteners; + SList *teventlisteners; + SList *teventremovelist; // MOVEするスプライトのリスト - GSList *movelist; + SList *movelist; int movestarttime; // 一斉に移動を開始するための開始時間 int movecurtime; @@ -299,7 +299,7 @@ struct _sact { // バックログ boolean logging; - GList *log; + List *log; }; typedef struct _sact sact_t; diff --git a/modules/SACT/sactamask.c b/modules/SACT/sactamask.c index dae0bce..5a5794b 100644 --- a/modules/SACT/sactamask.c +++ b/modules/SACT/sactamask.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -88,8 +87,8 @@ int smask_init(char *path) { am->fd = fd; am->datanum = LittleEndian_getDW(adr, 0); - am->no = g_new(int, am->datanum); - am->offset = g_new(int, am->datanum); + am->no = malloc(sizeof(int) * am->datanum); + am->offset = malloc(sizeof(int) * am->datanum); for (i = 0; i < am->datanum; i++) { am->no[i] = LittleEndian_getDW(adr, 16 + i * 16); diff --git a/modules/SACT/sactbgm.c b/modules/SACT/sactbgm.c index 90844da..6b68222 100644 --- a/modules/SACT/sactbgm.c +++ b/modules/SACT/sactbgm.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" diff --git a/modules/SACT/sactcg.c b/modules/SACT/sactcg.c index a734bbe..8187059 100644 --- a/modules/SACT/sactcg.c +++ b/modules/SACT/sactcg.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "nact.h" @@ -76,14 +75,14 @@ cginfo_t *scg_loadcg_no(int no, boolean refinc) { return sact.cg[no]; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_LINKED; i->no = no; i->refcnt = (refinc ? 1 : 0); i->sf = sf_loadcg_no(no -1); if (i->sf == NULL) { WARNING("load fail (%d)\n", no -1); - g_free(i); + free(i); return NULL; } @@ -99,7 +98,7 @@ int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int spcg_assert_no(wNumCG); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 0; @@ -128,7 +127,7 @@ int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_REVERSE; i->no = wNumCG; i->refcnt = 0; @@ -156,7 +155,7 @@ int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) { return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_STRETCH; i->no = wNumCG; i->refcnt = 0; @@ -185,7 +184,7 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen blendcg = scg_loadcg_no(wNumBlendCG, FALSE); if (basecg == NULL || blendcg == NULL) return NG; - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -221,7 +220,7 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) { font->sel_font(FONT_GOTHIC, wSize); glyph = font->get_glyph(v_str(wText -1)); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 0; @@ -260,7 +259,7 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, font->sel_font(FONT_GOTHIC, wSize); glyph = font->get_glyph(s); - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumCG; i->refcnt = 0; @@ -288,7 +287,7 @@ int scg_copy(int wNumDstCG, int wNumSrcCG) { return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -315,7 +314,7 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -356,7 +355,7 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w return NG; } - i = g_new(cginfo_t, 1); + i = malloc(sizeof(cginfo_t)); i->type = CG_SET; i->no = wNumDstCG; i->refcnt = 0; @@ -441,7 +440,7 @@ int scg_free_cgobj(cginfo_t *cg) { sact.cg[cg->no] = NULL; } - g_free(cg); + free(cg); return OK; } diff --git a/modules/SACT/sactcg_stretch.c b/modules/SACT/sactcg_stretch.c index b6c5c2d..9c280a1 100644 --- a/modules/SACT/sactcg_stretch.c +++ b/modules/SACT/sactcg_stretch.c @@ -1,6 +1,6 @@ // 拡大縮小 static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { - surface_t *dst = g_new0(surface_t, 1); + surface_t *dst = calloc(1, sizeof(surface_t)); float a1, a2, xd, yd; int sw, sh; int *row, *col; @@ -16,10 +16,10 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { dst->has_alpha = src->has_alpha; if (src->has_pixel) { - dst->pixel = g_malloc(dh * dst->bytes_per_line); + dst->pixel = malloc(dh * dst->bytes_per_line); } if (src->has_alpha) { - dst->alpha = g_malloc(dw * dh); + dst->alpha = malloc(dw * dh); } @@ -30,10 +30,10 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { a1 = (float)sw / (float)dw; a2 = (float)sh / (float)dh; - row = g_new(int, dw); + row = malloc(sizeof(int) * dw); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh +1); + col = calloc(dh +1, sizeof(int)); if (mirror & 1) { /* 上下反転 added by tajiri@wizard */ @@ -110,8 +110,8 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { } } - g_free(row); - g_free(col); + free(row); + free(col); return dst; } diff --git a/modules/SACT/sactcrypto.c b/modules/SACT/sactcrypto.c index ec1a9fd..eabc1ad 100644 --- a/modules/SACT/sactcrypto.c +++ b/modules/SACT/sactcrypto.c @@ -22,7 +22,6 @@ /* $Id: sactcrypto.c,v 1.1 2003/04/22 16:29:52 chikama Exp $ */ #include -#include #include "portab.h" #include "system.h" #include "variable.h" diff --git a/modules/SACT/sactlog.c b/modules/SACT/sactlog.c index 149e954..5628176 100644 --- a/modules/SACT/sactlog.c +++ b/modules/SACT/sactlog.c @@ -26,10 +26,10 @@ #include #include #include -#include #include "portab.h" #include "system.h" +#include "list.h" #include "counter.h" #include "menu.h" #include "imput.h" @@ -59,19 +59,19 @@ static void draw_log() { int i, y = 0, len; int cur = curline; char pinfo[256]; - GList *node; + List *node; // canvas clear memset(chr->pixel, 0, chr->bytes_per_line * chr->height); // ページ位置情報 - len = g_snprintf(pinfo, sizeof(pinfo) -1, "%d/%d", curline, g_list_length(sact.log)); + len = snprintf(pinfo, sizeof(pinfo) -1, "%d/%d", curline, list_length(sact.log)); dt_setfont(FONT_GOTHIC, FONTSIZEINDEX); dt_drawtext(chr, sf0->width - FONTSIZEINDEX *len /2, 0, pinfo); // 表示始め位置 - node = g_list_nth(sact.log, g_list_length(sact.log) - curline); + node = list_nth(sact.log, list_length(sact.log) - curline); for (i = 0; i < LOGLINENUM; i++) { char *str, *streuc; if (cur <= 0) continue; @@ -91,7 +91,7 @@ static void draw_log() { } y += FONTSIZE; cur--; - node = g_list_next(node); + node = list_next(node); } gr_copy_bright(sf0, 0, 0, back, 0, 0, sf0->width, sf0->height, 128); @@ -104,12 +104,12 @@ static void draw_log() { int sblog_start(void) { // 説明文章を追加 - sact.log = g_list_append(sact.log, "\n"); - sact.log = g_list_append(sact.log, LOGMSG1); - sact.log = g_list_append(sact.log, LOGMSG2); - sact.log = g_list_append(sact.log, LOGMSG3); - sact.log = g_list_append(sact.log, LOGMSG4); - sact.log = g_list_append(sact.log, "\n"); + sact.log = list_append(sact.log, "\n"); + sact.log = list_append(sact.log, LOGMSG1); + sact.log = list_append(sact.log, LOGMSG2); + sact.log = list_append(sact.log, LOGMSG3); + sact.log = list_append(sact.log, LOGMSG4); + sact.log = list_append(sact.log, "\n"); back = sf_dup(sf0); chr = sf_create_surface(sf0->width, sf0->height, 8); @@ -119,7 +119,7 @@ int sblog_start(void) { } int sblog_end(void) { - GList *node; + List *node; int i; sf_copyall(sf0, back); @@ -130,33 +130,33 @@ int sblog_end(void) { // 説明文章を削除 for (i = 0; i < 6; i++) { - node = g_list_last(sact.log); - sact.log = g_list_remove(sact.log, node->data); + node = list_last(sact.log); + sact.log = list_remove(sact.log, node->data); } return OK; } int sblog_pageup(void) { - curline = MIN(g_list_length(sact.log), curline + (LOGLINENUM -1)); + curline = min(list_length(sact.log), curline + (LOGLINENUM -1)); draw_log(); return OK; } int sblog_pagedown(void) { - curline = MAX(1, curline - (LOGLINENUM -1)); + curline = max(1, curline - (LOGLINENUM -1)); draw_log(); return OK; } int sblog_pagepre(void) { - curline = MAX(1, curline - 1); + curline = max(1, curline - 1); draw_log(); return OK; } int sblog_pagenext(void) { - curline = MIN(g_list_length(sact.log), curline + 1); + curline = min(list_length(sact.log), curline + 1); draw_log(); return OK; } diff --git a/modules/SACT/sactsound.c b/modules/SACT/sactsound.c index c718ec4..6f4f759 100644 --- a/modules/SACT/sactsound.c +++ b/modules/SACT/sactsound.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" diff --git a/modules/SACT/sactstring.c b/modules/SACT/sactstring.c index f08b829..9d7ade5 100644 --- a/modules/SACT/sactstring.c +++ b/modules/SACT/sactstring.c @@ -23,10 +23,11 @@ #include "config.h" #include -#include +#include #include #include "portab.h" #include "system.h" +#include "list.h" #include "variable.h" #include "sact.h" @@ -39,7 +40,7 @@ static int idxmax; // stack pointerの最大 * 文字列変数スタックの初期化 */ int sstr_init() { - stack = g_new(char *, DEFSTACKSIZE); + stack = malloc(sizeof(char *) * DEFSTACKSIZE); idx = 0; idxmax = DEFSTACKSIZE; return OK; @@ -51,11 +52,11 @@ int sstr_init() { */ int sstr_push(int strno) { if (idx >= idxmax) { - stack = g_renew(char *, stack, idx*2); + stack = realloc(stack, sizeof(char *) * idx*2); idxmax = idx*2; } - stack[idx++] = g_strdup(v_str(strno -1)); + stack[idx++] = strdup(v_str(strno -1)); return OK; } @@ -68,7 +69,7 @@ int sstr_pop(int strno) { if (idx == 0) return NG; v_strcpy(strno -1, stack[--idx]); - g_free(stack[idx]); + free(stack[idx]); return OK; } @@ -83,10 +84,10 @@ int sstr_regist_replace(int sstrno, int dstrno) { if (sstrno == dstrno) return NG; - ex = g_new(strexchange_t, 1); + ex = malloc(sizeof(strexchange_t)); ex->src = strdup(v_str(sstrno -1)); ex->dst = strdup(v_str(dstrno -1)); - sact.strreplace = g_slist_append(sact.strreplace, ex); + sact.strreplace = slist_append(sact.strreplace, ex); return OK; } diff --git a/modules/SACT/screen_quake.c b/modules/SACT/screen_quake.c index c8a5aea..3fce4f5 100644 --- a/modules/SACT/screen_quake.c +++ b/modules/SACT/screen_quake.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" diff --git a/modules/SACT/sprite.c b/modules/SACT/sprite.c index 75fbe8d..1d0384f 100644 --- a/modules/SACT/sprite.c +++ b/modules/SACT/sprite.c @@ -25,10 +25,10 @@ #include #include -#include #include "portab.h" #include "system.h" +#include "list.h" #include "ngraph.h" #include "ags.h" #include "nact.h" @@ -38,26 +38,26 @@ #include "sactcg.h" #include "sactsound.h" -static gint compare_spriteno_smallfirst(gconstpointer a, gconstpointer b); +static int compare_spriteno_smallfirst(const void *a, const void *b); -#define sp_assert_no(no) G_STMT_START{ \ +#define sp_assert_no(no) do { \ if ((no) >= SPRITEMAX) { \ WARNING("no is too large (should be %d < %d)\n", no, SPRITEMAX); \ return NG; \ } \ -}G_STMT_END +} while (0) -#define sp_assert_null(no) G_STMT_START{ \ +#define sp_assert_null(no) do { \ if (sact.sp[no] == NULL) { \ WARNING("sprite %d is NULL\n", no); \ return NG; \ } \ -}G_STMT_END +} while (0) // スプライトの番号順に更新するためにリストに順番に要れるためのcallbck -static gint compare_spriteno_smallfirst(gconstpointer a, gconstpointer b) { +static int compare_spriteno_smallfirst(const void *a, const void *b) { sprite_t *sp1 = (sprite_t *)a; sprite_t *sp2 = (sprite_t *)b; @@ -105,7 +105,7 @@ int sp_init() { // いろいろな理由から全てのスプライトをあらかじめ作成しておく for (i = 0; i < SPRITEMAX; i++) { - sact.sp[i] = g_new0(sprite_t, 1); + sact.sp[i] = calloc(1, sizeof(sprite_t)); sact.sp[i]->no = i; sact.sp[i]->type = SPRITE_NONE; sact.sp[i]->show = FALSE; @@ -115,7 +115,7 @@ int sp_init() { sp_set_wall_paper(0); // 壁紙を updateリストに追加 - sact.updatelist = g_slist_append(sact.updatelist, sact.sp[0]); + sact.updatelist = slist_append(sact.updatelist, sact.sp[0]); return OK; } @@ -140,7 +140,7 @@ int sp_new(int no, int cg1, int cg2, int cg3, int type) { } // 更新リストに登録 - sact.updatelist = g_slist_insert_sorted(sact.updatelist, sp, compare_spriteno_smallfirst); + sact.updatelist = slist_insert_sorted(sact.updatelist, sp, compare_spriteno_smallfirst); sp->type = type; sp->no = no; @@ -207,7 +207,7 @@ int sp_new_msg(int no, int x, int y, int width, int height) { sp_free(no); } // 更新リストに登録 - sact.updatelist = g_slist_insert_sorted(sact.updatelist, sp, compare_spriteno_smallfirst); + sact.updatelist = slist_insert_sorted(sact.updatelist, sp, compare_spriteno_smallfirst); sp->type = SPRITE_MSG; @@ -282,7 +282,7 @@ int sp_free(int no) { // 移動開始していない場合はリストから削除 if (!sp->move.moving) { - sact.movelist = g_slist_remove(sact.movelist, sp); + sact.movelist = slist_remove(sact.movelist, sp); } // CGオブジェクトの削除 @@ -297,14 +297,14 @@ int sp_free(int no) { // 説明スプライトの削除 // ここで消しちゃまずいかも - g_slist_free(sp->expsp); + slist_free(sp->expsp); sp->expsp = NULL; if (sp->type == SPRITE_MSG) { - g_slist_free(sp->u.msg.buf); + slist_free(sp->u.msg.buf); sf_free(sp->u.msg.canvas); } - sact.updatelist = g_slist_remove(sact.updatelist, sp); + sact.updatelist = slist_remove(sact.updatelist, sp); // SACT.Numeral_XXX は残しておく { @@ -371,7 +371,7 @@ int sp_set_move(int wNum, int wX, int wY) { // moveするスプライトリストに登録 // 実際に move を開始するのは ~SP_DRAW(sp_update_all)が呼ばれたとき - sact.movelist = g_slist_append(sact.movelist, sp); + sact.movelist = slist_append(sact.movelist, sp); return OK; } @@ -407,13 +407,13 @@ int sp_add_zkey_hidesprite(int wNum) { // シェルクレイルでまずいのがあったので中止 // if (sp->type == SPRITE_NONE) return NG; - sact.sp_zhide = g_slist_append(sact.sp_zhide, sp); + sact.sp_zhide = slist_append(sact.sp_zhide, sp); return OK; } // 上で登録したスプライトの削除 int sp_clear_zkey_hidesprite_all() { - g_slist_free(sact.sp_zhide); + slist_free(sact.sp_zhide); sact.sp_zhide = NULL; return OK; } @@ -452,13 +452,13 @@ int sp_thaw_sprite(int wNum) { int sp_add_quakesprite(int wNum) { sp_assert_no(wNum); - sact.sp_quake = g_slist_append(sact.sp_quake, sact.sp[wNum]); + sact.sp_quake = slist_append(sact.sp_quake, sact.sp[wNum]); return OK; } // 上で登録したスプライトの削除 int sp_clear_quakesprite_all() { - g_slist_free(sact.sp_quake); + slist_free(sact.sp_quake); sact.sp_quake = NULL; return OK; } @@ -649,7 +649,7 @@ int sp_num_getspan(int nNum, int *vSpan) { // すべての説明スプライトの削除 int sp_exp_clear() { - GSList *node; + SList *node; for (node = sact.updatelist; node; node = node->next) { sprite_t *sp = (sprite_t *)node->data; @@ -669,7 +669,7 @@ int sp_exp_add(int nNumSP1, int nNumSP2) { swsp = sact.sp[nNumSP1]; expsp = sact.sp[nNumSP2]; - swsp->expsp = g_slist_append(swsp->expsp, expsp); + swsp->expsp = slist_append(swsp->expsp, expsp); return OK; } @@ -682,7 +682,7 @@ int sp_exp_del(int nNum) { sp = sact.sp[nNum]; - g_slist_free(sp->expsp); + slist_free(sp->expsp); sp->expsp = NULL; return OK; diff --git a/modules/SACT/sprite.h b/modules/SACT/sprite.h index cb764c2..38e6102 100644 --- a/modules/SACT/sprite.h +++ b/modules/SACT/sprite.h @@ -24,7 +24,6 @@ #ifndef __SPRITE_H__ #define __SPRITE_H__ -#include #include "sact.h" #define DEFAULT_UPDATE sp_draw @@ -80,7 +79,7 @@ extern int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h); // in sprite_draw.c extern int sp_draw(sprite_t *sf); extern int sp_draw2(sprite_t *sf, cginfo_t *cg); -extern void sp_draw_dmap(gpointer data, gpointer userdata); +extern void sp_draw_dmap(void* data, void* userdata); // in sprite_msg.c @@ -109,7 +108,7 @@ extern void spev_remove_teventlistener(sprite_t *sp); extern void spev_main(); // in sprite_move.c -extern void spev_move_setup(gpointer data, gpointer userdata); +extern void spev_move_setup(void* data, void* userdata); extern void spev_move_waitend(sprite_t *sp, int dx, int dy, int time); extern void spev_wait4moving_sp(); diff --git a/modules/SACT/sprite_anime.c b/modules/SACT/sprite_anime.c index 8fed6bb..d1b5c8c 100644 --- a/modules/SACT/sprite_anime.c +++ b/modules/SACT/sprite_anime.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" diff --git a/modules/SACT/sprite_draw.c b/modules/SACT/sprite_draw.c index 5fc116b..2d791ab 100644 --- a/modules/SACT/sprite_draw.c +++ b/modules/SACT/sprite_draw.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -146,7 +145,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) { /* スプライトキー待ち用のdepthmap を更新 */ -void sp_draw_dmap(gpointer data, gpointer userdata) { +void sp_draw_dmap(void* data, void* userdata) { sprite_t *sp = (sprite_t *)data; cginfo_t *cg; surface_t update; diff --git a/modules/SACT/sprite_eupdate.c b/modules/SACT/sprite_eupdate.c index bf2fa63..8f56f13 100644 --- a/modules/SACT/sprite_eupdate.c +++ b/modules/SACT/sprite_eupdate.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -152,7 +151,7 @@ static void ec7_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC7DELTA); i++) { + for (i = 0; i < min(t + 1, EC7DELTA); i++) { y = i + EC7DELTA * (t - i); if (y < 0 || y >= sfsrc->height) continue; gr_copy(sf0, 0, y, @@ -180,7 +179,7 @@ static void ec8_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC8DELTA); i++) { + for (i = 0; i < min(t + 1, EC8DELTA); i++) { x = i + EC8DELTA * (t - i); if (x < 0 || x >= sfsrc->width) continue; gr_copy(sf0, x, 0, @@ -199,7 +198,7 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) { int curstep, maxstep; int i, t, x, y; - maxstep = MAX(sfsrc->height / EC9DELTA + EC9DELTA, + maxstep = max(sfsrc->height / EC9DELTA + EC9DELTA, sfsrc->width / EC9DELTA + EC9DELTA); curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime); @@ -211,13 +210,13 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) { } t = ecp.oldstep; while(t < curstep) { - for (i = 0; i < MIN(t + 1, EC9DELTA); i++) { + for (i = 0; i < min(t + 1, EC9DELTA); i++) { y = i + EC9DELTA * (t - i); if (y < 0 || y >= sfsrc->height) continue; gr_copy(sf0, 0, y, sfdst, 0, y, sfsrc->width, 1); } - for (i = 0; i < MIN(t + 1, EC9DELTA); i++) { + for (i = 0; i < min(t + 1, EC9DELTA); i++) { x = i + EC9DELTA * (t - i); if (x < 0 || x >= sfsrc->width) continue; gr_copy(sf0, x, 0, @@ -243,8 +242,8 @@ static void ec12_cb(surface_t *src, surface_t *dst) { usleep(0); return; } - st_i = MAX(0, curstep - EC12DELTA + 1); - ed_i = MIN(src->height -1, curstep); + st_i = max(0, curstep - EC12DELTA + 1); + ed_i = min(src->height -1, curstep); l = ed_i - st_i + 1; for (j = st_i; j < ed_i; j++) { gre_Blend(sf0, 0, j, src, 0, j, dst, 0, j, src->width, 1, curstep - j); @@ -274,8 +273,8 @@ static void ec13_cb(surface_t *src, surface_t *dst) { usleep(0); return; } - st_i = MAX(0, curstep - EC13DELTA + 1); - ed_i = MIN(src->height -1, curstep); + st_i = max(0, curstep - EC13DELTA + 1); + ed_i = min(src->height -1, curstep); l = ed_i - st_i + 1; for (j = st_i; j < ed_i; j++) { gre_Blend(sf0, 0, dyy - j, src, 0, syy1-j, dst, 0, syy2-j, src->width, 1, curstep - j); diff --git a/modules/SACT/sprite_event.c b/modules/SACT/sprite_event.c index 4815082..d85544c 100644 --- a/modules/SACT/sprite_event.c +++ b/modules/SACT/sprite_event.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" @@ -76,8 +75,8 @@ */ -static void cb_focused_swsp(gpointer s, gpointer data); -static void cb_defocused_swsp(gpointer s, gpointer data); +static void cb_focused_swsp(void* s, void* data); +static void cb_defocused_swsp(void* s, void* data); static int cb_focused(sprite_t *sp); static int cb_defocused(sprite_t *sp); static void cb_waitkey_simple(agsevent_t *e); @@ -88,7 +87,7 @@ static void cb_waitkey_selection(agsevent_t *e); フォーカスを得たスプライトに説明スプライトが登録されていた場合の 説明スプライトの表示ON */ -static void cb_focused_swsp(gpointer s, gpointer data) { +static void cb_focused_swsp(void* s, void* data) { sprite_t *sp = (sprite_t *)s; int *update = (int *)data; boolean oldstate = sp->show; @@ -106,7 +105,7 @@ static void cb_focused_swsp(gpointer s, gpointer data) { フォーカスを得たスプライトに説明スプライトが登録されていた場合の 説明スプライトの表示OFF */ -static void cb_defocused_swsp(gpointer s, gpointer data) { +static void cb_defocused_swsp(void* s, void* data) { sprite_t *sp = (sprite_t *)s; int *update = (int *)data; boolean oldstate = sp->show; @@ -121,7 +120,7 @@ static void cb_defocused_swsp(gpointer s, gpointer data) { } // zkey hide off -static void cb_focused_zkey(gpointer s, gpointer data) { +static void cb_focused_zkey(void* s, void* data) { sprite_t *sp = (sprite_t *)s; int *update = (int *)data; boolean oldstate = sp->show; @@ -134,7 +133,7 @@ static void cb_focused_zkey(gpointer s, gpointer data) { } // zkey hide on -static void cb_defocused_zkey(gpointer s, gpointer data) { +static void cb_defocused_zkey(void* s, void* data) { sprite_t *sp = (sprite_t *)s; int *update = (int *)data; boolean oldstate = sp->show; @@ -215,7 +214,7 @@ static void cb_waitkey_simple(agsevent_t *e) { if (e->d3 == KEY_Z) { cur = get_high_counter(SYSTEMCOUNTER_MSEC); if (!sact.zhiding) { - g_slist_foreach(sact.sp_zhide, cb_defocused_zkey, &update); + slist_foreach(sact.sp_zhide, cb_defocused_zkey, &update); sact.zhiding = TRUE; sact.zdooff = TRUE; sact.zofftime = cur; @@ -236,7 +235,7 @@ static void cb_waitkey_simple(agsevent_t *e) { break; } if (sact.zhiding) { - g_slist_foreach(sact.sp_zhide, cb_focused_zkey, &update); + slist_foreach(sact.sp_zhide, cb_focused_zkey, &update); sact.zhiding = FALSE; } // fall through @@ -246,7 +245,7 @@ static void cb_waitkey_simple(agsevent_t *e) { case KEY_Z: cur = get_high_counter(SYSTEMCOUNTER_MSEC); if (500 < (cur - sact.zofftime) || !sact.zdooff) { - g_slist_foreach(sact.sp_zhide, cb_focused_zkey, &update); + slist_foreach(sact.sp_zhide, cb_focused_zkey, &update); sact.zhiding = FALSE; } break; @@ -272,7 +271,7 @@ static void cb_waitkey_simple(agsevent_t *e) { WaitKeySpriteのcallback */ static void cb_waitkey_sprite(agsevent_t *e) { - GSList *node; + SList *node; sprite_t *focused_sp = NULL; // focus を得ている sprite sprite_t *defocused_sp = NULL; // focus を失った sprite int update = 0; @@ -347,7 +346,7 @@ static void cb_waitkey_sprite(agsevent_t *e) { if (defocused_sp) { sprite_t *sp = defocused_sp; if (sp->expsp) { - g_slist_foreach(sp->expsp, cb_defocused_swsp, &update); + slist_foreach(sp->expsp, cb_defocused_swsp, &update); } } @@ -355,7 +354,7 @@ static void cb_waitkey_sprite(agsevent_t *e) { if (focused_sp) { sprite_t *sp = focused_sp; if (sp->expsp) { - g_slist_foreach(sp->expsp, cb_focused_swsp, &update); + slist_foreach(sp->expsp, cb_focused_swsp, &update); } } } @@ -475,13 +474,13 @@ void spev_callback(agsevent_t *e) { */ void spev_add_eventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *)) { sp->eventcb = cb; - sact.eventlisteners = g_slist_append(sact.eventlisteners, sp); + sact.eventlisteners = slist_append(sact.eventlisteners, sp); } /* 上で登録した callback の削除 */ void spev_remove_eventlistener(sprite_t *sp) { - sact.eventlisteners = g_slist_remove(sact.eventlisteners, sp); + sact.eventlisteners = slist_remove(sact.eventlisteners, sp); } diff --git a/modules/SACT/sprite_get.c b/modules/SACT/sprite_get.c index a556cd4..586a9af 100644 --- a/modules/SACT/sprite_get.c +++ b/modules/SACT/sprite_get.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "ags.h" @@ -32,7 +31,7 @@ #include "sprite.h" #include "sactsound.h" -static void cb_defocused_swsp(gpointer s, gpointer data); +static void cb_defocused_swsp(void* s, void* data); static int eventCB_GET(sprite_t *sp, agsevent_t *e); static void cb_remove(sprite_t *sp); @@ -40,7 +39,7 @@ static void cb_remove(sprite_t *sp); 説明スプライトの消去 dragが始まったら説明スプライトは消去する */ -static void cb_defocused_swsp(gpointer s, gpointer data) { +static void cb_defocused_swsp(void* s, void* data) { sprite_t *sp = (sprite_t *)s; int *update = (int *)data; boolean oldstate = sp->show; @@ -78,7 +77,7 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) { // 説明スプライトがある場合は、それを非表示にする if (sp->expsp) { - g_slist_foreach(sp->expsp, cb_defocused_swsp, &update); + slist_foreach(sp->expsp, cb_defocused_swsp, &update); } // SpriteSoundがあれば、それを鳴らす diff --git a/modules/SACT/sprite_keywait.c b/modules/SACT/sprite_keywait.c index 6018fae..88afc0a 100644 --- a/modules/SACT/sprite_keywait.c +++ b/modules/SACT/sprite_keywait.c @@ -24,10 +24,11 @@ #include "config.h" #include -#include +#include #include "portab.h" #include "system.h" +#include "list.h" #include "counter.h" #include "ags.h" #include "nact.h" @@ -122,7 +123,7 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout sp_update_all(TRUE); // depthmap を準備 - g_slist_foreach(sact.updatelist, sp_draw_dmap, NULL); + slist_foreach(sact.updatelist, sp_draw_dmap, NULL); sact.waittype = KEYWAIT_SPRITE; sact.waitkey = -1; @@ -146,7 +147,7 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout // 終了時間の計算 curtime = get_high_counter(SYSTEMCOUNTER_MSEC); - endtime = timeout < 0 ? G_MAXINT: (curtime + timeout * 10); + endtime = timeout < 0 ? INT_MAX : (curtime + timeout * 10); // スプライトキー待ちメイン while (!waitcond(endtime)) { diff --git a/modules/SACT/sprite_move.c b/modules/SACT/sprite_move.c index e38c081..070804d 100644 --- a/modules/SACT/sprite_move.c +++ b/modules/SACT/sprite_move.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -61,7 +60,7 @@ static void move_drain(sprite_t *sp) { sp_updateme(sp); // 後で、movelist から外してもらうための処理 - sact.teventremovelist = g_slist_append(sact.teventremovelist, sp); + sact.teventremovelist = slist_append(sact.teventremovelist, sp); sp->move.moving = FALSE; sp->move.time = 0; // 移動時間の初期化 @@ -111,7 +110,7 @@ static int move_cb(sprite_t *sp, agsevent_t *e) { @param data: sprite @param userdata: 未使用 */ -void spev_move_setup(gpointer data, gpointer userdata) { +void spev_move_setup(void* data, void* userdata) { sprite_t *sp = (sprite_t *)data; // 非表示のものは移動しない(いいのかな) @@ -157,10 +156,10 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) { sp->move.speed = time; sp->move.time = -1; - sact.movelist = g_slist_append(sact.movelist, sp); + sact.movelist = slist_append(sact.movelist, sp); sact.movestarttime = get_high_counter(SYSTEMCOUNTER_MSEC); - g_slist_foreach(sact.movelist, spev_move_setup, NULL); - g_slist_free(sact.movelist); + slist_foreach(sact.movelist, spev_move_setup, NULL); + slist_free(sact.movelist); sact.movelist = NULL; while (sp->move.moving) { @@ -172,7 +171,7 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) { 全ての移動中のスプライトが移動完了するのを待つ */ void spev_wait4moving_sp() { - GSList *node; + SList *node; // 移動中のスプライトは sact.updatelist にあるはずだから // そのなかのスプライトについて、移動中かどうかのフラグをチェック diff --git a/modules/SACT/sprite_msg.c b/modules/SACT/sprite_msg.c index f09ddd9..057400c 100644 --- a/modules/SACT/sprite_msg.c +++ b/modules/SACT/sprite_msg.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -49,7 +48,7 @@ struct markinfo { }; static boolean is_messagesprite(int wNum); -static void replacestr_cb(gpointer data, gpointer userdata); +static void replacestr_cb(void* data, void* userdata); static char *replacestr(char *msg); static void update_mark(sprite_t *sp, cginfo_t *cg); static int setupmark(int wNum1, int wNum2, struct markinfo *minfo); @@ -81,7 +80,7 @@ static boolean is_messagesprite(int wNum) { } // 文字列の置き換え処理 -static void replacestr_cb(gpointer data, gpointer userdata) { +static void replacestr_cb(void* data, void* userdata) { strexchange_t *ex = (strexchange_t *)data; char *start, *next, *out; @@ -113,7 +112,7 @@ static char *replacestr(char *msg) { strncpy(repbuf[0], msg, REPLACEBUFSIZE); replacesrc = repbuf[0]; replacedst = repbuf[1]; - g_slist_foreach(sact.strreplace, replacestr_cb, NULL); + slist_foreach(sact.strreplace, replacestr_cb, NULL); return (repbuf[0][0] == '\0') ? repbuf[1] : repbuf[0]; } @@ -387,7 +386,7 @@ void smsg_clear(int wNum) { sp_updateme(sp); if (sact.logging) { - sact.log = g_list_append(sact.log, g_strdup("\n")); + sact.log = list_append(sact.log, strdup("\n")); } } @@ -553,7 +552,7 @@ static void append_to_log(char *msg) { static void sactlog_newline() { if (sact.logging) { if (sact.msgbuf2[0] == '\0') return; - sact.log = g_list_append(sact.log, g_strdup(sact.msgbuf2)); + sact.log = list_append(sact.log, strdup(sact.msgbuf2)); sact.msgbuf2[0] = '\0'; } } diff --git a/modules/SACT/sprite_put.c b/modules/SACT/sprite_put.c index 88e2a0d..bfc528e 100644 --- a/modules/SACT/sprite_put.c +++ b/modules/SACT/sprite_put.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "ags.h" diff --git a/modules/SACT/sprite_quake.c b/modules/SACT/sprite_quake.c index b7ed896..1a23429 100644 --- a/modules/SACT/sprite_quake.c +++ b/modules/SACT/sprite_quake.c @@ -24,10 +24,10 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" +#include "list.h" #include "imput.h" #include "sact.h" #include "surface.h" @@ -49,7 +49,7 @@ int sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, int cancel) { int edtime, curtime; int i = 0, key; - GSList *node; + SList *node; edtime = wCount * 10 + get_high_counter(SYSTEMCOUNTER_MSEC); diff --git a/modules/SACT/sprite_sel.c b/modules/SACT/sprite_sel.c index 9f46026..f36a13c 100644 --- a/modules/SACT/sprite_sel.c +++ b/modules/SACT/sprite_sel.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "nact.h" @@ -264,7 +263,7 @@ void ssel_clear() { int i; for (i = 0; i < SEL_ELEMENT_MAX; i++) { - g_free(sact.sel.elem[i]); + free(sact.sel.elem[i]); sact.sel.elem[i] = NULL; } } @@ -280,10 +279,10 @@ void ssel_add(int nString, int wI) { return; } if (sact.sel.elem[wI] != NULL) { - g_free(sact.sel.elem[wI]); + free(sact.sel.elem[wI]); } - sact.sel.elem[wI] = g_strdup(v_str(nString -1)); + sact.sel.elem[wI] = strdup(v_str(nString -1)); } /* diff --git a/modules/SACT/sprite_switch.c b/modules/SACT/sprite_switch.c index 6d9e4b8..4480086 100644 --- a/modules/SACT/sprite_switch.c +++ b/modules/SACT/sprite_switch.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "ags.h" diff --git a/modules/SACT/sprite_tevent.c b/modules/SACT/sprite_tevent.c index fe9148c..6bdf416 100644 --- a/modules/SACT/sprite_tevent.c +++ b/modules/SACT/sprite_tevent.c @@ -24,10 +24,10 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" +#include "list.h" #include "menu.h" #include "imput.h" #include "nact.h" @@ -59,7 +59,7 @@ static void tevent_callback(agsevent_t *e); タイマイベント callback メイン */ static void tevent_callback(agsevent_t *e) { - GSList *node; + SList *node; int update = 0; // SP_MOVE の同期移動のためのカウンタの読み込み @@ -86,9 +86,9 @@ static void tevent_callback(agsevent_t *e) { for (node = sact.teventremovelist; node; node = node->next) { sprite_t *sp = (sprite_t *)node->data; if (sp == NULL) continue; - sact.teventlisteners = g_slist_remove(sact.teventlisteners, sp); + sact.teventlisteners = slist_remove(sact.teventlisteners, sp); } - g_slist_free(sact.teventremovelist); + slist_free(sact.teventremovelist); sact.teventremovelist = NULL; } @@ -99,7 +99,7 @@ static void tevent_callback(agsevent_t *e) { */ void spev_add_teventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *)) { sp->teventcb = cb; - sact.teventlisteners = g_slist_append(sact.teventlisteners, sp); + sact.teventlisteners = slist_append(sact.teventlisteners, sp); } /* @@ -107,7 +107,7 @@ void spev_add_teventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *)) @param sp: 削除するスプライト */ void spev_remove_teventlistener(sprite_t *sp) { - sact.teventlisteners = g_slist_remove(sact.teventlisteners, sp); + sact.teventlisteners = slist_remove(sact.teventlisteners, sp); } /* diff --git a/modules/SACT/sprite_update.c b/modules/SACT/sprite_update.c index 371bf0c..5764e3f 100644 --- a/modules/SACT/sprite_update.c +++ b/modules/SACT/sprite_update.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" @@ -37,12 +36,12 @@ #include "sprite.h" // スプライト再描画間の間に変更のあったスプライトの領域の和 -static GSList *updatearea; +static SList *updatearea; static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst); -static void disjunction(gpointer region, gpointer data); +static void disjunction(void* region, void* data); static void get_updatearea(); -static void do_update_each(gpointer data, gpointer userdata); +static void do_update_each(void* data, void* userdata); // 領域1と領域2の積を計算 static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst) { @@ -58,7 +57,7 @@ static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst) { } // 領域1と領域2をすべて含む矩形領域を計算 -static void disjunction(gpointer region, gpointer data) { +static void disjunction(void* region, void* data) { MyRectangle *r1 = (MyRectangle *)region; MyRectangle *r2 = (MyRectangle *)data; int x1, x2, y1, y2; @@ -92,9 +91,9 @@ static void get_updatearea() { MyRectangle clip = {0, 0, 0, 0}; MyRectangle rsf0 = {0, 0, sf0->width, sf0->height}; - g_slist_foreach(updatearea, disjunction, &clip); + slist_foreach(updatearea, disjunction, &clip); - g_slist_free(updatearea); + slist_free(updatearea); updatearea = NULL; // surface0との領域の積をとる @@ -108,7 +107,7 @@ static void get_updatearea() { } // updatelist に登録してあるすべてのスプライトを更新 -static void do_update_each(gpointer data, gpointer userdata) { +static void do_update_each(void* data, void* userdata) { sprite_t *sp = (sprite_t *)data; // 非表示の場合はなにもしない @@ -132,8 +131,8 @@ int sp_update_all(boolean syncscreen) { if (sact.movelist) { // 移動開始時間を合わせる sact.movestarttime = get_high_counter(SYSTEMCOUNTER_MSEC); - g_slist_foreach(sact.movelist, spev_move_setup, NULL); - g_slist_free(sact.movelist); + slist_foreach(sact.movelist, spev_move_setup, NULL); + slist_free(sact.movelist); sact.movelist = NULL; } @@ -145,7 +144,7 @@ int sp_update_all(boolean syncscreen) { // updatelistに登録してあるスプライトを再描画 // updatelistはスプライトの番号順に並んでいる - g_slist_foreach(sact.updatelist, do_update_each, NULL); + slist_foreach(sact.updatelist, do_update_each, NULL); // このルーチンが呼ばれるときはスプライトはドラッグ中ではない @@ -175,7 +174,7 @@ int sp_update_clipped() { } // 更新領域に入っているスプライトの再描画 - g_slist_foreach(sact.updatelist, do_update_each, NULL); + slist_foreach(sact.updatelist, do_update_each, NULL); // drag中のスプライトを最後に描画 if (sact.draggedsp) { @@ -198,13 +197,13 @@ int sp_updateme(sprite_t *sp) { if (sp == NULL) return NG; if (sp->cursize.width == 0 || sp->cursize.height == 0) return NG; - r = g_new(MyRectangle, 1); + r = malloc(sizeof(MyRectangle)); r->x = sp->cur.x; r->y = sp->cur.y; r->width = sp->cursize.width; r->height = sp->cursize.height; - updatearea = g_slist_append(updatearea, r); + updatearea = slist_append(updatearea, r); WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n", r->x, r->y, sp->no, r->width, r->height); @@ -226,13 +225,13 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) { if (sp == NULL) return NG; if (w == 0 || h == 0) return NG; - r = g_new(MyRectangle, 1); + r = malloc(sizeof(MyRectangle)); r->x = sp->cur.x + x; r->y = sp->cur.y + y; r->width = w; r->height = h; - updatearea = g_slist_append(updatearea, r); + updatearea = slist_append(updatearea, r); WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n", r->x, r->y, sp->no, r->width, r->height); diff --git a/modules/SACT/sprite_xmenu.c b/modules/SACT/sprite_xmenu.c index 676fdd0..66388e0 100644 --- a/modules/SACT/sprite_xmenu.c +++ b/modules/SACT/sprite_xmenu.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include #include diff --git a/modules/ShArray/Makefile.in b/modules/ShArray/Makefile.in index 7a9629c..05eb7ce 100644 --- a/modules/ShArray/Makefile.in +++ b/modules/ShArray/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/ShCalc/Makefile.am b/modules/ShCalc/Makefile.am index b973576..19bcbbe 100644 --- a/modules/ShCalc/Makefile.am +++ b/modules/ShCalc/Makefile.am @@ -2,9 +2,8 @@ pkglib_LTLIBRARIES = ShCalc.la ShCalc_la_LDFLAGS = -module -export-dynamic -avoid-version ShCalc_la_SOURCES = ShCalc.c -ShCalc_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/ShCalc/Makefile.in b/modules/ShCalc/Makefile.in index 9d709bd..c9c133e 100644 --- a/modules/ShCalc/Makefile.in +++ b/modules/ShCalc/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -135,7 +134,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) -ShCalc_la_DEPENDENCIES = +ShCalc_la_LIBADD = am_ShCalc_la_OBJECTS = ShCalc.lo ShCalc_la_OBJECTS = $(am_ShCalc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -409,8 +402,7 @@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = ShCalc.la ShCalc_la_LDFLAGS = -module -export-dynamic -avoid-version ShCalc_la_SOURCES = ShCalc.c -ShCalc_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/ShCalc/ShCalc.c b/modules/ShCalc/ShCalc.c index 0e77b34..d29d44e 100644 --- a/modules/ShCalc/ShCalc.c +++ b/modules/ShCalc/ShCalc.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include "portab.h" #include "nact.h" @@ -37,15 +37,15 @@ #include "randMT.h" static int numbase; -static gint64 l_1000A0C8; -static gint64 l_1000A0D0; -static gint64 l_1000A0D8; +static int64_t l_1000A0C8; +static int64_t l_1000A0D0; +static int64_t l_1000A0D8; -static gint64 mul64(gint64 a1, gint64 a2) { +static int64_t mul64(int64_t a1, int64_t a2) { return a1 * a2; } -static gint64 div64(gint64 a1, gint64 a2) { +static int64_t div64(int64_t a1, int64_t a2) { if (a1 == 0 || a2 == 0) return 0; return a1 / a2; @@ -91,7 +91,7 @@ void GetIntNum16(void) { /* 3 */ var: 数値をいれる変数 */ int *var = getCaliVariable(); - gint64 i; + int64_t i; i = div64(l_1000A0D8, numbase); @@ -167,7 +167,7 @@ void DivIntNum16(void) { /* 11 */ var: 足す数の入った変数 */ int *var = getCaliVariable(); - gint64 i; + int64_t i; l_1000A0C8 = *var; diff --git a/modules/ShGraph/Makefile.in b/modules/ShGraph/Makefile.in index afe84f3..4f1c506 100644 --- a/modules/ShGraph/Makefile.in +++ b/modules/ShGraph/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/ShPort/Makefile.am b/modules/ShPort/Makefile.am index cfead00..3ca135c 100644 --- a/modules/ShPort/Makefile.am +++ b/modules/ShPort/Makefile.am @@ -2,9 +2,8 @@ pkglib_LTLIBRARIES = ShPort.la ShPort_la_LDFLAGS = -module -export-dynamic -avoid-version ShPort_la_SOURCES = ShPort.c -ShPort_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/ShPort/Makefile.in b/modules/ShPort/Makefile.in index 7e95481..7a82614 100644 --- a/modules/ShPort/Makefile.in +++ b/modules/ShPort/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -135,7 +134,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) -ShPort_la_DEPENDENCIES = +ShPort_la_LIBADD = am_ShPort_la_OBJECTS = ShPort.lo ShPort_la_OBJECTS = $(am_ShPort_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -409,8 +402,7 @@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = ShPort.la ShPort_la_LDFLAGS = -module -export-dynamic -avoid-version ShPort_la_SOURCES = ShPort.c -ShPort_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/ShPort/ShPort.c b/modules/ShPort/ShPort.c index ebd1027..c4fd330 100644 --- a/modules/ShPort/ShPort.c +++ b/modules/ShPort/ShPort.c @@ -28,7 +28,6 @@ #include #include -#include #include "portab.h" #include "nact.h" @@ -88,7 +87,7 @@ void InitKeyStatus(void) { } if (keymap[no -1] == NULL) { - keymap[no -1] = g_new0(BYTE, 256); + keymap[no -1] = calloc(256, sizeof(BYTE)); } else { memset(keymap[no -1], 0, 256); } diff --git a/modules/ShSound/Makefile.am b/modules/ShSound/Makefile.am index e3d1321..78bf6df 100644 --- a/modules/ShSound/Makefile.am +++ b/modules/ShSound/Makefile.am @@ -2,10 +2,9 @@ pkglib_LTLIBRARIES = ShSound.la ShSound_la_LDFLAGS = -module -export-dynamic -avoid-version ShSound_la_SOURCES = ShSound.c -ShSound_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/ShSound/Makefile.in b/modules/ShSound/Makefile.in index 4ddfeea..3cb3538 100644 --- a/modules/ShSound/Makefile.in +++ b/modules/ShSound/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -135,7 +134,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) -ShSound_la_DEPENDENCIES = +ShSound_la_LIBADD = am_ShSound_la_OBJECTS = ShSound.lo ShSound_la_OBJECTS = $(am_ShSound_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -409,8 +402,7 @@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = ShSound.la ShSound_la_LDFLAGS = -module -export-dynamic -avoid-version ShSound_la_SOURCES = ShSound.c -ShSound_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \ diff --git a/modules/ShSound/ShSound.c b/modules/ShSound/ShSound.c index 5186221..6852f89 100644 --- a/modules/ShSound/ShSound.c +++ b/modules/ShSound/ShSound.c @@ -26,7 +26,6 @@ #include #include -#include #include "portab.h" #include "xsystem35.h" diff --git a/modules/ShSound/shpcmlib.c b/modules/ShSound/shpcmlib.c index d1aba15..ad62e4e 100644 --- a/modules/ShSound/shpcmlib.c +++ b/modules/ShSound/shpcmlib.c @@ -21,7 +21,7 @@ */ /* $Id: shpcmlib.c,v 1.2 2003/08/02 13:10:32 chikama Exp $ */ #include -#include +#include #include "portab.h" #include "wavfile.h" @@ -73,7 +73,7 @@ void pcmlib_fade_volume_memory(WAVFILE *wfile, int start, int range) { if (wfile == NULL) return; - if (wfile->samples > (G_MAXINT / 100)) { + if (wfile->samples > (INT_MAX / 100)) { wavtime = (wfile->samples / wfile->rate) * 100; } else { wavtime = (wfile->samples * 100) / wfile->rate; @@ -119,7 +119,7 @@ WAVFILE *pcmlib_load_rw(int no) { wfile = wav_getinfo(dfile->data); if (wfile) { - void *p = g_malloc(wfile->bytes); + void *p = malloc(wfile->bytes); memcpy(p, wfile->data, wfile->bytes); wfile->data = (BYTE *)p; wfile->dfile = NULL; diff --git a/modules/ShString/Makefile.in b/modules/ShString/Makefile.in index eca467d..b625792 100644 --- a/modules/ShString/Makefile.in +++ b/modules/ShString/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/dDemo/Makefile.in b/modules/dDemo/Makefile.in index dc0904e..634f6ca 100644 --- a/modules/dDemo/Makefile.in +++ b/modules/dDemo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/eDemo/Makefile.in b/modules/eDemo/Makefile.in index c17e843..7200c9a 100644 --- a/modules/eDemo/Makefile.in +++ b/modules/eDemo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/eeDemo/Makefile.in b/modules/eeDemo/Makefile.in index 87a1198..7284906 100644 --- a/modules/eeDemo/Makefile.in +++ b/modules/eeDemo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/lib/Makefile.am b/modules/lib/Makefile.am index 7e7a382..20838a4 100644 --- a/modules/lib/Makefile.am +++ b/modules/lib/Makefile.am @@ -1,6 +1,5 @@ noinst_LTLIBRARIES = libgraph.la libalk.la libdrawtext.la -libgraph_la_LIBADD = @GLIB_LIBS@ libgraph_la_SOURCES = graph.c surface.c cg.c \ graph_expandcolor_blend.c \ graph_fillrect.c \ @@ -23,12 +22,10 @@ libgraph_la_SOURCES = graph.c surface.c cg.c \ gre_blend_screen.c libalk_la_SOURCES = alk.c -libalk_la_LIBADD = @GLIB_LIBS@ libdrawtext_la_SOURCES = drawtext.c -libdrawtext_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ diff --git a/modules/lib/Makefile.in b/modules/lib/Makefile.in index ccc538c..93d3161 100644 --- a/modules/lib/Makefile.in +++ b/modules/lib/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -107,17 +106,17 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libalk_la_DEPENDENCIES = +libalk_la_LIBADD = am_libalk_la_OBJECTS = alk.lo libalk_la_OBJECTS = $(am_libalk_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -libdrawtext_la_DEPENDENCIES = +libdrawtext_la_LIBADD = am_libdrawtext_la_OBJECTS = drawtext.lo libdrawtext_la_OBJECTS = $(am_libdrawtext_la_OBJECTS) -libgraph_la_DEPENDENCIES = +libgraph_la_LIBADD = am_libgraph_la_OBJECTS = graph.lo surface.lo cg.lo \ graph_expandcolor_blend.lo graph_fillrect.lo \ graph_fillrect_amap.lo graph_fillrect_acolor.lo graph_rect.lo \ @@ -229,13 +228,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -392,7 +385,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libgraph.la libalk.la libdrawtext.la -libgraph_la_LIBADD = @GLIB_LIBS@ libgraph_la_SOURCES = graph.c surface.c cg.c \ graph_expandcolor_blend.c \ graph_fillrect.c \ @@ -415,10 +407,8 @@ libgraph_la_SOURCES = graph.c surface.c cg.c \ gre_blend_screen.c libalk_la_SOURCES = alk.c -libalk_la_LIBADD = @GLIB_LIBS@ libdrawtext_la_SOURCES = drawtext.c -libdrawtext_la_LIBADD = @GLIB_LIBS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @DEBUG_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/src -I$(top_srcdir)/src \ $(LTDLINCL) \ diff --git a/modules/lib/alk.c b/modules/lib/alk.c index ec2d631..06e6484 100644 --- a/modules/lib/alk.c +++ b/modules/lib/alk.c @@ -26,13 +26,13 @@ #include #include +#include #include #include #include #include #include #include -#include #include "portab.h" #include "system.h" @@ -69,13 +69,13 @@ alk_t *alk_new(char *path) { return NULL; } - alk = g_new0(alk_t, 1); + alk = calloc(1, sizeof(alk_t)); alk->mapadr = adr; alk->size = sbuf.st_size; alk->fd = fd; alk->datanum = LittleEndian_getDW(adr, 4); - alk->offset = g_new(int, alk->datanum); + alk->offset = malloc(sizeof(int) * alk->datanum); for (i = 0; i < alk->datanum; i++) { alk->offset[i] = LittleEndian_getDW(adr, 8 + i * 8); @@ -89,8 +89,8 @@ int alk_free(alk_t *alk) { munmap(alk->mapadr, alk->size); close(alk->fd); - g_free(alk->offset); - g_free(alk); + free(alk->offset); + free(alk); return OK; } diff --git a/modules/lib/cg.c b/modules/lib/cg.c index 8999e92..61bcb03 100644 --- a/modules/lib/cg.c +++ b/modules/lib/cg.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include "portab.h" #include "system.h" @@ -115,10 +114,10 @@ surface_t *sf_getcg(void *b) { break; } - if (cg->pic) g_free(cg->pic); - if (cg->pal) g_free(cg->pal); - if (cg->alpha) g_free(cg->alpha); - g_free(cg); + if (cg->pic) free(cg->pic); + if (cg->pal) free(cg->pal); + if (cg->alpha) free(cg->alpha); + free(cg); return sf; } diff --git a/modules/lib/graph.c b/modules/lib/graph.c index 12beb6e..699c8c4 100644 --- a/modules/lib/graph.c +++ b/modules/lib/graph.c @@ -1,7 +1,6 @@ #include "config.h" #include -#include #include #include "portab.h" @@ -90,8 +89,8 @@ boolean gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds *sy -= *dy; *sh += *dy; *dy = 0; } - *sw = MIN(ss->width - *sx, MIN(ds->width - *dx, *sw)); - *sh = MIN(ss->height - *sy, MIN(ds->height - *dy, *sh)); + *sw = min(ss->width - *sx, min(ds->width - *dx, *sw)); + *sh = min(ss->height - *sy, min(ds->height - *dy, *sh)); if (*sw <= 0) { WARNING("sw become <=0\n"); @@ -152,8 +151,8 @@ boolean gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh) { *sh += *sy; *sy = 0; } - *sw = MIN(ss->width - *sx, *sw); - *sh = MIN(ss->height - *sy, *sh); + *sw = min(ss->width - *sx, *sw); + *sh = min(ss->height - *sy, *sh); if (*sw <= 0) { WARNING("sw become <=0\n"); @@ -258,10 +257,10 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int a1 = (float)sw / (float)dw; a2 = (float)sh / (float)dh; // src width と dst width が同じときに問題があるので+1 - row = g_new0(int, dw+1); + row = calloc(dw+1, sizeof(int)); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh+1); + col = calloc(dh+1, sizeof(int)); for (yd = 0.0, y = 0; y < dh; y++) { col[y] = yd; yd += a2; @@ -341,8 +340,8 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int } } - g_free(row); - g_free(col); + free(row); + free(col); } #include "graph2.c" diff --git a/modules/lib/graph_buller.c b/modules/lib/graph_buller.c index 645c94d..056b2be 100644 --- a/modules/lib/graph_buller.c +++ b/modules/lib/graph_buller.c @@ -1,6 +1,5 @@ #include #include -#include #include "portab.h" #include "surface.h" @@ -39,9 +38,9 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in r2 = PIXR15((*(yls-step))); g2 = PIXG15((*(yls-step))); b2 = PIXB15((*(yls-step))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *yld = PIX15(r3, g3, b3); yld++; yls++; @@ -72,9 +71,9 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in r2 = PIXR16((*(yls-step))); g2 = PIXG16((*(yls-step))); b2 = PIXB16((*(yls-step))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *yld = PIX16(r3, g3, b3); yld++; yls++; @@ -106,9 +105,9 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in r2 = PIXR24((*(yls-step))); g2 = PIXG24((*(yls-step))); b2 = PIXB24((*(yls-step))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *yld = PIX24(r3, g3, b3); yld++; yls++; @@ -156,9 +155,9 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, r2 = PIXR15((*(yls+(y-step)*src->width))); g2 = PIXG15((*(yls+(y-step)*src->width))); b2 = PIXB15((*(yls+(y-step)*src->width))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *(yld+y*dst->width) = PIX15(r3, g3, b3); } @@ -186,9 +185,9 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, r2 = PIXR16((*(yls+(y-step)*src->width))); g2 = PIXG16((*(yls+(y-step)*src->width))); b2 = PIXB16((*(yls+(y-step)*src->width))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *(yld+y*dst->width) = PIX16(r3, g3, b3); } @@ -217,9 +216,9 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, r2 = PIXR24((*(yls+(y-step)*src->width))); g2 = PIXG24((*(yls+(y-step)*src->width))); b2 = PIXB24((*(yls+(y-step)*src->width))); - r3 = MIN(255, (r1+r2) >> 1); - g3 = MIN(255, (g1+g2) >> 1); - b3 = MIN(255, (b1+b2) >> 1); + r3 = min(255, (r1+r2) >> 1); + g3 = min(255, (g1+g2) >> 1); + b3 = min(255, (b1+b2) >> 1); *(yld+y*dst->width) = PIX24(r3, g3, b3); } diff --git a/modules/lib/graph_saturadd_amap.c b/modules/lib/graph_saturadd_amap.c index 62ecdc6..f690f20 100644 --- a/modules/lib/graph_saturadd_amap.c +++ b/modules/lib/graph_saturadd_amap.c @@ -1,6 +1,5 @@ // alpha map の飽和加算 -#include #include "portab.h" #include "system.h" #include "surface.h" @@ -33,7 +32,7 @@ int gr_saturadd_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx BYTE *yld = dp + y * dst->width; for (x = 0; x < sw; x++) { int s = *yls, d = *yld; - *yld = (BYTE)(MIN(255, (s + d))); + *yld = (BYTE)(min(255, (s + d))); yls++; yld++; } } diff --git a/modules/lib/graph_stretch.c b/modules/lib/graph_stretch.c index 231ce83..e815029 100644 --- a/modules/lib/graph_stretch.c +++ b/modules/lib/graph_stretch.c @@ -1,7 +1,6 @@ // 拡大・縮小 #include -#include #include "portab.h" #include "surface.h" @@ -24,10 +23,10 @@ void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t * a2 = (float)sh / (float)dh; // src width と dst width が同じときに問題があるので+1 - row = g_new0(int, dw+1); + row = calloc(dw+1, sizeof(int)); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh+1); + col = calloc(dh+1, sizeof(int)); for (yd = 0.0, y = 0; y < dh; y++) { col[y] = yd; yd += a2; @@ -84,6 +83,6 @@ void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t * } } - g_free(row); - g_free(col); + free(row); + free(col); } diff --git a/modules/lib/gre_blend_screen.c b/modules/lib/gre_blend_screen.c index 549ebd7..7ca5fdc 100644 --- a/modules/lib/gre_blend_screen.c +++ b/modules/lib/gre_blend_screen.c @@ -1,6 +1,5 @@ // #include "config.h" -#include #include "portab.h" #include "surface.h" diff --git a/modules/lib/surface.c b/modules/lib/surface.c index acc794c..d9d2147 100644 --- a/modules/lib/surface.c +++ b/modules/lib/surface.c @@ -1,7 +1,7 @@ #include "config.h" #include -#include +#include #include #include "portab.h" @@ -9,7 +9,7 @@ #include "system.h" static surface_t *create(int width, int height, int depth, boolean has_pixel, boolean has_alpha) { - surface_t *s = g_new0(surface_t, 1); + surface_t *s = calloc(1, sizeof(surface_t)); s->width = width; s->height = height; @@ -23,19 +23,19 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo if (s->has_pixel) { switch (s->depth) { case 8: - s->pixel = g_new0(BYTE, width * (height +1)); + s->pixel = calloc(width * (height +1), sizeof(BYTE)); s->bytes_per_line = width; s->bytes_per_pixel = 1; break; case 15: case 16: - s->pixel = g_new0(BYTE, width * (height +1) * 2); + s->pixel = calloc(width * (height +1) * 2, sizeof(BYTE)); s->bytes_per_line = width * 2; s->bytes_per_pixel = 2; break; case 24: case 32: - s->pixel = g_new0(BYTE, width * (height +1) * 4); + s->pixel = calloc(width * (height +1) * 4, sizeof(BYTE)); s->bytes_per_line = width * 4; s->bytes_per_pixel = 4; break; @@ -47,7 +47,7 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo } if (s->has_alpha) { - s->alpha = g_new0(BYTE, width * (height +1)); + s->alpha = calloc(width * (height +1), sizeof(BYTE)); } return s; @@ -92,9 +92,9 @@ surface_t *sf_create_pixel(int width, int height, int depth) { */ void sf_free(surface_t *s) { if (s == NULL) return; - if (s->pixel) g_free(s->pixel); - if (s->alpha) g_free(s->alpha); - g_free(s); + if (s->pixel) free(s->pixel); + if (s->alpha) free(s->alpha); + free(s); } /** @@ -108,18 +108,18 @@ surface_t *sf_dup(surface_t *in) { if (in == NULL) return NULL; - sf = g_new(surface_t, 1); + sf = malloc(sizeof(surface_t)); memcpy(sf, in, sizeof(surface_t)); if (in->has_pixel) { len = sf->bytes_per_line * sf->height; - sf->pixel = g_new(BYTE, len + sf->bytes_per_line); + sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line)); memcpy(sf->pixel, in->pixel, len); } if (in->has_alpha) { len = sf->width * sf->height; - sf->alpha = g_new(BYTE, len + sf->width); + sf->alpha = malloc(sizeof(BYTE) * (len + sf->width)); memcpy(sf->alpha, in->alpha, len); } @@ -167,12 +167,12 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) { if (in == NULL) return NULL; - sf = g_new(surface_t, 1); + sf = malloc(sizeof(surface_t)); memcpy(sf, in, sizeof(surface_t)); if (in->has_pixel) { len = sf->bytes_per_line * sf->height; - sf->pixel = g_new(BYTE, len + sf->bytes_per_line); + sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line)); if (copypixel) { memcpy(sf->pixel, in->pixel, len); } @@ -180,7 +180,7 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) { if (in->has_alpha) { len = sf->width * sf->height; - sf->alpha = g_new(BYTE, len + sf->width); + sf->alpha = malloc(sizeof(BYTE) * (len + sf->width)); if (copyalpha) { memcpy(sf->alpha, in->alpha, len); } diff --git a/modules/nDEMO/Makefile.in b/modules/nDEMO/Makefile.in index 3a8f4ff..c841fbf 100644 --- a/modules/nDEMO/Makefile.in +++ b/modules/nDEMO/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/nDEMOE/Makefile.in b/modules/nDEMOE/Makefile.in index 2ceeb60..f56c37c 100644 --- a/modules/nDEMOE/Makefile.in +++ b/modules/nDEMOE/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/oDEMO/Makefile.in b/modules/oDEMO/Makefile.in index d69bb70..c513286 100644 --- a/modules/oDEMO/Makefile.in +++ b/modules/oDEMO/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/oujimisc/Makefile.in b/modules/oujimisc/Makefile.in index d7d51be..4f0601d 100644 --- a/modules/oujimisc/Makefile.in +++ b/modules/oujimisc/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/modules/tDemo/Makefile.in b/modules/tDemo/Makefile.in index ea142a7..c09ff0a 100644 --- a/modules/tDemo/Makefile.in +++ b/modules/tDemo/Makefile.in @@ -87,7 +87,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -244,13 +243,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ diff --git a/src/Makefile.am b/src/Makefile.am index 53e2f02..f0c9ba7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,13 +9,13 @@ AM_CPPFLAGS = $(LTDLINCL) xsystem35_LDFLAGS = @EXTRALDFLAGS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @X_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ @ESD_CFLAGS@ @SDL_CFLAGS@ @EXTRACFLAGS@ @VORBIS_CFLAGS@ -DMODULE_PATH=\"$(libdir)/@PACKAGE@\" -DLOCALEDIR=\""$(datadir)/locale"\" +AM_CFLAGS = @DEBUG_CFLAGS@ @X_CFLAGS@ @GTK_CFLAGS@ @ESD_CFLAGS@ @SDL_CFLAGS@ @EXTRACFLAGS@ @VORBIS_CFLAGS@ -DMODULE_PATH=\"$(libdir)/@PACKAGE@\" -DLOCALEDIR=\""$(datadir)/locale"\" SRC_SYS35CMD = cmdb.c cmdc.c cmdd.c cmde.c cmdf.c cmdg.c cmdh.c cmdi.c cmdj.c cmdk.c cmdl.c cmdm.c cmdn.c cmdo.c cmdp.c cmdq.c cmds.c cmdt.c cmdu.c cmdv.c cmdw.c cmdy.c cmdz.c cmd2F.c cmd2F60.c SRC_CG = pms.c vsp.c bmp.c qnt.c SRC_MUS = music.c music_client.c music_server.c music_cdrom.c music_midi.c music_pcm.c music_fader.c wavfile.c wavmix.c audio.c midi.c cdrom.c sndcnv.c musstream.c pcmlib.c music_bgm.c musstream_wav.c musstream_ogg.c musstream_wav_ima.c -SRC_MISC = LittleEndian.c counter.c imput.c profile.c mt19937-1.c @JOY_S@.c utfsjis.c filecheck.c tempname.c +SRC_MISC = LittleEndian.c counter.c imput.c profile.c mt19937-1.c @JOY_S@.c utfsjis.c filecheck.c tempname.c list.c SRC_SCO = cali.c scenario.c variable.c cmd_check.c hankana2sjis.c nact.c selection.c message.c savedata.c hankaku.c s39ain.c s39init.c SRC_GRAPH = ags.c font.c flood.c cg.c ecopy.c antialiase.c alpha_plane.c cursor.c @@ -48,7 +48,6 @@ xsystem35_DEPENDENCIES = \ xsystem35_LDADD = \ @ZLIB_LIBS@ \ @X_LIBS@ \ - @GLIB_LIBS@ \ @GTK_LIBS@ \ @ALSA_LIBS@ \ @ESD_LIBS@ \ diff --git a/src/Makefile.in b/src/Makefile.in index 274c1f1..2077a40 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -92,7 +92,6 @@ am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/alsa.m4 $(top_srcdir)/macros/argz.m4 \ $(top_srcdir)/macros/esd.m4 $(top_srcdir)/macros/freetype2.m4 \ $(top_srcdir)/macros/gettext.m4 \ - $(top_srcdir)/macros/glib-2.0.m4 \ $(top_srcdir)/macros/gtk-2.0.m4 $(top_srcdir)/macros/iconv.m4 \ $(top_srcdir)/macros/lib-ld.m4 \ $(top_srcdir)/macros/lib-link.m4 \ @@ -140,7 +139,7 @@ am__objects_5 = ags.$(OBJEXT) font.$(OBJEXT) flood.$(OBJEXT) \ am__objects_6 = LittleEndian.$(OBJEXT) counter.$(OBJEXT) \ imput.$(OBJEXT) profile.$(OBJEXT) mt19937-1.$(OBJEXT) \ @JOY_S@.$(OBJEXT) utfsjis.$(OBJEXT) filecheck.$(OBJEXT) \ - tempname.$(OBJEXT) + tempname.$(OBJEXT) list.$(OBJEXT) am__objects_7 = network.$(OBJEXT) am__objects_8 = am_xsystem35_OBJECTS = xsystem35.$(OBJEXT) dri.$(OBJEXT) \ @@ -256,13 +255,7 @@ FGREP = @FGREP@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -420,11 +413,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = $(LTDLINCL) xsystem35_LDFLAGS = @EXTRALDFLAGS@ -AM_CFLAGS = @DEBUG_CFLAGS@ @X_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ @ESD_CFLAGS@ @SDL_CFLAGS@ @EXTRACFLAGS@ @VORBIS_CFLAGS@ -DMODULE_PATH=\"$(libdir)/@PACKAGE@\" -DLOCALEDIR=\""$(datadir)/locale"\" +AM_CFLAGS = @DEBUG_CFLAGS@ @X_CFLAGS@ @GTK_CFLAGS@ @ESD_CFLAGS@ @SDL_CFLAGS@ @EXTRACFLAGS@ @VORBIS_CFLAGS@ -DMODULE_PATH=\"$(libdir)/@PACKAGE@\" -DLOCALEDIR=\""$(datadir)/locale"\" SRC_SYS35CMD = cmdb.c cmdc.c cmdd.c cmde.c cmdf.c cmdg.c cmdh.c cmdi.c cmdj.c cmdk.c cmdl.c cmdm.c cmdn.c cmdo.c cmdp.c cmdq.c cmds.c cmdt.c cmdu.c cmdv.c cmdw.c cmdy.c cmdz.c cmd2F.c cmd2F60.c SRC_CG = pms.c vsp.c bmp.c qnt.c SRC_MUS = music.c music_client.c music_server.c music_cdrom.c music_midi.c music_pcm.c music_fader.c wavfile.c wavmix.c audio.c midi.c cdrom.c sndcnv.c musstream.c pcmlib.c music_bgm.c musstream_wav.c musstream_ogg.c musstream_wav_ima.c -SRC_MISC = LittleEndian.c counter.c imput.c profile.c mt19937-1.c @JOY_S@.c utfsjis.c filecheck.c tempname.c +SRC_MISC = LittleEndian.c counter.c imput.c profile.c mt19937-1.c @JOY_S@.c utfsjis.c filecheck.c tempname.c list.c SRC_SCO = cali.c scenario.c variable.c cmd_check.c hankana2sjis.c nact.c selection.c message.c savedata.c hankaku.c s39ain.c s39init.c SRC_GRAPH = ags.c font.c flood.c cg.c ecopy.c antialiase.c alpha_plane.c cursor.c SRC_NET = network.c @@ -455,7 +448,6 @@ xsystem35_DEPENDENCIES = \ xsystem35_LDADD = \ @ZLIB_LIBS@ \ @X_LIBS@ \ - @GLIB_LIBS@ \ @GTK_LIBS@ \ @ALSA_LIBS@ \ @ESD_LIBS@ \ @@ -615,6 +607,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hankaku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hankana2sjis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mt19937-1.Po@am__quote@ diff --git a/src/ags.c b/src/ags.c index 3aef0d5..a9ac0ff 100644 --- a/src/ags.c +++ b/src/ags.c @@ -27,7 +27,6 @@ #include #include #include -#include #include "portab.h" #include "xsystem35.h" @@ -164,9 +163,9 @@ void ags_setWorldSize(int width, int height, int depth) { /* DIBが8以上の場合は、alpha plane を用意 */ if (depth > 8) { if (nact->ags.dib->alpha != NULL) { - g_free(nact->ags.dib->alpha); + free(nact->ags.dib->alpha); } - nact->ags.dib->alpha = g_new0(BYTE, width * height); + nact->ags.dib->alpha = calloc(width * height, sizeof(BYTE)); nact->ags.dib->has_alpha = TRUE; } diff --git a/src/ags.h b/src/ags.h index 4617d8e..707f37f 100644 --- a/src/ags.h +++ b/src/ags.h @@ -348,10 +348,10 @@ extern void ags_autorepeat(boolean bool); #define WHITELEVEL24(p, lv) ALPHABLEND24(0xffffffff, p, lv) -#define SUTURADD15(pa, pb) PIX15(MIN(255,PIXR15(pa)+PIXR15(pb)), MIN(255, PIXG15(pa)+PIXG15(pb)), MIN(255, PIXB15(pa)+PIXB15(pb))); -#define SUTURADD16(pa, pb) PIX16(MIN(255,PIXR16(pa)+PIXR16(pb)), MIN(255, PIXG16(pa)+PIXG16(pb)), MIN(255, PIXB16(pa)+PIXB16(pb))); -//#define SUTURADD16(pa, pb) PIX16(MIN(255,(int)(PIXR16(pa))+(int)(PIXR16(pb))), MIN(255, (int)(PIXG16(pa))+(int)(PIXG16(pb))), MIN(255, (int)(PIXB16(pa))+(int)(PIXB16(pb)))); -#define SUTURADD24(pa, pb) PIX24(MIN(255,PIXR24(pa)+PIXR24(pb)), MIN(255, PIXG24(pa)+PIXG24(pb)), MIN(255, PIXB24(pa)+PIXB24(pb))); +#define SUTURADD15(pa, pb) PIX15(min(255,PIXR15(pa)+PIXR15(pb)), min(255, PIXG15(pa)+PIXG15(pb)), min(255, PIXB15(pa)+PIXB15(pb))); +#define SUTURADD16(pa, pb) PIX16(min(255,PIXR16(pa)+PIXR16(pb)), min(255, PIXG16(pa)+PIXG16(pb)), min(255, PIXB16(pa)+PIXB16(pb))); +//#define SUTURADD16(pa, pb) PIX16(min(255,(int)(PIXR16(pa))+(int)(PIXR16(pb))), min(255, (int)(PIXG16(pa))+(int)(PIXG16(pb))), min(255, (int)(PIXB16(pa))+(int)(PIXB16(pb)))); +#define SUTURADD24(pa, pb) PIX24(min(255,PIXR24(pa)+PIXR24(pb)), min(255, PIXG24(pa)+PIXG24(pb)), min(255, PIXB24(pa)+PIXB24(pb))); /* exter methods */ diff --git a/src/ald_manager.c b/src/ald_manager.c index 89e7cfe..3ea4372 100644 --- a/src/ald_manager.c +++ b/src/ald_manager.c @@ -21,7 +21,7 @@ */ /* $Id: ald_manager.c,v 1.3 2001/05/08 05:36:07 chikama Exp $ */ -#include +#include #include "portab.h" #include "dri.h" #include "cache.h" @@ -43,8 +43,8 @@ static void ald_free(dridata *dfile); * dfile: dridata to be free */ static void ald_free(dridata *dfile) { - g_free(dfile->data_raw); - g_free(dfile); + free(dfile->data_raw); + free(dfile); } /* @@ -88,7 +88,7 @@ void ald_freedata(dridata *data) { if (data == NULL) return; if (data->a->mmapped) { - g_free(data); + free(data); } else { data->in_use = FALSE; } diff --git a/src/antialiase.c b/src/antialiase.c index e29608f..aa7e6e4 100644 --- a/src/antialiase.c +++ b/src/antialiase.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "portab.h" @@ -58,8 +58,8 @@ void aa_make(BYTE *data, int w, int h, int bytes_per_line) { BYTE *b, *_b, *__b; BYTE *d = data; - b = g_new0(BYTE, w*h); - _b = g_new0(BYTE, (w+2)*(h+2)); + b = calloc(w*h, sizeof(BYTE)); + _b = calloc((w+2)*(h+2), sizeof(BYTE)); __b = b; for (y = 0; y < h; y++) { @@ -75,6 +75,6 @@ void aa_make(BYTE *data, int w, int h, int bytes_per_line) { memcpy(d, __b, w+2); __b += (w+2); d+=bytes_per_line; } - g_free(b); - g_free(_b); + free(b); + free(_b); } diff --git a/src/audio_alsa.c b/src/audio_alsa.c index 76105d9..e476213 100644 --- a/src/audio_alsa.c +++ b/src/audio_alsa.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "system.h" @@ -186,8 +185,8 @@ static int alsa_exit(audiodevice_t *dev) { if (dev == NULL) return OK; mixer_exit(dev); - g_free(dev->data_pcm); - g_free(dev->data_mix); + free(dev->data_pcm); + free(dev->data_mix); return OK; } @@ -195,7 +194,7 @@ static int alsa_exit(audiodevice_t *dev) { int alsa_init(audiodevice_t *dev, char *devname, boolean automix) { audio_alsa_t *alsa; - alsa = g_new0(audio_alsa_t, 1); + alsa = calloc(1, sizeof(audio_alsa_t)); alsa->dev = devname; dev->data_pcm = alsa; diff --git a/src/audio_esd.c b/src/audio_esd.c index 53e8c49..3944014 100644 --- a/src/audio_esd.c +++ b/src/audio_esd.c @@ -29,7 +29,6 @@ #include #include #include -#include #include "system.h" #include "audio.h" @@ -162,8 +161,8 @@ int esd_exit(audiodevice_t *dev) { esd_close(esd->fdh); - g_free(dev->data_pcm); - g_free(dev->data_mix); + free(dev->data_pcm); + free(dev->data_mix); return OK; } @@ -175,7 +174,7 @@ int esd_init(audiodevice_t *dev, char *host) { return NG; } - esd = g_new0(audio_esd_t, 1); + esd = calloc(1, sizeof(audio_esd_t)); esd->fdh = fd; /* socket to host */ dev->data_pcm = esd; diff --git a/src/audio_oss.c b/src/audio_oss.c index 657fc32..d166514 100644 --- a/src/audio_oss.c +++ b/src/audio_oss.c @@ -45,7 +45,6 @@ #else # include #endif -#include #include "system.h" #include "audio.h" @@ -208,15 +207,15 @@ int oss_exit(audiodevice_t *dev) { mixer_exit(dev); - g_free(dev->data_pcm); - g_free(dev->data_mix); + free(dev->data_pcm); + free(dev->data_mix); return OK; } int oss_init(audiodevice_t *dev, char *devdsp, char *devmix) { audio_oss_t *oss; - oss = g_new0(audio_oss_t, 1); + oss = calloc(1, sizeof(audio_oss_t)); oss->fd = -1; oss->dev = devdsp; diff --git a/src/audio_sun.c b/src/audio_sun.c index ff31638..15eef5f 100644 --- a/src/audio_sun.c +++ b/src/audio_sun.c @@ -11,7 +11,6 @@ #include #include #include -#include #include "system.h" #include "audio.h" @@ -88,15 +87,15 @@ int sunaudio_exit(audiodevice_t *dev) { mixer_exit(dev); - g_free(dev->data_pcm); - g_free(dev->data_mix); + free(dev->data_pcm); + free(dev->data_mix); return OK; } int sunaudio_init(audiodevice_t *dev, char *devaudio, char *devaudioctl) { audio_sun_t *asun; - asun = g_new0(audio_sun_t, 1); + asun = calloc(1, sizeof(audio_sun_t)); asun->fd = -1; asun->dev = (devaudio == NULL ? "/dev/audio" : devaudio); diff --git a/src/bmp.c b/src/bmp.c index 0add64c..fbc044c 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -25,7 +25,7 @@ */ /* $Id: bmp.c,v 1.3 2000/11/25 13:08:59 chikama Exp $ */ -#include +#include #include "portab.h" #include "LittleEndian.h" #include "graphics.h" @@ -46,7 +46,7 @@ static void extract_24bit(bmp_header *bmp, WORD *pic, BYTE *b); * return: acquired bmp information object */ static bmp_header *extract_header(BYTE *b) { - bmp_header *bmp = g_new(bmp_header, 1); + bmp_header *bmp = malloc(sizeof(bmp_header)); bmp->bmpSize = LittleEndian_getDW(b, 2); /*data[4]-data[7]reserv*/ @@ -166,13 +166,13 @@ boolean bmp256_checkfmt(BYTE *data) { */ cgdata *bmp256_extract(BYTE *data) { bmp_header *bmp = extract_header(data); - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + bmp->bmpPp); /* +10: margin for broken cg */ - cg->pic = g_new(BYTE, (bmp->bmpXW + 10) * (bmp->bmpYW + 10)); + cg->pic = malloc(sizeof(BYTE) * ((bmp->bmpXW + 10) * (bmp->bmpYW + 10))); extract_8bit(bmp, cg->pic, data + bmp->bmpDp); cg->type = ALCG_BMP8; @@ -182,7 +182,7 @@ cgdata *bmp256_extract(BYTE *data) { cg->height = bmp->bmpYW; cg->alpha = NULL; - g_free(bmp); + free(bmp); return cg; } @@ -213,11 +213,11 @@ boolean bmp16m_checkfmt(BYTE *data) { * return: extracted image data and information */ cgdata *bmp16m_extract(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); bmp_header *bmp = extract_header(data); /* +10: margin for broken cg */ - cg->pic = (BYTE *)g_new(WORD, (bmp->bmpXW + 10) * (bmp->bmpYW + 10)); + cg->pic = (BYTE *)malloc(sizeof(WORD) * (bmp->bmpXW + 10) * (bmp->bmpYW + 10)); extract_24bit(bmp, (WORD *)cg->pic, data + bmp->bmpDp); cg->type = ALCG_BMP24; @@ -228,7 +228,7 @@ cgdata *bmp16m_extract(BYTE *data) { cg->alpha = NULL; cg->pal = NULL; - g_free(bmp); + free(bmp); return cg; } @@ -239,17 +239,17 @@ cgdata *bmp16m_extract(BYTE *data) { * return: extracted pallet data */ cgdata *bmp_getpal(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); bmp_header *bmp = extract_header(data); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + bmp->bmpPp); cg->type = ALCG_BMP8; cg->pic = NULL; cg->alpha = NULL; - g_free(bmp); + free(bmp); return cg; } diff --git a/src/cache.c b/src/cache.c index df3558f..5b1e89d 100644 --- a/src/cache.c +++ b/src/cache.c @@ -24,7 +24,7 @@ #include "config.h" #include #include -#include +#include #include "portab.h" #include "cache.h" @@ -65,7 +65,7 @@ static void remove_in_cache(cacher *id) { } else { ip = ic; } - g_free(ic); + free(ic); ic = ip->next; } return; @@ -77,10 +77,10 @@ static void remove_in_cache(cacher *id) { * return: new cache handler */ cacher *cache_new(void *delcallback) { - cacher *c = g_new0(cacher, 1); + cacher *c = calloc(1, sizeof(cacher)); c->id = id; - c->top = g_new0(cacheinfo, 1); + c->top = calloc(1, sizeof(cacheinfo)); c->top->next = NULL; c->top->in_use = &dummytrue; c->free_ = delcallback; @@ -110,7 +110,7 @@ void cache_insert(cacher *id, int key, void *data, int size, boolean *in_use) { i->key = key; i->data = data; i->size = size; - i->next = g_new0(cacheinfo, 1); + i->next = calloc(1, sizeof(cacheinfo)); i->next->next = NULL; if (in_use) { i->in_use = in_use; diff --git a/src/cdrom.mp3.c b/src/cdrom.mp3.c index c179760..1869a55 100644 --- a/src/cdrom.mp3.c +++ b/src/cdrom.mp3.c @@ -31,7 +31,6 @@ #include #include #include -#include #ifdef HAVE_LIBGEN_H #include @@ -261,7 +260,7 @@ static int cdrom_start(int trk) { } if (pipedplay) { - g_snprintf(cmd_pipe, sizeof(cmd_pipe) -1, mp3_player, playlist[trk -2]); + snprintf(cmd_pipe, sizeof(cmd_pipe) -1, mp3_player, playlist[trk -2]); if (-1 == muspcm_load_pipe(SLOT_CDROMPIPE, cmd_pipe)) { return NG; } diff --git a/src/cg.c b/src/cg.c index 5b96064..4af18ba 100644 --- a/src/cg.c +++ b/src/cg.c @@ -22,7 +22,6 @@ /* $Id: cg.c,v 1.12 2001/09/16 15:59:11 chikama Exp $ */ #include -#include #include "portab.h" #include "system.h" #include "graphics.h" @@ -110,10 +109,10 @@ static void set_vspbank(BYTE *pic, int bank, int width, int height) { * cg: freeing data object */ static void cgdata_free(cgdata *cg) { - if (cg->pic) g_free(cg->pic); - if (cg->pal) g_free(cg->pal); - if (cg->alpha) g_free(cg->alpha); - g_free(cg); + if (cg->pic) free(cg->pic); + if (cg->pal) free(cg->pal); + if (cg->alpha) free(cg->alpha); + free(cg); } /* diff --git a/src/cursor.c b/src/cursor.c index ca80494..e80d5a0 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -22,7 +22,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -231,7 +230,7 @@ static int read_rgbquad(BYTE* data) { int colors=2; BYTE* p = data; - cursorImage.icColors = g_new(TRGBQuad, colors); + cursorImage.icColors = malloc(sizeof(TRGBQuad) * colors); if (cursorImage.icColors == NULL) { /* shouldn't happen */ NOMEMERR(); @@ -338,7 +337,7 @@ static boolean cursor_load_anim(BYTE *data, int no) { NOTICE("rate size = %d\n", c.size); if (anicurHeader.fl & 0x01) { int i; - anicurHeader.rate = g_new(int, anicurHeader.cSteps); + anicurHeader.rate = malloc(sizeof(int) * anicurHeader.cSteps); for (i = 0; i < anicurHeader.cSteps; i++) { anicurHeader.rate[i] = LittleEndian_getW(src, i*4); // printf("rate %d, %d\n", i, anicurHeader.rate[i]); diff --git a/src/dri.c b/src/dri.c index 7e0f8ec..3f5b688 100644 --- a/src/dri.c +++ b/src/dri.c @@ -23,13 +23,13 @@ #include #include +#include #include #include #include #include #include #include -#include #include "portab.h" #include "system.h" #include "LittleEndian.h" @@ -103,7 +103,7 @@ static void get_filemap(drifiles *d, FILE *fp) { mapsize = LittleEndian_get3B(b, 3) - ptrsize; /* allocate read buffer */ - _b = g_new(char, mapsize << 8); + _b = malloc(sizeof(char) * (mapsize << 8)); /* read filemap */ fseek(fp, ptrsize << 8L , SEEK_SET); @@ -113,9 +113,9 @@ static void get_filemap(drifiles *d, FILE *fp) { d->maxfile = (mapsize << 8) / 3; /* map of disk */ - d->map_disk = g_new(char , d->maxfile); + d->map_disk = malloc(sizeof(char ) * d->maxfile); /* map of data in disk */ - d->map_ptr = g_new(short, d->maxfile); + d->map_ptr = malloc(sizeof(short) * d->maxfile); for (i = 0; i < d->maxfile; i++) { /* map_disk[?] and map_ptr[?] are from 0 */ @@ -123,7 +123,7 @@ static void get_filemap(drifiles *d, FILE *fp) { *(d->map_ptr + i) = LittleEndian_getW(_b, i * 3 + 1) - 1; } - g_free(_b); + free(_b); return; } @@ -148,21 +148,21 @@ static void get_fileptr(drifiles *d, FILE *fp, int disk) { filecnt = (ptrsize << 8) / 3; /* allocate read buffer */ - _b = g_new(char, ptrsize << 8); + _b = malloc(sizeof(char) * (ptrsize << 8)); /* read pointers */ fseek(fp, 0L, SEEK_SET); fread(_b, 256, ptrsize, fp); /* allocate pointers buffer */ - d->fileptr[disk] = g_new0(int, filecnt); + d->fileptr[disk] = calloc(filecnt, sizeof(int)); /* store pointers */ for (i = 0; i < filecnt; i++) { *(d->fileptr[disk] + i) = (LittleEndian_get3B(_b, i * 3 + 3) << 8); } - g_free(_b); + free(_b); return; } @@ -174,7 +174,7 @@ static void get_fileptr(drifiles *d, FILE *fp, int disk) { * return: drifile object */ drifiles *dri_init(char **file, int cnt, boolean mmapping) { - drifiles *d = g_new0(drifiles, 1); + drifiles *d = calloc(1, sizeof(drifiles)); FILE *fp; int i; boolean gotmap = FALSE; @@ -256,7 +256,7 @@ dridata *dri_getdata(drifiles *d, int no) { } else { int readsize = dataptr2 - dataptr; FILE *fp; - data = g_new(char, readsize); + data = malloc(sizeof(char) * readsize); fp = fopen(d->fnames[disk], "r"); fseek(fp, dataptr, SEEK_SET); fread(data, 1, readsize, fp); @@ -267,7 +267,7 @@ dridata *dri_getdata(drifiles *d, int no) { ptr = LittleEndian_getDW(data, 0); size = LittleEndian_getDW(data, 4); - dfile = g_new0(dridata, 1); + dfile = calloc(1, sizeof(dridata)); dfile->data_raw = data; /* dri data header */ dfile->data = data + ptr; /* real data */ dfile->size = size; diff --git a/src/font_freetype2.c b/src/font_freetype2.c index 13ce4d4..7ce5df8 100644 --- a/src/font_freetype2.c +++ b/src/font_freetype2.c @@ -25,7 +25,6 @@ #include #include -#include #include #include FT_FREETYPE_H @@ -309,7 +308,7 @@ static boolean drawable() { FONT *font_ft2_new() { int err; - FONT *f = g_new(FONT, 1); + FONT *f = malloc(sizeof(FONT)); f->sel_font = font_ttf_sel_font; f->get_glyph = font_ttf_get_glyph; @@ -324,7 +323,7 @@ FONT *font_ft2_new() { img_glyph.bytes_per_line = GLYPH_PIXMAP_WIDTH; img_glyph.depth = 8; img_glyph.bytes_per_pixel = 1; - img_glyph.pixel = g_malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT); + img_glyph.pixel = malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT); this = f; diff --git a/src/font_sdlttf.c b/src/font_sdlttf.c index f346871..fc9160c 100644 --- a/src/font_sdlttf.c +++ b/src/font_sdlttf.c @@ -100,7 +100,7 @@ static boolean drawable() { } FONT *font_ttf_new() { - FONT *f = g_new(FONT, 1); + FONT *f = malloc(sizeof(FONT)); f->sel_font = font_sdlttf_sel_font; f->get_glyph = font_sdlttf_get_glyph; diff --git a/src/font_x11.c b/src/font_x11.c index 7bf6ece..86f312d 100644 --- a/src/font_x11.c +++ b/src/font_x11.c @@ -29,7 +29,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -101,7 +100,7 @@ static void font_x11_sel_font(int type, int size) { if (type > 3) type = FONT_GOTHIC; /* set size */ - g_snprintf(name, sizeof(name), this->name[type], size, size); + snprintf(name, sizeof(name), this->name[type], size, size); fs = XCreateFontSet(x11_display, name, &miss, &n_miss, &def); if (n_miss > 0) { @@ -138,7 +137,7 @@ static agsurface_t *get_drawn_glyph(const char *str, int w) { src = XGetImage(x11_display, pix_glyph, 0, 0, w, font_ascent + font_descent, AllPlanes, ZPixmap); - dst = g_new(agsurface_t, 1); + dst = malloc(sizeof(agsurface_t)); dst->width = w; dst->height = font_ascent + font_descent; @@ -178,7 +177,7 @@ static void *font_x11_get_glyph(unsigned char *str) { img_glyph.height = dst->height; free(dst->pixel); - g_free(dst); + free(dst); free(conv); return &img_glyph; } @@ -206,7 +205,7 @@ static int font_x11_draw_glyph(int x, int y, unsigned char *str, int col) { } else { image_getGlyphImageNto8(DIB, dst, x, y, col); } - g_free(dst); + free(dst); } else { Xcore_setForeground(col); XmbDrawString(x11_display, x11_pixmap, fontset, x11_gc_pix, x, y + font_ascent, conv, strlen(conv)); @@ -221,7 +220,7 @@ static boolean drawable() { FONT *font_x11_new() { - FONT *f = g_new(FONT, 1); + FONT *f = malloc(sizeof(FONT)); f->sel_font = font_x11_sel_font; f->get_glyph = font_x11_get_glyph; @@ -239,7 +238,7 @@ FONT *font_x11_new() { img_glyph.bytes_per_line = GLYPH_PIXMAP_WIDTH; img_glyph.depth = 8; img_glyph.bytes_per_pixel = 1; - img_glyph.pixel = g_malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT); + img_glyph.pixel = malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT); this = f; diff --git a/src/image.c b/src/image.c index df463c1..1189e21 100644 --- a/src/image.c +++ b/src/image.c @@ -25,7 +25,6 @@ #include #include -#include #include "portab.h" #include "system.h" #include "image.h" @@ -270,7 +269,7 @@ static int trans_index2pixel(int depth, int i) { /* 16bitCGの ALPHALEVELを指定 */ static WORD *changeImageAlphaLevel(cgdata *cg) { - WORD *new_pic = g_new(WORD, cg->width * cg->height), *new_pic_; + WORD *new_pic = malloc(sizeof(WORD) * cg->width * cg->height), *new_pic_; WORD *pic = (WORD *)cg->pic; int pixels = cg->width * cg->height; @@ -362,10 +361,10 @@ void image_scaledCopyArea(agsurface_t *src, agsurface_t *dst, int sx, int sy, in a1 = (float)sw / (float)dw; a2 = (float)sh / (float)dh; // src width と dst width が同じときに問題があるので+1 - row = g_new0(int, dw+1); + row = calloc(dw+1, sizeof(int)); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh+1); + col = calloc(dh+1, sizeof(int)); if (mirror & 1) { /* 上下反転 added by tajiri@wizard */ @@ -420,8 +419,8 @@ void image_scaledCopyArea(agsurface_t *src, agsurface_t *dst, int sx, int sy, in break; } - g_free(row); - g_free(col); + free(row); + free(col); if (srccpy != NULL) { image_delRegion(srccpy); @@ -544,7 +543,7 @@ void image_drawImage16_fromData(agsurface_t *dib, cgdata *cg, int x, int y, int } if (cg->alphalevel != 255) { - g_free(cg->pic); + free(cg->pic); cg->pic = (BYTE *)pic_save; } } @@ -675,7 +674,7 @@ void image_getPixel(agsurface_t *dib, int x, int y, Pallet *cell) { * dib から領域の切り出し */ agsurface_t* image_saveRegion(agsurface_t *dib, int x, int y, int w, int h) { - agsurface_t *i = g_new(agsurface_t ,1); + agsurface_t *i = malloc(sizeof(agsurface_t)); int j; BYTE *ys = GETOFFSET_PIXEL(dib, x, y); BYTE *yd; @@ -686,7 +685,7 @@ agsurface_t* image_saveRegion(agsurface_t *dib, int x, int y, int w, int h) { i->height = h; i->bytes_per_line = w * dib->bytes_per_pixel; i->bytes_per_pixel = dib->bytes_per_pixel; - i->pixel = yd = g_new(char, w * h * dib->bytes_per_pixel); + i->pixel = yd = malloc(sizeof(char) * (w * h * dib->bytes_per_pixel)); for (j = 0; j < h; j++) { memcpy(yd, ys, w * dib->bytes_per_pixel); @@ -727,16 +726,16 @@ void image_putRegion(agsurface_t *dib, agsurface_t *dst, int x, int y) { */ void image_restoreRegion(agsurface_t *dib, agsurface_t *dst, int x, int y) { image_putRegion(dib, dst, x, y); - g_free(dst->pixel); - g_free(dst); + free(dst->pixel); + free(dst); } /* * save した領域の解放 */ void image_delRegion(agsurface_t *r) { - g_free(r->pixel); - g_free(r); + free(r->pixel); + free(r); } diff --git a/src/list.c b/src/list.c new file mode 100644 index 0000000..149ba90 --- /dev/null +++ b/src/list.c @@ -0,0 +1,90 @@ +/* + * list.c linked list (for GLib replacement) + * + * Copyright (C) 2014-2017 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include + +#include "list.h" + +void slist_foreach(SList *list, ListFunc func, void *user_data) { + for (; list; list = list->next) + func(list->data, user_data); +} + +void slist_free(SList *list) { + while (list) { + SList* next = list->next; + free(list); + list = next; + } +} + +SList* slist_append(SList *list, void *data) { + SList* node = malloc(sizeof(SList)); + node->data = data; + node->next = NULL; + + if (!list) + return node; + + SList* last = list; + while (list->next) + last = list->next; + last->next = node; + return list; +} + +SList* slist_remove(SList *list, const void *data) { + if (!list) + return NULL; + + SList* node = list; + if (list->data == data) { + list = list->next; + free(node); + return list; + } + + for (; node->next; node++) { + if (node->next->data == data) { + SList* nodeToRemove = node->next; + node->next = nodeToRemove->next; + free(nodeToRemove); + break; + } + } + return list; +} + +int slist_index(SList *list, const void *data) { + int i; + for (i = 0; list; list = list->next, i++) { + if (list->data == data) + return i; + } + return -1; +} + +unsigned slist_length(SList *list) { + unsigned len; + for (len = 0; list; list = list->next) + len++; + return len; +} diff --git a/src/list.h b/src/list.h new file mode 100644 index 0000000..1d43c59 --- /dev/null +++ b/src/list.h @@ -0,0 +1,54 @@ +/* + * list.h linked list (for GLib replacement) + * + * Copyright (C) 2014-2017 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __LIST_H_ +#define __LIST_H_ + +typedef struct SList_t { + void *data; + struct SList_t *next; +} SList; + +typedef void (*ListFunc)(void *data, void *user_data); +typedef int (*CompareFunc) (const void *a, const void *b); + +#define slist_next(lst) (lst)->next +void slist_foreach(SList *list, ListFunc func, void *user_data); +void slist_free(SList *list); +SList* slist_append(SList *list, void *data); +SList* slist_remove(SList *list, const void *data); +int slist_index(SList *list, const void *data); +unsigned slist_length(SList *list); + +typedef SList List; + +#define list_next slist_next +#define list_append slist_append +#define list_remove slist_remove +#define list_index slist_index +#define list_length slist_length + +// Not implemented +SList* slist_insert_sorted(SList *list, void* data, CompareFunc func); +List* list_nth(List *list, unsigned int n); +List* list_last(List *list); + +#endif // __LIST_H_ diff --git a/src/midi.extplayer.c b/src/midi.extplayer.c index e6f0327..a8fb66f 100644 --- a/src/midi.extplayer.c +++ b/src/midi.extplayer.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -182,7 +181,7 @@ static int midi_exit() { } for (i = 0; i < 256; i++) { - g_snprintf(tmpfilename, sizeof(tmpfilename)-1, "%s/xsys35-midi_%03d.mid", nact->tmpdir, i); + snprintf(tmpfilename, sizeof(tmpfilename)-1, "%s/xsys35-midi_%03d.mid", nact->tmpdir, i); unlink(tmpfilename); } @@ -197,7 +196,7 @@ static int midi_start(int no, char *data, int datalen) { char cmd_pipe[256]; pid_t pid; - g_snprintf(tmpfilename, sizeof(tmpfilename) -1, "%s/xsys35-midi_%03d.mid", nact->tmpdir, no); + snprintf(tmpfilename, sizeof(tmpfilename) -1, "%s/xsys35-midi_%03d.mid", nact->tmpdir, no); if (NULL == (fd = fopen(tmpfilename, "rb"))) { if (NULL == (fd = fopen(tmpfilename, "wb"))) { WARNING("cannot open tmporaryfile"); @@ -208,7 +207,7 @@ static int midi_start(int no, char *data, int datalen) { fclose(fd); if (pipedplay) { - g_snprintf(cmd_pipe, sizeof(cmd_pipe) -1, "%s %s", midi_player, tmpfilename); + snprintf(cmd_pipe, sizeof(cmd_pipe) -1, "%s %s", midi_player, tmpfilename); if (-1 == muspcm_load_pipe(SLOT_MIDIPIPE, cmd_pipe)) { return NG; } diff --git a/src/midifile.c b/src/midifile.c index c224051..cb9a955 100644 --- a/src/midifile.c +++ b/src/midifile.c @@ -27,7 +27,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -89,7 +88,7 @@ static void make_chunk(struct midievent *ev, int n) { ev->port = 0; if (n != 0) { - ev->data = g_new(unsigned char, n + 1); + ev->data = malloc(sizeof(unsigned char) * (n + 1)); } } @@ -351,7 +350,7 @@ static void msginit() { static void msgadd(int c) { if (midi->msgindex >= midi->msgsize) { midi->msgsize *= 2; - midi->msgbuffer = (unsigned char *)g_realloc(midi->msgbuffer, midi->msgsize); + midi->msgbuffer = (unsigned char *)realloc(midi->msgbuffer, midi->msgsize); } midi->msgbuffer[midi->msgindex++] = (unsigned char)c; } @@ -555,10 +554,10 @@ static int read_header(BYTE *stream, off_t len) { } struct midiinfo *mf_read_midifile(BYTE *stream, off_t len) { - midi = g_new(struct midiinfo, 1); + midi = malloc(sizeof(struct midiinfo)); midi->msgsize = 128; /* Initial msg buffer size */ - midi->msgbuffer = g_new0(unsigned char, midi->msgsize); + midi->msgbuffer = calloc(midi->msgsize, sizeof(unsigned char)); if (0 > read_header(stream, len)) { return NULL; @@ -572,10 +571,10 @@ struct midiinfo *mf_read_midifile(BYTE *stream, off_t len) { void mf_remove_midifile(struct midiinfo *m) { int i; - g_free(m->msgbuffer); + free(m->msgbuffer); for (i = 0; i < m->eventsize; i ++) { - g_free(m->event[i].data); + free(m->event[i].data); } - g_free(m); + free(m); } diff --git a/src/mixer_alsa.c b/src/mixer_alsa.c index 8992de2..f952c65 100644 --- a/src/mixer_alsa.c +++ b/src/mixer_alsa.c @@ -48,11 +48,11 @@ static int mixer_get_level(audiodevice_t *dev, int ch) { } void mixer_exit(audiodevice_t *dev) { - g_free(dev->data_mix); + free(dev->data_mix); } int mixer_init(audiodevice_t *dev) { - mixer_alsa_t *mix = g_new0(mixer_alsa_t, 1); + mixer_alsa_t *mix = calloc(1, sizeof(mixer_alsa_t)); mix->card = 0; mix->mix_dev = 0; dev->data_mix = mix; diff --git a/src/mixer_esd.c b/src/mixer_esd.c index fbbd2d6..90d43dc 100644 --- a/src/mixer_esd.c +++ b/src/mixer_esd.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "audio.h" #include "audio_esd.h" diff --git a/src/mixer_oss.c b/src/mixer_oss.c index 6f861c7..b0d676b 100644 --- a/src/mixer_oss.c +++ b/src/mixer_oss.c @@ -44,7 +44,6 @@ #else # include #endif -#include #include "audio.h" #include "audio_oss.h" @@ -97,7 +96,7 @@ static int mixer_init(audiodevice_t *dev, char *devmix) { if ((fd = open(devmix, O_RDWR)) < 0) return NG; - mix = g_new0(mixer_oss_t, 1); + mix = calloc(1, sizeof(mixer_oss_t)); mix->mdev = devmix; dev->data_mix = mix; diff --git a/src/mixer_sun.c b/src/mixer_sun.c index ecffceb..21bdf53 100644 --- a/src/mixer_sun.c +++ b/src/mixer_sun.c @@ -15,7 +15,7 @@ static int mixer_exit(audiodevice_t *dev) { static int mixer_init(audiodevice_t *dev, char *devmix) { mixer_sun_t *mix; - // mix = g_new0(mixer_sun_t, 1); + // mix = calloc(1, sizeof(mixer_sun_t)); return OK; diff --git a/src/music.h b/src/music.h index dddb0b0..cecfdfb 100644 --- a/src/music.h +++ b/src/music.h @@ -24,7 +24,7 @@ #ifndef __MUSIC_H__ #define __MUSIC_H__ -#include +#include /* music command */ enum { @@ -79,20 +79,20 @@ enum { #define XSYS35_PROTOCOL_VERSION 1 typedef struct { - guint16 version; - guint16 command; - guint32 data_length; + uint16_t version; + uint16_t command; + uint32_t data_length; } ClientPktHeader; typedef struct { - guint16 version; - guint32 data_length; + uint16_t version; + uint32_t data_length; } ServerPktHeader; typedef struct { ClientPktHeader hdr; - gpointer data; - gint fd; + void* data; + int fd; } PacketNode; typedef struct { diff --git a/src/music_bgm.c b/src/music_bgm.c index 1eb52a8..42c1806 100644 --- a/src/music_bgm.c +++ b/src/music_bgm.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "portab.h" #include "system.h" @@ -136,7 +136,7 @@ static bgi_t *bgi_read() { fseek(fp, 0, SEEK_END); len = ftell(fp); fseek(fp, 0, SEEK_SET); - _b = b = g_malloc(len); + _b = b = malloc(len); fread(b, len, 1, fp); fclose(fp); @@ -155,9 +155,9 @@ static bgi_t *bgi_read() { b = findterm(b); } - bgi = g_new(bgi_t, 1); + bgi = malloc(sizeof(bgi_t)); bgi->nfile = 1 + (len - (b - _b)) / 29; // だいたいこれくらい? - bgi->i = g_new(struct _bgii, bgi->nfile); + bgi->i = malloc(sizeof(struct _bgii) * bgi->nfile); while (b < blast) { int len; @@ -179,7 +179,7 @@ static bgi_t *bgi_read() { b = findterm(b); } - g_free(_b); + free(_b); return bgi; } @@ -285,7 +285,7 @@ int musbgm_play(int no, int time, int vol) { return NG; } - obj = g_new0(pcmobj_t, 1); + obj = calloc(1, sizeof(pcmobj_t)); obj->sdata = (void *)wfile; obj->stype = OBJSRC_FILE; if (bgmindex->i[dno].len == 0) { @@ -313,8 +313,8 @@ int musbgm_play(int no, int time, int vol) { obj->written_len = 0; obj->playing = TRUE; - if (-1 == g_list_index(prv.pcmplist, obj)) { - prv.pcmplist = g_list_append(prv.pcmplist, (gpointer)obj); + if (-1 == list_index(prv.pcmplist, obj)) { + prv.pcmplist = list_append(prv.pcmplist, (void*)obj); } musfade_new(MIX_PCM, slot, time, vol, 0); @@ -357,7 +357,7 @@ int musbgm_fade(int no, int time, int vol) { int musbgm_getpos(int no) { int slot; pcmobj_t *obj; - guint64 len; + uint64_t len; if (bgmindex == NULL) return 0; @@ -369,13 +369,13 @@ int musbgm_getpos(int no) { obj = prv.pcm[slot]; len = obj->src->hidden.mem.cur - obj->src->hidden.mem.base; - return (int)(((guint64)len * 100) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch)); + return (int)(((uint64_t)len * 100) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch)); } int musbgm_getlen(int no) { int slot; pcmobj_t *obj; - guint64 len; + uint64_t len; int ilen; if (bgmindex == NULL) return 0; @@ -388,12 +388,12 @@ int musbgm_getlen(int no) { // load and get wfile = bgm_load(no); len = wfile->bytes; - ilen = (int)(((guint64)len * 100) / (wfile->rate * (wfile->bits/8) * wfile->ch)); + ilen = (int)(((uint64_t)len * 100) / (wfile->rate * (wfile->bits/8) * wfile->ch)); pcmlib_free(wfile); } else { obj = prv.pcm[slot]; len = obj->src->hidden.mem.end - obj->src->hidden.mem.base; - ilen = (int)(((guint64)len * 100) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch)); + ilen = (int)(((uint64_t)len * 100) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch)); } return ilen; diff --git a/src/music_client.c b/src/music_client.c index 4334f4d..9c1dabb 100644 --- a/src/music_client.c +++ b/src/music_client.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "portab.h" #include "music.h" @@ -66,13 +66,13 @@ static void *cl_read_packet(int fd, ServerPktHeader *pkt_hdr) { void *data = NULL; if (sizeof(ServerPktHeader) == read(fd, pkt_hdr, sizeof (ServerPktHeader))) { - if (pkt_hdr->data_length) { - data = g_malloc0(pkt_hdr->data_length); - read(fd, data, pkt_hdr->data_length); - } - } + if (pkt_hdr->data_length) { + data = calloc(1, pkt_hdr->data_length); + read(fd, data, pkt_hdr->data_length); + } + } - return data; + return data; } static void cl_read_ack(int fd) { @@ -81,7 +81,7 @@ static void cl_read_ack(int fd) { data = cl_read_packet(fd, &pkt_hdr); if (data) { - g_free(data); + free(data); } } @@ -99,14 +99,14 @@ static void cl_send_packet(int fd, int command, void * data, int data_length) { } } -static void cl_send_guint32(int cmd, guint32 val) { +static void cl_send_uint32(int cmd, uint32_t val) { int fd; if (-1 == (fd = connect_to_server())) { return; } - cl_send_packet(fd, cmd, &val, sizeof(guint32)); + cl_send_packet(fd, cmd, &val, sizeof(uint32_t)); cl_read_ack(fd); close(fd); } @@ -149,7 +149,7 @@ static boolean cl_get_boolean(int cmd) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *((boolean *) data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -157,7 +157,7 @@ static boolean cl_get_boolean(int cmd) { return ret; } -static int cl_get_guint32(int cmd) { +static int cl_get_uint32(int cmd) { ServerPktHeader pkt_hdr; void *data; int fd, ret = 0; @@ -170,7 +170,7 @@ static int cl_get_guint32(int cmd) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *((int *) data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -203,7 +203,7 @@ int musclient_init() { cdrom_available = ((ValidSubsystem *)data)->cdrom; midi_available = ((ValidSubsystem *)data)->midi; audio_available = ((ValidSubsystem *)data)->pcm; - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -273,7 +273,7 @@ int mus_cdrom_get_playposition(cd_time *tm) { data = cl_read_packet(fd, &pkt_hdr); if (data) { *tm = *((cd_time *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -289,7 +289,7 @@ int mus_cdrom_get_maxtrack() { if (!cdrom_available) return 0; - trk = cl_get_guint32(MUS_CDROM_GETMAXTRACK); + trk = cl_get_uint32(MUS_CDROM_GETMAXTRACK); return trk; } @@ -379,7 +379,7 @@ int mus_midi_get_playposition(midiplaystate *state) { data = cl_read_packet(fd, &pkt_hdr); if (data) { *state = *(midiplaystate *)data; - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -440,7 +440,7 @@ int mus_midi_get_flag(int mode, int index) { data = cl_read_packet(fd, &pkt_hdr); if (data) { val = *((int *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -630,7 +630,7 @@ int mus_pcm_get_playposition(int *pos) { data = cl_read_packet(fd, &pkt_hdr); if (data) { *pos = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -699,7 +699,7 @@ boolean mus_mixer_fadeout_get_state(int device) { data = cl_read_packet(fd, &pkt_hdr); if (data) { bool = *((boolean *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -757,7 +757,7 @@ int mus_mixer_get_level(int device) { data = cl_read_packet(fd, &pkt_hdr); if (data) { lv = *((int *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -818,7 +818,7 @@ int mus_wav_unload(int ch) { if (ch < 0 || ch > 128) return NG; - cl_send_guint32(MUS_PCM_UNLOAD, (guint32)(ch + 1)); + cl_send_uint32(MUS_PCM_UNLOAD, (uint32_t)(ch + 1)); return OK; } @@ -858,7 +858,7 @@ int mus_wav_stop(int ch) { if (ch < 0 || ch > 128) return NG; - cl_send_guint32(MUS_PCM_STOP, (guint32)(ch +1)); + cl_send_uint32(MUS_PCM_STOP, (uint32_t)(ch +1)); return OK; } @@ -890,7 +890,7 @@ int mus_wav_get_playposition(int ch) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -993,7 +993,7 @@ boolean mus_wav_fadeout_get_state(int ch) { if (data) { bool = *((boolean *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -1058,7 +1058,7 @@ int mus_wav_waittime(int ch, int time) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -1110,7 +1110,7 @@ int mus_wav_wavtime(int ch) { if (data) { ret = *((boolean *)data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -1262,7 +1262,7 @@ int mus_bgm_getpos(int no) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -1293,7 +1293,7 @@ int mus_bgm_wait(int no, int timeout) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); @@ -1328,7 +1328,7 @@ int mus_bgm_waitpos(int no, int index) { int mus_bgm_stopall(int time) { if (!audio_available) return NG; - cl_send_guint32(MUS_BGM_STOPALL, (guint32)time * 10); + cl_send_uint32(MUS_BGM_STOPALL, (uint32_t)time * 10); return OK; } @@ -1352,7 +1352,7 @@ int mus_bgm_getlength(int no) { data = cl_read_packet(fd, &pkt_hdr); if (data) { ret = *(int *)(data); - g_free(data); + free(data); } cl_read_ack(fd); close(fd); diff --git a/src/music_ctrlsocket.c b/src/music_ctrlsocket.c index 97270c7..dcca025 100644 --- a/src/music_ctrlsocket.c +++ b/src/music_ctrlsocket.c @@ -22,9 +22,9 @@ /* $Id: music_ctrlsocket.c,v 1.1 2002/08/18 09:35:29 chikama Exp $ */ #include -#include +#include -static void ctrl_write_packet(gint fd, gpointer data, gint length) { +static void ctrl_write_packet(int fd, void* data, int length) { ServerPktHeader pkthdr; pkthdr.version = XSYS35_PROTOCOL_VERSION; @@ -35,19 +35,19 @@ static void ctrl_write_packet(gint fd, gpointer data, gint length) { } } -static void ctrl_write_gint(gint fd, gint val) { - ctrl_write_packet(fd, &val, sizeof (gint)); +static void ctrl_write_int(int fd, int val) { + ctrl_write_packet(fd, &val, sizeof (int)); } -static void ctrl_write_gfloat(gint fd, gfloat val) { - ctrl_write_packet(fd, &val, sizeof (gfloat)); +static void ctrl_write_float(int fd, float val) { + ctrl_write_packet(fd, &val, sizeof (float)); } -static void ctrl_write_gboolean(gint fd, gboolean bool) { - ctrl_write_packet(fd, &bool, sizeof (gboolean)); +static void ctrl_write_boolean(int fd, boolean bool) { + ctrl_write_packet(fd, &bool, sizeof (boolean)); } -static void ctrl_write_string(gint fd, gchar * string) { +static void ctrl_write_string(int fd, char* string) { ctrl_write_packet(fd, string, string ? strlen(string) + 1 : 0); } @@ -55,7 +55,7 @@ static void ctrl_ack_packet(PacketNode * pkt) { ctrl_write_packet(pkt->fd, NULL, 0); close(pkt->fd); if (pkt->data) { - g_free(pkt->data); + free(pkt->data); } - g_free(pkt); + free(pkt); } diff --git a/src/music_fader.c b/src/music_fader.c index 73e7cb1..b42d753 100644 --- a/src/music_fader.c +++ b/src/music_fader.c @@ -22,10 +22,11 @@ /* $Id: music_fader.c,v 1.5 2003/07/14 16:22:51 chikama Exp $ */ #include -#include +#include #include "portab.h" #include "system.h" +#include "list.h" #include "music_server.h" #include "counter.h" @@ -109,7 +110,7 @@ static int setvolmidi(int lv) { * stop : フェード終了時に再生を終了するかどうか (1:止める, 0:止めない) */ int musfade_new(int dev, int subdev, int time, int ed_vol, int stop) { - fadeobj_t *obj = g_new0(fadeobj_t, 1); + fadeobj_t *obj = calloc(1, sizeof(fadeobj_t)); // printf("fade new %d, %d, %d, %d, %d\n", dev, subdev, time, vol, stop); @@ -152,7 +153,7 @@ int musfade_new(int dev, int subdev, int time, int ed_vol, int stop) { } } - prv.fadelist = g_list_append(prv.fadelist, obj); + prv.fadelist = list_append(prv.fadelist, obj); return OK; } @@ -162,8 +163,8 @@ int musfade_new(int dev, int subdev, int time, int ed_vol, int stop) { obj: 消すオブジェクト */ static int musfade_free(fadeobj_t *obj) { - prv.fadelist = g_list_remove(prv.fadelist, (gpointer)obj); - g_free(obj); + prv.fadelist = list_remove(prv.fadelist, (void*)obj); + free(obj); return OK; } @@ -173,10 +174,10 @@ static int musfade_free(fadeobj_t *obj) { subdev: sub device */ int musfade_stop(int dev, int subdev) { - GList *node; + List *node; fadeobj_t *obj; - for (node = prv.fadelist; node; node = g_list_next(node)) { + for (node = prv.fadelist; node; node = list_next(node)) { obj = (fadeobj_t *)node->data; if (obj == NULL) continue; @@ -197,10 +198,10 @@ int musfade_stop(int dev, int subdev) { ret: TRUE or FALSE */ boolean musfade_getstate(int dev, int subdev) { - GList *node; + List *node; fadeobj_t *obj; - for (node = prv.fadelist; node; node = g_list_next(node)) { + for (node = prv.fadelist; node; node = list_next(node)) { obj = (fadeobj_t *)node->data; if (obj == NULL) continue; @@ -328,9 +329,9 @@ static void fade_calc_time(fadeobj_t *obj) { int musfade_cb() { fadeobj_t *obj; - GList *node; + List *node; - for (node = prv.fadelist; node; node = g_list_next(node)) { + for (node = prv.fadelist; node; node = list_next(node)) { obj = (fadeobj_t *)node->data; if (obj == NULL) continue; @@ -365,7 +366,7 @@ int musfade_cb() { int musfade_setvolval(int *valance, int num) { int i; - for (i = 0; i < MIN(num, 16); i++) { + for (i = 0; i < min(num, 16); i++) { prv.volval[i] = valance[i]; } diff --git a/src/music_pcm.c b/src/music_pcm.c index 9a0391d..7c5b128 100644 --- a/src/music_pcm.c +++ b/src/music_pcm.c @@ -24,10 +24,11 @@ #include #include #include -#include +#include #include "portab.h" #include "system.h" +#include "list.h" #include "music_pcm.h" #include "music_server.h" #include "musstream.h" @@ -75,8 +76,8 @@ int muspcm_init() { // device buffer の設定 audiodevbuf_t *buf = &prv.audiodev.buf; - buf->b[0] = g_malloc0(buf->len); - buf->b[1] = g_malloc0(buf->len); + buf->b[0] = calloc(1, buf->len); + buf->b[1] = calloc(1, buf->len); buf->cur = buf->b[0]; buf->end = (char *)(buf->cur + buf->len); @@ -120,7 +121,7 @@ int muspcm_load_no(int slot, int no) { } //printf("rate = %d, bits = %d, ch = %d\n", wfile->rate, wfile->bits, wfile->ch); - obj = g_new0(pcmobj_t, 1); + obj = calloc(1, sizeof(pcmobj_t)); obj->sdata = (void *)wfile; obj->stype = OBJSRC_FILE; @@ -159,7 +160,7 @@ int muspcm_load_mem(int slot, void *mem) { wfile = (WAVFILE *)((BYTE *)mem + sizeof(int)); // printf("rate = %d, bits = %d, ch = %d\n", wfile->rate, wfile->bits, wfile->ch); - obj = g_new0(pcmobj_t, 1); + obj = calloc(1, sizeof(pcmobj_t)); obj->sdata = mem; obj->stype = OBJSRC_MEM; obj->src = ms_memory((BYTE *)mem + sizeof(int) + sizeof(WAVFILE), wfile->bytes); @@ -185,7 +186,7 @@ int muspcm_load_pipe(int slot, char *cmd) { if (IS_LOADED(slot)) muspcm_unload(slot); - obj = g_new0(pcmobj_t, 1); + obj = calloc(1, sizeof(pcmobj_t)); obj->sdata = NULL; obj->stype = OBJSRC_PIPE; obj->src = ms_pipe(cmd); @@ -232,8 +233,8 @@ int muspcm_start(int slot, int loop) { obj->src->seek(obj->src, 0, SEEK_SET); obj->playing = TRUE; - if (-1 == g_list_index(prv.pcmplist, obj)) { - prv.pcmplist = g_list_append(prv.pcmplist, (gpointer)obj); + if (-1 == list_index(prv.pcmplist, obj)) { + prv.pcmplist = list_append(prv.pcmplist, (void*)obj); } return OK; @@ -246,7 +247,7 @@ int muspcm_stop(int slot) { obj = prv.pcm[slot]; if (obj == NULL) return NG; - prv.pcmplist = g_list_remove(prv.pcmplist, obj); + prv.pcmplist = list_remove(prv.pcmplist, obj); obj->playing = FALSE; return OK; @@ -266,12 +267,12 @@ int muspcm_unload(int slot) { pcmlib_free((WAVFILE *)(obj->sdata)); break; case OBJSRC_MEM: - g_free(obj->sdata); + free(obj->sdata); break; } sndcnv_drain(obj); obj->src->close(obj->src); - g_free(obj); + free(obj); prv.pcm[slot] = NULL; @@ -307,7 +308,7 @@ static int pcmmix_mix(short *src, int len) { // WARNING("mix to buf (%d) ptr=%p len = %d\n", buf->sw, buf->cur, len); - buf->lenmax = MAX(buf->lenmax, len); + buf->lenmax = max(buf->lenmax, len); if (buf->cur + len >= buf->end) { len1 = buf->end - buf->cur; @@ -354,16 +355,16 @@ static int pcmmix_send2devbuf() { } // defice にデータが送られたときに cb を設定してあるとそれを呼ぶ -static GSList *cb_flush[2]; -static void cb_at_devflush4each(gpointer data, gpointer userdata) { +static SList *cb_flush[2]; +static void cb_at_devflush4each(void* data, void* userdata) { pcmobj_t *obj = (pcmobj_t *)data; obj->cb_atend(obj->fd); } static void cb_at_devflush(int sw) { if (cb_flush[sw]) { - g_slist_foreach(cb_flush[sw],cb_at_devflush4each, NULL); - g_slist_free(cb_flush[sw]); + slist_foreach(cb_flush[sw],cb_at_devflush4each, NULL); + slist_free(cb_flush[sw]); cb_flush[sw] = NULL; } } @@ -372,12 +373,12 @@ static void cb_at_devflush(int sw) { int muspcm_cb() { audiodevbuf_t *buf = &prv.audiodev.buf; pcmobj_t *obj; - GList *node; - GSList *removelist = NULL, *snode; + List *node; + SList *removelist = NULL, *snode; int len; // 再生リストが空の場合はなにもしない - if (g_list_length(prv.pcmplist) == 0) { + if (list_length(prv.pcmplist) == 0) { return 0; } @@ -388,7 +389,7 @@ int muspcm_cb() { } // 全ての再生リスト中のチャンネルを合成 - for (node = prv.pcmplist; node; node = g_list_next(node)) { + for (node = prv.pcmplist; node; node = list_next(node)) { obj = (pcmobj_t *)node->data; if (obj == NULL) continue; // why ? @@ -400,7 +401,7 @@ int muspcm_cb() { if (obj->cb_atend) { // 演奏終了を知らせて欲しい // フェードやpcm_stopでの終了の際は知らせなくてよい? - cb_flush[buf->sw] = g_slist_append(cb_flush[buf->sw], obj); + cb_flush[buf->sw] = slist_append(cb_flush[buf->sw], obj); } // loop check if (obj->loop == 0) { // 無限ループ @@ -411,7 +412,7 @@ int muspcm_cb() { if (--obj->loop == 0) { // 繰り返し終了 // remove // muspcm_stop(obj->slot); - removelist = g_slist_append(removelist, obj); + removelist = slist_append(removelist, obj); continue; } else { // 先頭へ obj->src->seek(obj->src, 0, SEEK_SET); @@ -428,7 +429,7 @@ int muspcm_cb() { if (len > 0) pcmmix_send2devbuf(); // 最後に pcm playlist から stop した pcmobj を削除 - for (snode = removelist; snode; snode = g_slist_next(snode)) { + for (snode = removelist; snode; snode = slist_next(snode)) { obj = (pcmobj_t *)snode->data; if (obj == NULL) continue; muspcm_stop(obj->slot); @@ -446,7 +447,7 @@ int muspcm_write2dev(void) { sw = (buf->ready[0] ? 0 : buf->ready[1] ? 1 : -1); while (sw < 0) { int len = 0; - if (g_list_length(prv.pcmplist) != 0) { + if (list_length(prv.pcmplist) != 0) { // playlist中にPCMデータソースがある場合は // バッファがいっぱいになるまで読み込む len = muspcm_cb(); @@ -483,7 +484,7 @@ int muspcm_write2dev(void) { // 現在の再生位置を返す int muspcm_getpos(int slot) { pcmobj_t *obj; - guint64 len; + uint64_t len; obj = prv.pcm[slot]; if (obj == NULL) return 0; @@ -497,7 +498,7 @@ int muspcm_getpos(int slot) { } if (len < 0) return 0; #endif - return (int)(((guint64)(len * 1000) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch))); + return (int)(((uint64_t)(len * 1000) / (obj->fmt.rate * (obj->fmt.bit/8) * obj->fmt.ch))); } // PCMオブジェクトに対してボリュームをセット diff --git a/src/music_pcm_wai.c b/src/music_pcm_wai.c index 1f563c9..89131b0 100644 --- a/src/music_pcm_wai.c +++ b/src/music_pcm_wai.c @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/src/music_server.c b/src/music_server.c index 2ebf734..8d00caa 100644 --- a/src/music_server.c +++ b/src/music_server.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "portab.h" @@ -86,12 +85,12 @@ static int get_command() { return 0; } - pkt = g_malloc0(sizeof(PacketNode)); + pkt = calloc(1, sizeof(PacketNode)); read(fd, &pkt->hdr, sizeof(ClientPktHeader)); if (pkt->hdr.data_length) { BYTE *p; int l; - p = pkt->data = g_malloc0(pkt->hdr.data_length); + p = pkt->data = calloc(1, pkt->hdr.data_length); l = pkt->hdr.data_length; while(l) { int len; @@ -156,7 +155,7 @@ static int get_command() { muspcm_load_mem(v[0], pkt->data); ctrl_write_packet(pkt->fd, NULL, 0); close(pkt->fd); - g_free(pkt); + free(pkt); break; case MUS_PCM_LOAD_LRSW: @@ -176,7 +175,7 @@ static int get_command() { int time; v[0] = ((int *)pkt->data)[0]; /* ch */ time = muspcm_getpos(v[0]); - ctrl_write_gint(pkt->fd, time); + ctrl_write_int(pkt->fd, time); ctrl_ack_packet(pkt); break; } @@ -189,15 +188,15 @@ static int get_command() { } prv.pcm[v[0]]->cb_atend = musserv_send_ack; prv.pcm[v[0]]->fd = pkt->fd; - g_free(pkt->data); - g_free(pkt); + free(pkt->data); + free(pkt); break; case MUS_PCM_GETWAVETIME: { int time; v[0] = ((int *)pkt->data)[0]; /* ch */ time = muspcm_getwavelen(v[0]); - ctrl_write_gint(pkt->fd, time); + ctrl_write_int(pkt->fd, time); ctrl_ack_packet(pkt); break; } @@ -244,7 +243,7 @@ static int get_command() { v[0] = ((int *)pkt->data)[0]; /* mode */ v[1] = ((int *)pkt->data)[1]; /* index */ val = musmidi_getflag(v[0], v[1]); - ctrl_write_gint(pkt->fd, val); + ctrl_write_int(pkt->fd, val); ctrl_ack_packet(pkt); break; } @@ -272,7 +271,7 @@ static int get_command() { v[0] = ((int *)pkt->data)[0]; /* device */ v[1] = ((int *)pkt->data)[1]; /* pcm subdev */ st = musfade_getstate(v[0], v[1]); - ctrl_write_gboolean(pkt->fd, st); + ctrl_write_boolean(pkt->fd, st); ctrl_ack_packet(pkt); break; } @@ -282,7 +281,7 @@ static int get_command() { v[0] = ((int *)pkt->data)[0]; /* dev */ lv = musfade_getvol(v[0]); - ctrl_write_gint(pkt->fd, lv); + ctrl_write_int(pkt->fd, lv); ctrl_ack_packet(pkt); break; } @@ -331,7 +330,7 @@ static int get_command() { } else { val = musbgm_getpos(v[0]); } - ctrl_write_gint(pkt->fd, val); + ctrl_write_int(pkt->fd, val); ctrl_ack_packet(pkt); break; } @@ -344,7 +343,7 @@ static int get_command() { } else { val = musbgm_getlen(v[0]); } - ctrl_write_gint(pkt->fd, val); + ctrl_write_int(pkt->fd, val); ctrl_ack_packet(pkt); break; } diff --git a/src/music_server.h b/src/music_server.h index 642ec6d..b447cbb 100644 --- a/src/music_server.h +++ b/src/music_server.h @@ -24,10 +24,10 @@ #ifndef __MUSIC_SERVER_H__ #define __MUSIC_SERVER_H__ -#include #include #include "portab.h" +#include "list.h" #include "cdrom.h" #include "midi.h" #include "audio.h" @@ -69,8 +69,8 @@ struct _musprvdat { // 最大トラック数 int cd_maxtrk; - GList *pcmplist; // PCM多重再生用リスト - GList *fadelist; // Faderリスト + List *pcmplist; // PCM多重再生用リスト + List *fadelist; // Faderリスト // for polling int nfds; diff --git a/src/musstream.c b/src/musstream.c index 21ef74f..f423f66 100644 --- a/src/musstream.c +++ b/src/musstream.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -61,14 +61,14 @@ static int file_read(struct _musstream *this, void *ptr, int size, int maxnum) { static int file_close(struct _musstream *this) { if (this) { fclose(this->hidden.stdio.fp); - g_free(this); + free(this); } return 0; } static int pipe_seek(struct _musstream *this, int off, int where) { FILE *fp; - char *tbuf = g_new(char, off); + char *tbuf = malloc(sizeof(char) * off); int num = 0; switch(where) { @@ -96,11 +96,11 @@ static int pipe_seek(struct _musstream *this, int off, int where) { break; default: WARNING("Unknown value for 'whence'\n"); - g_free(tbuf); + free(tbuf); return -1; } - g_free(tbuf); + free(tbuf); return num; } @@ -125,7 +125,7 @@ static int pipe_close(struct _musstream *this) { pclose(this->hidden.pipe.fp); this->hidden.pipe.fp = NULL; } - g_free(this); + free(this); } return 0; } @@ -178,7 +178,7 @@ static int mem_read(struct _musstream *this, void *ptr, int size, int maxnum) { static int mem_close(struct _musstream *this) { if (this) { - g_free(this); + free(this); } return 0; } @@ -193,7 +193,7 @@ musstream_t *ms_file(char *filename) { return NULL; } - s = g_new0(musstream_t, 1); + s = calloc(1, sizeof(musstream_t)); s->hidden.stdio.fp = fp; s->seek = file_seek; s->read = file_read; @@ -215,7 +215,7 @@ musstream_t *ms_pipe(char *cmd) { #endif fp = NULL; - s = g_new0(musstream_t, 1); + s = calloc(1, sizeof(musstream_t)); s->hidden.pipe.fp = fp; s->hidden.pipe.cmd = cmd; @@ -229,7 +229,7 @@ musstream_t *ms_pipe(char *cmd) { musstream_t *ms_memory(void *ptr, int size) { musstream_t *s; - s = g_new0(musstream_t, 1); + s = calloc(1, sizeof(musstream_t)); s->hidden.mem.base = ptr; s->hidden.mem.cur = ptr; s->hidden.mem.end = ptr + size; diff --git a/src/musstream_ogg.c b/src/musstream_ogg.c index 88bffb7..35ecba0 100644 --- a/src/musstream_ogg.c +++ b/src/musstream_ogg.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "portab.h" @@ -53,7 +53,7 @@ static ov_callbacks ovcb = { static size_t ovcb_read(void *ptr, size_t size, size_t nmemb, void *ds) { ogg2pcm_t *i = (ogg2pcm_t *)ds; - int len = MIN(size * nmemb, i->size - (i->cur - i->top)); + int len = min(size * nmemb, i->size - (i->cur - i->top)); // fprintf(stderr, "my read %d, %d, %ld\n", size, nmemb, len); if (len < 0) len = 0; @@ -81,7 +81,7 @@ static int ovcb_seek(void *ds, ogg_int64_t offset, int whence) { } static int ovcb_close(void *ds) { - g_free(ds); + free(ds); return 0; } @@ -100,16 +100,16 @@ WAVFILE *ogg_getinfo(char *data, long size) { OggVorbis_File *vf; vorbis_info *vinfo; - o2p = g_new(ogg2pcm_t, 1); + o2p = malloc(sizeof(ogg2pcm_t)); o2p->top = o2p->cur = data; o2p->size = size; - vf = g_new(OggVorbis_File, 1); + vf = malloc(sizeof(OggVorbis_File)); if (0 > ov_open_callbacks(o2p, vf, NULL, 0, ovcb)) { goto eexit; } - wfile = g_new0(WAVFILE, 1); + wfile = calloc(1, sizeof(WAVFILE)); wfile->bytes = (int)ov_pcm_total(vf, -1); vinfo = ov_info(vf, -1); @@ -122,8 +122,8 @@ WAVFILE *ogg_getinfo(char *data, long size) { return wfile; eexit: - g_free(vf); - g_free(o2p); + free(vf); + free(o2p); return NULL; } @@ -182,12 +182,12 @@ static int ogg_seek(musstream_t *this, int offset, int whence) { static int ogg_close(musstream_t *this) { ov_clear(this->hidden.ogg.vf); - g_free(this); + free(this); return 0; } musstream_t *ms_ogg(WAVFILE *wfile) { - musstream_t *ms = g_new0(musstream_t, 1); + musstream_t *ms = calloc(1, sizeof(musstream_t)); ms->hidden.ogg.vf = wfile->data; diff --git a/src/musstream_wav.c b/src/musstream_wav.c index 2eef675..9b0fd77 100644 --- a/src/musstream_wav.c +++ b/src/musstream_wav.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -34,7 +34,7 @@ #include "wavfile.h" static int wav_read(musstream_t *this, void *ptr, int size, int nmemb) { - int len = MIN(size * nmemb, this->hidden.mem.end - this->hidden.mem.cur); + int len = min(size * nmemb, this->hidden.mem.end - this->hidden.mem.cur); int i; if (len <= 0) return 0; @@ -137,13 +137,13 @@ static int wav_seek2(struct _musstream *this, int offset, int where) { static int wav_close(musstream_t *this) { - g_free(this); + free(this); return 0; } musstream_t *ms_wav(WAVFILE *snd) { - musstream_t *ms = g_new0(musstream_t, 1); + musstream_t *ms = calloc(1, sizeof(musstream_t)); ms->hidden.mem.base = snd->data; ms->hidden.mem.cur = snd->data; @@ -162,7 +162,7 @@ musstream_t *ms_wav(WAVFILE *snd) { } musstream_t *ms_wav2(WAVFILE *snd, int size, int looptop) { - musstream_t *ms = g_new0(musstream_t, 1); + musstream_t *ms = calloc(1, sizeof(musstream_t)); ms->hidden.mem.base = snd->data; ms->hidden.mem.cur = snd->data; diff --git a/src/musstream_wav_ima.c b/src/musstream_wav_ima.c index 8741227..2be6760 100644 --- a/src/musstream_wav_ima.c +++ b/src/musstream_wav_ima.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -158,7 +158,7 @@ int ImaSamplesIn(int dataLen, WORD chans, WORD blockAlign, WORD samplesPerBlock) } static int wav_read(musstream_t *this, void *ptr, int size, int nmemb) { - int len = MIN(size * nmemb, this->hidden.ima.end - this->hidden.ima.cur); + int len = min(size * nmemb, this->hidden.ima.end - this->hidden.ima.cur); WAVFILE *w = (WAVFILE *)this->hidden.ima.wf; char *obuff; int i, offset = 0; @@ -237,19 +237,19 @@ static int wav_seek(musstream_t *this, int offset, int whence) { } static int wav_close(musstream_t *this) { - g_free(this->hidden.ima.obuf); - g_free(this); + free(this->hidden.ima.obuf); + free(this); return 0; } musstream_t *ms_wav_ima(WAVFILE *snd) { - musstream_t *ms = g_new0(musstream_t, 1); + musstream_t *ms = calloc(1, sizeof(musstream_t)); ms->hidden.ima.wf = snd; ms->hidden.ima.base = snd->data; ms->hidden.ima.cur = snd->data; ms->hidden.ima.end = snd->data + snd->bytes; - ms->hidden.ima.obuf = g_malloc(snd->samples_per_block * 2); + ms->hidden.ima.obuf = malloc(snd->samples_per_block * 2); ms->hidden.ima.obufcur = ms->hidden.ima.obuf; ms->hidden.ima.left = 0; diff --git a/src/nact.c b/src/nact.c index 0c7d912..26d3f43 100644 --- a/src/nact.c +++ b/src/nact.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "portab.h" #include "scenario.h" diff --git a/src/pcmlib.c b/src/pcmlib.c index 947e86b..88a85f3 100644 --- a/src/pcmlib.c +++ b/src/pcmlib.c @@ -23,7 +23,7 @@ #include "config.h" -#include +#include #include #include "portab.h" @@ -111,8 +111,8 @@ void pcmlib_free(WAVFILE *wfile) { if (wfile->dfile) { ald_freedata((dridata *)(wfile->dfile)); } else { - g_free(wfile->data); + free(wfile->data); } - g_free(wfile); + free(wfile); } diff --git a/src/pms.c b/src/pms.c index bcd3570..cba20bd 100644 --- a/src/pms.c +++ b/src/pms.c @@ -32,7 +32,7 @@ */ /* $Id: pms.c,v 1.2 2000/11/25 18:31:49 chikama Exp $ */ -#include +#include #include #include "portab.h" #include "LittleEndian.h" @@ -54,7 +54,7 @@ static void extract_16bit(pms_header *pms, WORD *pic, BYTE *b); * return: acquired pms information object */ static pms_header *extract_header(BYTE *b) { - pms_header *pms = g_new(pms_header, 1); + pms_header *pms = malloc(sizeof(pms_header)); pms->pmsVer = LittleEndian_getW(b, 2); pms->pmsHdrSize = LittleEndian_getW(b, 4); @@ -224,14 +224,14 @@ boolean pms256_checkfmt(BYTE *data) { * return: extracted image data and information */ cgdata *pms256_extract(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); pms_header *pms = extract_header(data); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + pms->pmsPp); /* +10: margin for broken cg */ - cg->pic = g_new(BYTE, (pms->pmsXW + 10) * (pms->pmsYW + 10)); + cg->pic = malloc(sizeof(BYTE) * ((pms->pmsXW + 10) * (pms->pmsYW + 10))); extract_8bit(pms, cg->pic, data + pms->pmsDp); cg->type = ALCG_PMS8; @@ -242,7 +242,7 @@ cgdata *pms256_extract(BYTE *data) { cg->pms_bank = pms->pmsBf; cg->alpha = NULL; - g_free(pms); + free(pms); return cg; } @@ -274,16 +274,16 @@ boolean pms64k_checkfmt(BYTE *data) { * return: extracted image data and information */ cgdata *pms64k_extract(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); pms_header *pms = extract_header(data); /* +10: margin for broken cg */ - cg->pic = (BYTE *)g_new(WORD, (pms->pmsXW + 10) * (pms->pmsYW + 10)); + cg->pic = (BYTE *)malloc(sizeof(WORD) * ((pms->pmsXW + 10) * (pms->pmsYW + 10))); extract_16bit(pms, (WORD *)cg->pic, data + pms->pmsDp); cg->alpha = NULL; if (pms->pmsPp != 0) { - cg->alpha = g_new(BYTE, (pms->pmsXW + 10) * (pms->pmsYW + 10)); + cg->alpha = malloc(sizeof(BYTE) * ((pms->pmsXW + 10) * (pms->pmsYW + 10))); extract_8bit(pms, cg->alpha, data + pms->pmsPp); } @@ -294,7 +294,7 @@ cgdata *pms64k_extract(BYTE *data) { cg->height = pms->pmsYW; cg->pal = NULL; - g_free(pms); + free(pms); return cg; } @@ -305,17 +305,17 @@ cgdata *pms64k_extract(BYTE *data) { * return: extracted pallet data */ cgdata *pms_getpal(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); pms_header *pms = extract_header(data); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + pms->pmsPp); cg->type = ALCG_PMS8; cg->pic = NULL; cg->alpha = NULL; - g_free(pms); + free(pms); return cg; } diff --git a/src/profile.c b/src/profile.c index 44335d9..537b520 100644 --- a/src/profile.c +++ b/src/profile.c @@ -26,9 +26,9 @@ #include #include #include -#include #include +#include "portab.h" #include "profile.h" static char **profile_name = NULL, **profile_value = NULL; @@ -63,10 +63,10 @@ int load_profile(char *path) if (!fp) { /* CWD からも見つからなかったら、エラーを表示して終了 */ char *error_msg; - error_msg = g_malloc(strlen(profile_path) + 12); + error_msg = malloc(strlen(profile_path) + 12); sprintf(error_msg, "fopen() '%s'", profile_path); perror(error_msg); - g_free(error_msg); + free(error_msg); return 1; } } @@ -127,9 +127,9 @@ int load_profile(char *path) return 1; } - *(profile_name + now_values) = g_malloc(strlen(rc_line) + 1); + *(profile_name + now_values) = malloc(strlen(rc_line) + 1); strcpy(*(profile_name + now_values), rc_line); - *(profile_value + now_values) = g_malloc(strlen(p) + 1); + *(profile_value + now_values) = malloc(strlen(p) + 1); strcpy(*(profile_value + now_values), p); now_values++; } diff --git a/src/qnt.c b/src/qnt.c index ed26c81..7856c81 100644 --- a/src/qnt.c +++ b/src/qnt.c @@ -31,7 +31,7 @@ */ /* $Id: qnt.c,v 1.4 2003/04/22 16:34:28 chikama Exp $ */ -#include +#include #include #include "portab.h" @@ -62,7 +62,7 @@ static void extract_alpha(qnt_header *qnt, BYTE *pic, BYTE *b); return: acquired qnt information object */ static qnt_header *extract_header(BYTE *b) { - qnt_header *qnt = g_new(qnt_header, 1); + qnt_header *qnt = malloc(sizeof(qnt_header)); int rsv0; rsv0 = LittleEndian_getDW(b, 4); @@ -101,11 +101,11 @@ static qnt_header *extract_header(BYTE *b) { static void extract_pixel(qnt_header *qnt, BYTE *pic, BYTE *b) { int i, j, x, y, w, h; long ucbuf = (qnt->width+1) * (qnt->height+1) * 3 + ZLIBBUF_MARGIN; - BYTE *raw = g_new(BYTE, ucbuf); + BYTE *raw = malloc(sizeof(BYTE) * ucbuf); if (Z_OK != uncompress(raw, &ucbuf, b, qnt->pixel_size)) { WARNING("uncompress failed\n"); - g_free(raw); + free(raw); return; } @@ -170,7 +170,7 @@ static void extract_pixel(qnt_header *qnt, BYTE *pic, BYTE *b) { } } - g_free(raw); + free(raw); } /* @@ -183,11 +183,11 @@ static void extract_pixel(qnt_header *qnt, BYTE *pic, BYTE *b) { static void extract_alpha(qnt_header *qnt, BYTE *pic, BYTE *b) { int i, x, y, w, h; long ucbuf = (qnt->width+1) * (qnt->height+1) + ZLIBBUF_MARGIN; - BYTE *raw = g_new(BYTE, ucbuf); + BYTE *raw = malloc(sizeof(BYTE) * ucbuf); if (Z_OK != uncompress(raw, &ucbuf, b, qnt->alpha_size)) { WARNING("uncompress failed\n"); - g_free(raw); + free(raw); return; } @@ -218,7 +218,7 @@ static void extract_alpha(qnt_header *qnt, BYTE *pic, BYTE *b) { } } - g_free(raw); + free(raw); } /* @@ -241,14 +241,14 @@ boolean qnt_checkfmt(BYTE *data) { return: extracted image data and information */ cgdata *qnt_extract(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); qnt_header *qnt = extract_header(data); - cg->pic = g_new(BYTE, (qnt->width+10) * (qnt->height+10) * 3); + cg->pic = malloc(sizeof(BYTE) * ((qnt->width+10) * (qnt->height+10) * 3)); extract_pixel(qnt, cg->pic, data + qnt->hdr_size); if (qnt->alpha_size != 0) { - cg->alpha = g_new(BYTE, (qnt->width+10) * (qnt->height+10)); + cg->alpha = malloc(sizeof(BYTE) * ((qnt->width+10) * (qnt->height+10))); extract_alpha(qnt, (BYTE *)cg->alpha, data + qnt->hdr_size + qnt->pixel_size); } diff --git a/src/s39ain.c b/src/s39ain.c index b6ab421..56ca04e 100644 --- a/src/s39ain.c +++ b/src/s39ain.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "portab.h" @@ -105,7 +104,7 @@ int s39ain_init(void) { } p += 8; dllnum = LittleEndian_getDW(p, 0); - dll = g_new(S39AIN_DLLINF, dllnum); + dll = malloc(sizeof(S39AIN_DLLINF) * dllnum); p += 4; for (i = 0; i < dllnum; i++) { @@ -118,7 +117,7 @@ int s39ain_init(void) { p += 4; dll[i].function_num = fn; - dll[i].function = g_new(S39AIN_DLLFN, fn); + dll[i].function = malloc(sizeof(S39AIN_DLLFN) * fn); for (j = 0; j < fn; j++) { int argc, k; @@ -129,7 +128,7 @@ int s39ain_init(void) { p += 4; dll[i].function[j].argc = argc; - dll[i].function[j].argv = g_new(int, argc); + dll[i].function[j].argv = malloc(sizeof(int) * argc); for (k = 0; k < argc; k++) { dll[i].function[j].argv[k] = LittleEndian_getDW(p, 0); p += 4; @@ -141,7 +140,7 @@ int s39ain_init(void) { if (0 == strncmp(p, "FUNC", 4)) { fncnum = LittleEndian_getDW(p, 8); - fnc = g_new(S39AIN_FUNCNAME, fncnum); + fnc = malloc(sizeof(S39AIN_FUNCNAME) * fncnum); p += 12; for (i = 0; i < fncnum; i++) { @@ -166,7 +165,7 @@ int s39ain_init(void) { if (0 == strncmp(p, "MSGI", 4)) { msgnum = LittleEndian_getDW(p, 8); - msg = g_new(char *, msgnum); + msg = malloc(sizeof(char *) * msgnum); p += 12; for (i = 0; i < msgnum; i++) { @@ -191,8 +190,8 @@ int s39ain_init(void) { // 最初にカレントディレクトリのソースツリーの下の // モジュールを検索 - g_snprintf(searchpath, sizeof(searchpath) -1, "%s/%s", - path_to_dll, dll[i].name); + snprintf(searchpath, sizeof(searchpath) -1, "%s/%s", + path_to_dll, dll[i].name); lt_dlsetsearchpath(searchpath); diff --git a/src/s39init.c b/src/s39init.c index ba61dc0..beb64d6 100644 --- a/src/s39init.c +++ b/src/s39init.c @@ -25,7 +25,6 @@ #include #include -#include #include #include "portab.h" #include "system.h" @@ -66,14 +65,14 @@ int s39ini_init(void) { if (i >= MAXVOLCH || i < 0) continue; s1[strlen(s1)-1] = '\0'; // remove last '"' vval[i].label = sjis2lang(s1); - vval_max = MAX(vval_max, i); + vval_max = max(vval_max, i); //WARNING("VolumeValancer[%d] = %s\n", i, vval[i].label); } if (vval_max <= 0) return NG; // Volume.sav があればそれを読み込む - g_snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir); + snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir); if (NULL == (fp = fopen(fn, "r"))) { // とりあえず、初期ボリュームは 100 for (i = 0; i < MAXVOLCH; i++) { @@ -143,7 +142,7 @@ int s39ini_remove() { vol[i] = vval[i].vol; } - g_snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir); + snprintf(fn, sizeof(fn) -1, "%s/Volume.sav", nact->files.savedir); if (NULL == (fp = fopen(fn, "w"))) { WARNING("Fail to save Volume.save\n"); return NG; diff --git a/src/sdl_cursor.c b/src/sdl_cursor.c index e692fa3..68ebb5e 100644 --- a/src/sdl_cursor.c +++ b/src/sdl_cursor.c @@ -22,7 +22,6 @@ #include "config.h" -#include #include #include "portab.h" @@ -112,15 +111,15 @@ boolean sdl_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDirEn cursorImage->xormasklen = xormasklen; cursorImage->andmasklen = andmasklen; - buf1 = g_new(BYTE, xornum); - buf2 = g_new(BYTE, xornum); - buf3 = g_new(BYTE, xornum); - buf4 = g_new(BYTE, xornum); + buf1 = malloc(sizeof(BYTE) * xornum); + buf2 = malloc(sizeof(BYTE) * xornum); + buf3 = malloc(sizeof(BYTE) * xornum); + buf4 = malloc(sizeof(BYTE) * xornum); - memcpy(buf1, data, MIN(xormasklen, xornum)); + memcpy(buf1, data, min(xormasklen, xornum)); data += xormasklen; - memcpy(buf2, data, MIN(andmasklen, xornum)); + memcpy(buf2, data, min(andmasklen, xornum)); data += andmasklen; #define height cursordirentry->bHeight @@ -136,10 +135,10 @@ boolean sdl_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDirEn cursor[no] = SDL_CreateCursor(buf3, buf4, 32, 32, cursordirentry->wxHotspot, cursordirentry->wyHotspot); - g_free(buf1); - g_free(buf2); - g_free(buf3); - g_free(buf4); + free(buf1); + free(buf2); + free(buf3); + free(buf4); #undef height #undef width diff --git a/src/sdl_draw.c b/src/sdl_draw.c index 6155d1e..218eac6 100644 --- a/src/sdl_draw.c +++ b/src/sdl_draw.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -262,7 +261,7 @@ void sdl_drawLine(int x1, int y1, int x2, int y2, u_long cl) { } static agsurface_t* surface2com(SDL_Surface *src) { - agsurface_t *dst = g_new(agsurface_t, 1); + agsurface_t *dst = malloc(sizeof(agsurface_t)); dst->depth = src->format->BitsPerPixel; dst->bytes_per_pixel = src->format->BytesPerPixel; @@ -434,8 +433,8 @@ static void fader_in(int n) { if (n == 255) { SDL_FreeSurface(s_fader); sdl_updateAll(); - g_free(work); - g_free(disp); + free(work); + free(disp); return; } @@ -458,7 +457,7 @@ static void fader_out(int n,Uint32 c) { if (n == 255) { SDL_FillRect(sdl_display, NULL, c); - g_free(disp); + free(disp); return; } diff --git a/src/sdl_image.c b/src/sdl_image.c index c2f0295..292f37a 100644 --- a/src/sdl_image.c +++ b/src/sdl_image.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -66,10 +65,10 @@ void sdl_scaledCopyArea(SDL_Surface *src, SDL_Surface *dst, int sx, int sy, int a1 = (float)sw / (float)dw; a2 = (float)sh / (float)dh; // src width と dst width が同じときに問題があるので+1 - row = g_new0(int, dw+1); + row = calloc(dw+1, sizeof(int)); // 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる // 可能性がある。 - col = g_new0(int, dh+1); + col = calloc(dh+1, sizeof(int)); if(mirror & 1){ /*上下反転 added by tajiri@wizard*/ @@ -141,8 +140,8 @@ void sdl_scaledCopyArea(SDL_Surface *src, SDL_Surface *dst, int sx, int sy, int SDL_FreeSurface(ss); - g_free(row); - g_free(col); + free(row); + free(col); } void sdl_zoom(int x, int y, int w, int h) { diff --git a/src/sdl_video.c b/src/sdl_video.c index cc4e97b..b0376dd 100644 --- a/src/sdl_video.c +++ b/src/sdl_video.c @@ -24,7 +24,6 @@ #include #include -#include #include "portab.h" #include "system.h" @@ -45,7 +44,7 @@ boolean RawKeyInfo[256]; /* SDL の初期化 */ int sdl_Initilize(void) { - sdl_videodev = g_new0(struct sdl_private_data, 1); + sdl_videodev = calloc(1, sizeof(struct sdl_private_data)); /* make topleve window */ window_init(); @@ -136,10 +135,10 @@ static void makeDIB(int width, int height, int depth) { } if (sdl_dibinfo) { - g_free(sdl_dibinfo); + free(sdl_dibinfo); } - sdl_dibinfo = g_new0(agsurface_t, 1); + sdl_dibinfo = calloc(1, sizeof(agsurface_t)); sdl_dibinfo->depth = sdl_dib->format->BitsPerPixel; sdl_dibinfo->bytes_per_pixel = sdl_dib->format->BytesPerPixel; sdl_dibinfo->bytes_per_line = sdl_dib->pitch; diff --git a/src/sndcnv.c b/src/sndcnv.c index dbbb4ac..4cff2aa 100644 --- a/src/sndcnv.c +++ b/src/sndcnv.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include "portab.h" #include "music_pcm.h" @@ -48,7 +49,7 @@ int sndcnv_prepare(pcmobj_t *pcm, int outlen) { pcm->conv.convert = sndcnv_norateconvert; } - pcm->conv.buf = g_malloc(outlen); + pcm->conv.buf = malloc(outlen); pcm->conv.isample = (outlen * (pcm->fmt.bit/8) * pcm->fmt.ch * pcm->fmt.rate) / ((prv.ofmt.bit/8) * prv.ofmt.ch * prv.ofmt.rate); @@ -74,16 +75,16 @@ static int sndcnv_norateconvert(pcmobj_t *pcm, int lv, int outlen) { return len; } - ibuf = g_malloc(outlen*2); + ibuf = malloc(outlen*2); len = pcm->src->read(pcm->src, ibuf, 1, pcm->conv.isample); if (len == 0) { - g_free(ibuf); + free(ibuf); return 0; } - buf0 = g_malloc(outlen*2); + buf0 = malloc(outlen*2); // 8bit -> 16bit switch(pcm->fmt.bit) { @@ -107,8 +108,8 @@ static int sndcnv_norateconvert(pcmobj_t *pcm, int lv, int outlen) { default: isample = 0; printf("no supported\n"); - g_free(ibuf); - g_free(buf0); + free(ibuf); + free(buf0); return 0; } @@ -141,8 +142,8 @@ static int sndcnv_norateconvert(pcmobj_t *pcm, int lv, int outlen) { isample *= 2; } - g_free(buf0); - g_free(ibuf); + free(buf0); + free(ibuf); return isample; } @@ -154,21 +155,21 @@ static int sndcnv_convert(pcmobj_t *pcm, int lv, int outlen) { LONG isample = 0, osample = 0; LONG osampler = LONG_MAX, osamplel = LONG_MAX; - ibuf = g_malloc(outlen*2); + ibuf = malloc(outlen*2); // printf("pcm->src = %p, sample = %d, outlen = %d\n", pcm->src, pcm->conv.isample, outlen); len = pcm->src->read(pcm->src, ibuf, 1, pcm->conv.isample); if (len == 0) { - g_free(ibuf); + free(ibuf); return 0; } - buf0 = g_malloc(outlen*2); - bufr = g_malloc(outlen*2); - bufl = g_malloc(outlen*2); - bufrw = g_malloc(outlen*2); - buflw = g_malloc(outlen*2); + buf0 = malloc(outlen*2); + bufr = malloc(outlen*2); + bufl = malloc(outlen*2); + bufrw = malloc(outlen*2); + buflw = malloc(outlen*2); // 8|16 bit -> LONG 変換 switch(pcm->fmt.bit) { @@ -243,7 +244,7 @@ static int sndcnv_convert(pcmobj_t *pcm, int lv, int outlen) { st_rate_flow(&pcm->conv, pr, bufrw, &isample, &osampler); //printf("insample = %d, osample = %d\n", isample, osampler); } - osample = MIN(osampler, osamplel); + osample = min(osampler, osamplel); // LONG -> 16bit 変換 if (pcm->fmt.ch == 2) { @@ -286,18 +287,18 @@ static int sndcnv_convert(pcmobj_t *pcm, int lv, int outlen) { } } - g_free(buflw); - g_free(bufrw); - g_free(bufl); - g_free(bufr); - g_free(buf0); - g_free(ibuf); + free(buflw); + free(bufrw); + free(bufl); + free(bufr); + free(buf0); + free(ibuf); //printf("outlen = %d\n", osample * 4); return osample * 4; // 変換後の長さ(byte数) } int sndcnv_drain(pcmobj_t *pcm) { - g_free(pcm->conv.buf); + free(pcm->conv.buf); return OK; } diff --git a/src/sndcnv_rate.c b/src/sndcnv_rate.c index 136ea21..7cce158 100644 --- a/src/sndcnv_rate.c +++ b/src/sndcnv_rate.c @@ -23,10 +23,10 @@ */ /* $Id: sndcnv_rate.c,v 1.1 2002/08/18 09:35:29 chikama Exp $ */ -#include +#include -#define LONG gint32 -#define ULONG guint32 +#define LONG int32_t +#define ULONG uint32_t #define FRAC_BITS 16 diff --git a/src/tempname.c b/src/tempname.c index 5294ec9..8391c88 100644 --- a/src/tempname.c +++ b/src/tempname.c @@ -22,7 +22,6 @@ #if !(HAVE_MKDTEMP) -#include #include #include diff --git a/src/utfsjis.c b/src/utfsjis.c index 370323e..d5c012f 100644 --- a/src/utfsjis.c +++ b/src/utfsjis.c @@ -23,26 +23,52 @@ */ /* $Id: eucsjis.c,v 1.2 2000/09/20 10:33:16 chikama Exp $ */ +#include "config.h" #include #include #include -#include +#ifdef HAVE_ICONV +#include +#endif #include "portab.h" #include "utfsjis.h" +static char* convert(char* src, const char* tocode, const char* fromcode, int size_multiplier) { +#ifdef HAVE_ICONV + iconv_t cd = iconv_open(tocode, fromcode); + if (cd == (iconv_t)-1) + return NULL; + + size_t srclen = strlen(src); + size_t dstlen = srclen * size_multiplier + 1; + char* dst = malloc(dstlen); + char *srcp = src, *dstp = dst; + if (iconv(cd, &srcp, &srclen, &dstp, &dstlen) == (size_t)-1 || !dstlen) { + free(dst); + iconv_close(cd); + return NULL; + } + *dstp = '\0'; + iconv_close(cd); + return dst; +#else + return NULL; +#endif +} + BYTE *sjis2utf(BYTE *src) { - gchar *gbuf = g_convert_with_fallback(src, -1, "utf-8", "shift-jis", NULL, NULL, NULL, NULL); - BYTE *dst = strdup(gbuf); - g_free(gbuf); + char* dst = convert(src, "utf-8", "shift-jis", 3); + if (!dst) + dst = strdup(src); return dst; } BYTE *utf2sjis(BYTE *src) { - gchar *gbuf = g_convert_with_fallback(src, -1, "shift-jis", "utf-8", "?", NULL, NULL, NULL); - BYTE *dst = strdup(gbuf); - g_free(gbuf); + char* dst = convert(src, "shift-jis", "utf-8", 1); + if (!dst) + dst = strdup(src); return dst; } diff --git a/src/vsp.c b/src/vsp.c index 6742ccc..be2188c 100644 --- a/src/vsp.c +++ b/src/vsp.c @@ -30,7 +30,7 @@ */ /* $Id: vsp.c,v 1.6 2000/11/25 18:31:49 chikama Exp $ */ -#include +#include #include #include "portab.h" #include "LittleEndian.h" @@ -59,7 +59,7 @@ static BYTE *bp[4]; * return: acquired vsp information object */ static vsp_header *extract_header(BYTE *b) { - vsp_header *vsp = g_new(vsp_header, 1); + vsp_header *vsp = malloc(sizeof(vsp_header)); vsp->vspX0 = LittleEndian_getW(b, 0); vsp->vspY0 = LittleEndian_getW(b, 2); @@ -201,14 +201,14 @@ boolean vsp_checkfmt(BYTE *data) { * return: extracted image data and information */ cgdata *vsp_extract(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); vsp_header *vsp = extract_header(data); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + vsp->vspPp); /* +10: margin for broken cg */ - cg->pic = g_new(BYTE, (vsp->vspXW * 8 + 10) * (vsp->vspYW + 10)); + cg->pic = malloc(sizeof(BYTE) * ((vsp->vspXW * 8 + 10) * (vsp->vspYW + 10))); extract(vsp, cg->pic, data + vsp->vspDp); cg->type = ALCG_VSP; @@ -219,7 +219,7 @@ cgdata *vsp_extract(BYTE *data) { cg->vsp_bank = vsp->vspPb; cg->alpha = NULL; - g_free(vsp); + free(vsp); return cg; } @@ -230,17 +230,17 @@ cgdata *vsp_extract(BYTE *data) { * return: extracted pallet data */ cgdata *vsp_getpal(BYTE *data) { - cgdata *cg = g_new0(cgdata, 1); + cgdata *cg = calloc(1, sizeof(cgdata)); vsp_header *vsp = extract_header(data); - cg->pal = g_new(Pallet256, 1); + cg->pal = malloc(sizeof(Pallet256)); getpal(cg->pal, data + vsp->vspPp); cg->type = ALCG_VSP; cg->pic = NULL; cg->alpha = NULL; - g_free(vsp); + free(vsp); return cg; } diff --git a/src/wavfile.c b/src/wavfile.c index db8b904..c26c8d7 100644 --- a/src/wavfile.c +++ b/src/wavfile.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "portab.h" #include "system.h" @@ -167,10 +166,10 @@ static int header_check(char *wave_buf, WAVFILE *wfile) { } WAVFILE * wav_getinfo(char *data) { - WAVFILE *wfile = g_new(WAVFILE, 1); + WAVFILE *wfile = malloc(sizeof(WAVFILE)); if (NG == header_check(data, wfile)) { - g_free(wfile); + free(wfile); return NULL; } diff --git a/src/xcore_cursor.c b/src/xcore_cursor.c index fefb93c..9a32cba 100644 --- a/src/xcore_cursor.c +++ b/src/xcore_cursor.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -152,15 +151,15 @@ boolean Xcore_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDi cursorImage->andmasklen = andmasklen; - buf1 = g_new(BYTE, xornum); - buf2 = g_new(BYTE, xornum); - buf3 = g_new(BYTE, xornum); - buf4 = g_new(BYTE, xornum); + buf1 = malloc(sizeof(BYTE) * xornum); + buf2 = malloc(sizeof(BYTE) * xornum); + buf3 = malloc(sizeof(BYTE) * xornum); + buf4 = malloc(sizeof(BYTE) * xornum); - memcpy(buf1, data, MIN(xormasklen, xornum)); + memcpy(buf1, data, min(xormasklen, xornum)); data += xormasklen; - memcpy(buf2, data, MIN(andmasklen, xornum)); + memcpy(buf2, data, min(andmasklen, xornum)); data += andmasklen; #define height cursordirentry->bHeight @@ -232,10 +231,10 @@ boolean Xcore_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDi if (pixmapMaskInv) XFreePixmap( x11_display, pixmapMaskInv ); } - g_free(buf1); - g_free(buf2); - g_free(buf3); - g_free(buf4); + free(buf1); + free(buf2); + free(buf3); + free(buf4); #undef height #undef width diff --git a/src/xcore_video.c b/src/xcore_video.c index e306b4b..1e3775d 100644 --- a/src/xcore_video.c +++ b/src/xcore_video.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -74,7 +73,7 @@ static boolean noshm; int Xcore_Initilize(void) { char *display; - x11_videodev = g_new0(struct xcore_private_data, 1); + x11_videodev = calloc(1, sizeof(struct xcore_private_data)); x11_noSHM = noshm; /* locale init ( for no gtk option ) */ @@ -404,10 +403,10 @@ static void makeDIB(int w, int h, int depth) { if (alloced) { releaseDIB(); - g_free(x11_dibinfo); + free(x11_dibinfo); } - x11_dibinfo = g_new(IMAGEINFO, 1); + x11_dibinfo = malloc(sizeof(IMAGEINFO)); if (depth != 8) { depth = dib_depth_candidate; @@ -456,10 +455,10 @@ void x11_makeWorkImage(int w, int h) { if (alloced) { releaseWorkImage(); - g_free(x11_workinfo); + free(x11_workinfo); } - x11_workinfo = g_new(IMAGEINFO, 1); + x11_workinfo = malloc(sizeof(IMAGEINFO)); if (x11_noSHM || packed24bpp || diff --git a/src/xsystem35.c b/src/xsystem35.c index a843c14..4b1110b 100644 --- a/src/xsystem35.c +++ b/src/xsystem35.c @@ -855,13 +855,13 @@ int main(int argc, char **argv) { if (!rc_name) { rc_name = GTK_RC_NAME; } - rc_path = (char *)g_malloc(sizeof(char) * (strlen(homedir) + strlen(rc_name)) + 2); + rc_path = (char *)malloc(sizeof(char) * (strlen(homedir) + strlen(rc_name)) + 2); strcpy(rc_path, homedir); strcat(rc_path, "/"); strcat(rc_path, rc_name); gtk_rc_parse(rc_path); - g_free(rc_path); + free(rc_path); menu_init(); #endif