From b1ec5e1b6c948540d7d6316f5affb6d20b19af5f Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Thu, 23 Jan 2014 22:41:21 +0100 Subject: [PATCH 1/6] more warnings --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 397eecdeb..9428e7f05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,7 +332,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmms.rc.in ${CMAKE_BINARY_DIR}/lmms.rc) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc) # set compiler flags -SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow") +SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-strict-overflow") SET(CMAKE_C_FLAGS "-O2 -g ${WERROR_FLAGS} ${CMAKE_C_FLAGS}") SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS_DEBUG "-DLMMS_DEBUG") From 3f417596771b40ec32e7aead18be651ada41c464 Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Sat, 25 Jan 2014 20:39:57 +0100 Subject: [PATCH 2/6] gitignore updated --- .gitignore | 174 ++++++++++++ plugins/zynaddsubfx/fltk/fltk-config | 388 --------------------------- 2 files changed, 174 insertions(+), 388 deletions(-) delete mode 100755 plugins/zynaddsubfx/fltk/fltk-config diff --git a/.gitignore b/.gitignore index 113a4c133..fe25a45d8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,177 @@ .*.sw? *~ /CMakeLists.txt.user +.vimrc +*.so +*.a +*.cxx +*.cmake +*Makefile +*CMakeFiles +*CMakeCache.txt + +# autogenerated files +bin2res +embedded_resources.h +install_manifest.txt +lmms +lmms.1.gz +lmms.rc +lmmsconfig.h +lmmsversion.h +plugins/audio_file_processor/embedded_resources.h +plugins/bass_booster/embedded_resources.h +plugins/bit_invader/embedded_resources.h +plugins/kicker/embedded_resources.h +plugins/ladspa_browser/embedded_resources.h +plugins/ladspa_effect/embedded_resources.h +plugins/lb302/embedded_resources.h +plugins/opl2/embedded_resources.h +plugins/organic/embedded_resources.h +plugins/papu/embedded_resources.h +plugins/patman/embedded_resources.h +plugins/peak_controller_effect/embedded_resources.h +plugins/sf2_player/embedded_resources.h +plugins/sf2_player/ui_patches_dialog.h +plugins/sid/embedded_resources.h +plugins/spectrum_analyzer/embedded_resources.h +plugins/stereo_enhancer/embedded_resources.h +plugins/stereo_matrix/embedded_resources.h +plugins/stk/mallets/embedded_resources.h +plugins/triple_oscillator/embedded_resources.h +plugins/vestige/embedded_resources.h +plugins/vibed/embedded_resources.h +plugins/vst_base/RemoteVstPlugin +plugins/vst_effect/embedded_resources.h +plugins/zynaddsubfx/RemoteZynAddSubFx +plugins/zynaddsubfx/embedded_resources.h +plugins/zynaddsubfx/fltk/FL/Enumerations.h +plugins/zynaddsubfx/fltk/FL/Fl.h +plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.h +plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.h +plugins/zynaddsubfx/fltk/FL/Fl_Box.h +plugins/zynaddsubfx/fltk/FL/Fl_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_Browser_.h +plugins/zynaddsubfx/fltk/FL/Fl_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Chart.h +plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Choice.h +plugins/zynaddsubfx/fltk/FL/Fl_Clock.h +plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.h +plugins/zynaddsubfx/fltk/FL/Fl_Counter.h +plugins/zynaddsubfx/fltk/FL/Fl_Device.h +plugins/zynaddsubfx/fltk/FL/Fl_Dial.h +plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.h +plugins/zynaddsubfx/fltk/FL/Fl_Export.h +plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.h +plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.h +plugins/zynaddsubfx/fltk/FL/Fl_File_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.h +plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.h +plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.h +plugins/zynaddsubfx/fltk/FL/Fl_Free.h +plugins/zynaddsubfx/fltk/FL/Fl_Group.h +plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.h +plugins/zynaddsubfx/fltk/FL/Fl_Help_View.h +plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Image.h +plugins/zynaddsubfx/fltk/FL/Fl_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Input_.h +plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.h +plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu_.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.h +plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.h +plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.h +plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.h +plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.h +plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Object.h +plugins/zynaddsubfx/fltk/FL/Fl_Output.h +plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.h +plugins/zynaddsubfx/fltk/FL/Fl_Pack.h +plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.h +plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.h +plugins/zynaddsubfx/fltk/FL/Fl_Plugin.h +plugins/zynaddsubfx/fltk/FL/Fl_Positioner.h +plugins/zynaddsubfx/fltk/FL/Fl_PostScript.h +plugins/zynaddsubfx/fltk/FL/Fl_Preferences.h +plugins/zynaddsubfx/fltk/FL/Fl_Printer.h +plugins/zynaddsubfx/fltk/FL/Fl_Progress.h +plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.h +plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Roller.h +plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.h +plugins/zynaddsubfx/fltk/FL/Fl_Scroll.h +plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.h +plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.h +plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.h +plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.h +plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.h +plugins/zynaddsubfx/fltk/FL/Fl_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Spinner.h +plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.h +plugins/zynaddsubfx/fltk/FL/Fl_Table.h +plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.h +plugins/zynaddsubfx/fltk/FL/Fl_Tabs.h +plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.h +plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.h +plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.h +plugins/zynaddsubfx/fltk/FL/Fl_Tile.h +plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.h +plugins/zynaddsubfx/fltk/FL/Fl_Timer.h +plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.h +plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.h +plugins/zynaddsubfx/fltk/FL/Fl_Tree.h +plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.h +plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.h +plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.h +plugins/zynaddsubfx/fltk/FL/Fl_Valuator.h +plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.h +plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.h +plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.h +plugins/zynaddsubfx/fltk/FL/Fl_Widget.h +plugins/zynaddsubfx/fltk/FL/Fl_Window.h +plugins/zynaddsubfx/fltk/FL/Fl_Wizard.h +plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.h +plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.h +plugins/zynaddsubfx/fltk/FL/filename.h +plugins/zynaddsubfx/fltk/FL/fl_ask.h +plugins/zynaddsubfx/fltk/FL/fl_draw.h +plugins/zynaddsubfx/fltk/FL/fl_message.h +plugins/zynaddsubfx/fltk/FL/fl_show_colormap.h +plugins/zynaddsubfx/fltk/FL/fl_show_input.h +plugins/zynaddsubfx/fltk/FL/mac.h +plugins/zynaddsubfx/fltk/FL/win32.h +plugins/zynaddsubfx/fltk/FL/x.h +plugins/zynaddsubfx/fltk/Fl +plugins/zynaddsubfx/fltk/config.h +plugins/zynaddsubfx/fltk/fltk-config +plugins/zynaddsubfx/zynaddsubfx.rc +ui_EffectSelectDialog.h +ui_about_dialog.h +ui_export_project.h + diff --git a/plugins/zynaddsubfx/fltk/fltk-config b/plugins/zynaddsubfx/fltk/fltk-config deleted file mode 100755 index 97ed9a514..000000000 --- a/plugins/zynaddsubfx/fltk/fltk-config +++ /dev/null @@ -1,388 +0,0 @@ -#!/bin/sh -# -# "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $" -# -# FLTK configuration utility. -# -# Copyright 2000-2009 by Bill Spitzak and others. -# Original version Copyright 2000 by James Dean Palmer -# Adapted by Vincent Penne and Michael Sweet -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# Please report all bugs and problems on the following page: -# -# http://www.fltk.org/str.php -# - -MAJOR_VERSION=1 -MINOR_VERSION=3 -PATCH_VERSION=0 -VERSION=1.3.0 -APIVERSION=1.3 - -### BEGIN fltk-config -selfdir=`dirname "$0"` - -prefix=/usr/local -exec_prefix= -exec_prefix_set=no -bindir=/usr/local/bin -includedir= -libdir=/usr/local/lib -srcdir=. - -# compiler names -CC="gcc" -CXX="c++" - -# flags for C++ compiler: -ARCHFLAGS="" -CFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" -CXXFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" -LDFLAGS="" -LDLIBS="-lX11 -lpthread -lXinerama -lXft -lXext" -OPTIM="" -CAIROFLAGS="" - -# Check for local invocation, and update paths accordingly... -if test -f "$selfdir/FL/Fl_Window.H"; then - bindir="$selfdir/fluid" - includedir="$selfdir" - libdir="$selfdir/lib" - - if test -f "$libdir/libfltk_jpeg.a"; then - CFLAGS="-I$includedir/jpeg $CFLAGS" - CXXFLAGS="-I$includedir/jpeg $CXXFLAGS" - fi - - if test -f "$libdir/libfltk_z.a"; then - CFLAGS="-I$includedir/zlib $CFLAGS" - CXXFLAGS="-I$includedir/zlib $CXXFLAGS" - fi - - if test -f "$libdir/libfltk_png.a"; then - CFLAGS="-I$includedir/png $CFLAGS" - CXXFLAGS="-I$includedir/png $CXXFLAGS" - fi -fi - -if test -d $includedir/FL/images; then - CFLAGS="-I$includedir/FL/images $CFLAGS" - CXXFLAGS="-I$includedir/FL/images $CXXFLAGS" -fi - -if test -f "$libdir/libfltk_cairo.a"; then - CFLAGS="$CAIROFLAGS $CFLAGS" - CXXFLAGS="$CAIROFLAGS $CXXFLAGS" -fi - -# libraries to link with: -LIBNAME="" -DSONAME="" -DSOLINK="" -IMAGELIBS="" -STATICIMAGELIBS="" -CAIROLIBS="" -SHAREDSUFFIX="" - -usage () -{ - echo "Usage: fltk-config [OPTIONS] -Options: - [--version] - [--api-version] - -Options telling what we are doing: - [--use-gl] use GL - [--use-images] use extra image formats (PNG, JPEG) - [--use-glut] use glut compatibility layer - [--use-forms] use forms compatibility layer - [--use-cairo] use cairo graphics lib - -Options telling what information we request: - [--cc] return C compiler used to compile FLTK - [--cxx] return C++ compiler used to compile FLTK - [--optim] return compiler optimization used to compile FLTK - [--cflags] return flags to compile C using FLTK - [--cxxflags] return flags to compile C++ using FLTK - [--ldflags] return flags to link against FLTK - [--ldstaticflags] return flags to link against static FLTK library - even if there are DSOs installed - [--libs] return FLTK libraries full path for dependencies - -Options to compile and link an application: - [-g] compile the program with debugging information - [-Dname[=value]] compile the program with the given define - [--compile program.cxx] - [--post program] prepare the program for desktop use -" - exit $1 -} - -if test $# -eq 0; then - usage 1 -fi - -no_plugins=no -compile= -post= -debug= - -# Parse command line options -while test $# -gt 0 -do - case "$1" in - -*=*) - optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` - ;; - *) - optarg= - ;; - esac - - case $1 in - --version) - echo $VERSION - ;; - --api-version) - echo $APIVERSION - ;; - --cc) - echo $CC - ;; - --cxx) - echo $CXX - ;; - --optim) - echo_optim=yes - ;; - --use-gl | --use-glut) - use_gl=yes - ;; - --use-forms) - use_forms=yes - ;; - --use-images) - use_images=yes - ;; - --use-cairo) - use_cairo=yes - ;; - --cflags) - echo_cflags=yes - ;; - --cxxflags) - echo_cxxflags=yes - ;; - --ldflags) - echo_ldflags=yes - ;; - --ldstaticflags) - echo_ldstaticflags=yes - ;; - --libs) - echo_libs=yes - ;; - -g) - debug=-g - ;; - -D*) - CXXFLAGS="$CXXFLAGS $1" - ;; - --compile) - compile="$2" - shift - ;; - --post) - post="$2" - shift - ;; - *) - echo_help=yes - ;; - esac - shift -done - -if test "$includedir" != /usr/include; then - includes=-I$includedir -else - includes= -fi - -if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then - libs=-L$libdir -else - libs= -fi - -# Calculate needed libraries -LDSTATIC="$libdir/libfltk.a $LDLIBS" -LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS" - -if test x$use_forms = xyes; then - LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS" - LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC" -fi -if test x$use_gl = xyes; then - LDLIBS="-lfltk_gl$SHAREDSUFFIX $LDLIBS" - LDSTATIC="$libdir/libfltk_gl.a $LDSTATIC" -fi -if test x$use_images = xyes; then - LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS" - LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC" -fi - -if test x$use_cairo = xyes; then - LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS" - LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC" -fi - -LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS" -LDSTATIC="$LDFLAGS $LDSTATIC" - -# Answer to user requests -if test -n "$echo_help"; then - usage 1 -fi - -if test -n "$compile"; then - case "$compile" in - *.cxx) - prog="`basename \"$compile\" .cxx`" - ;; - *.cpp) - prog="`basename \"$compile\" .cpp`" - ;; - *.cc) - prog="`basename \"$compile\" .cc`" - ;; - *.C) - prog="`basename \"$compile\" .C`" - ;; - *) - echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!" - exit 1 - ;; - esac - - post="$prog" - - echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC - $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1 -fi - -if test -n "$post"; then - case "`uname`" in - Darwin) - echo Creating "'$post.app'" bundle for desktop... - id=`echo $post | tr ' ' '_'` - - # Make the bundle directory and move the executable there - rm -rf "$post.app/Contents/MacOS" - mkdir -p "$post.app/Contents/MacOS" - mv "$post" "$post.app/Contents/MacOS" - - # Make a shell script that runs the bundled executable - echo "#!/bin/sh" >"$post" - echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post" - echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post" - chmod +x "$post" - - # Make the simplest Info.plist needed for an application - cat >"$post.app/Contents/Info.plist" < - - - CFBundleInfoDictionaryVersion - 6.0 - CFBundleExecutable - $post - CFBundleIdentifier - org.fltk.$id - CFBundleName - $post - CFBundlePackageType - APPL - - -EOF - ;; - esac -fi - -if test "$echo_cflags" = "yes"; then - echo $includes $CFLAGS -fi - -if test "$echo_cxxflags" = "yes"; then - echo $includes $CXXFLAGS -fi - -if test "$echo_optim" = "yes"; then - echo $OPTIM -fi - -if test "$echo_ldflags" = "yes"; then - my_libs= - libdirs=$libs - - for i in $LDLIBS ; do - if test $i != -L$libdir ; then - if test -z "$my_libs" ; then - my_libs="$i" - else - my_libs="$my_libs $i" - fi - fi - done - echo $libdirs $my_libs -fi - -if test "$echo_ldstaticflags" = "yes"; then - echo $LDSTATIC -fi - -if test "$echo_libs" = "yes"; then - echo $libdir/libfltk.a - - if test x$use_forms = xyes; then - echo $libdir/libfltk_forms.a - fi - - if test x$use_gl = xyes; then - echo $libdir/libfltk_gl.a - fi - - if test x$use_cairo = xyes; then - echo $libdir/libfltk_cairo.a - fi - - if test x$use_images = xyes; then - echo $libdir/libfltk_images.a - - for lib in fltk_jpeg fltk_png fltk_z; do - if test -f $libdir/lib$lib.a; then - echo $libdir/lib$lib.a - fi - done - fi -fi - -# -# End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $". -# From 592adf19e1aaf6eb4a2bd1fdaa26b6dbcebdb2e5 Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Sat, 25 Jan 2014 21:01:55 +0100 Subject: [PATCH 3/6] fixed some errors from static analyzer --- plugins/ladspa_effect/calf/src/utils.cpp | 9 +- plugins/ladspa_effect/swh/alias_1407.c | 4 +- plugins/ladspa_effect/swh/allpass_1895.c | 12 +- plugins/ladspa_effect/tap/tap_rotspeak.c | 154 +++++++++++++++++------ plugins/ladspa_effect/tap/tap_vibrato.c | 13 +- src/core/audio/AudioFileOgg.cpp | 6 +- 6 files changed, 140 insertions(+), 58 deletions(-) diff --git a/plugins/ladspa_effect/calf/src/utils.cpp b/plugins/ladspa_effect/calf/src/utils.cpp index d661c914f..c1c3eaff2 100644 --- a/plugins/ladspa_effect/calf/src/utils.cpp +++ b/plugins/ladspa_effect/calf/src/utils.cpp @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU Lesser General * Public License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include @@ -85,13 +85,14 @@ std::string load_file(const std::string &src) while(!feof(f)) { char buffer[1024]; - int len = fread(buffer, 1, sizeof(buffer), f); + size_t len = fread(buffer, 1, sizeof(buffer), f); #if 0 if (len < 0) throw file_exception(src); #endif str += string(buffer, len); } + fclose(f); return str; } @@ -99,7 +100,7 @@ std::string i2s(int value) { char buf[32]; sprintf(buf, "%d", value); - + return std::string(buf); } @@ -140,7 +141,7 @@ file_exception::file_exception(const std::string &f) : message(strerror(errno)) , filename(f) , container(filename + ":" + message) -{ +{ text = container.c_str(); } diff --git a/plugins/ladspa_effect/swh/alias_1407.c b/plugins/ladspa_effect/swh/alias_1407.c index 03a05f7fd..cbc0fdd50 100644 --- a/plugins/ladspa_effect/swh/alias_1407.c +++ b/plugins/ladspa_effect/swh/alias_1407.c @@ -19,10 +19,10 @@ #ifdef WIN32 #define _WINDOWS_DLL_EXPORT_ __declspec(dllexport) -int bIsFirstTime = 1; +int bIsFirstTime = 1; void _init(); // forward declaration #else -#define _WINDOWS_DLL_EXPORT_ +#define _WINDOWS_DLL_EXPORT_ #endif diff --git a/plugins/ladspa_effect/swh/allpass_1895.c b/plugins/ladspa_effect/swh/allpass_1895.c index 21b4a3fc0..192684794 100644 --- a/plugins/ladspa_effect/swh/allpass_1895.c +++ b/plugins/ladspa_effect/swh/allpass_1895.c @@ -19,10 +19,10 @@ #ifdef WIN32 #define _WINDOWS_DLL_EXPORT_ __declspec(dllexport) -int bIsFirstTime = 1; +int bIsFirstTime = 1; void _init(); // forward declaration #else -#define _WINDOWS_DLL_EXPORT_ +#define _WINDOWS_DLL_EXPORT_ #endif #include "ladspa-util.h" @@ -154,17 +154,17 @@ static void activateAllpass_n(LADSPA_Handle instance) { unsigned int sample_rate = plugin_data->sample_rate; long write_phase = plugin_data->write_phase; unsigned int minsize, size; - + if (plugin_data->max_delay && *plugin_data->max_delay > 0) minsize = sample_rate * *plugin_data->max_delay; else if (plugin_data->delay_time) minsize = sample_rate * *plugin_data->delay_time; else minsize = sample_rate; /* 1 second default */ - + size = 1; while (size < minsize) size <<= 1; - + /* calloc sets the buffer to zero. */ buffer = calloc(size, sizeof(LADSPA_Data)); if (buffer) @@ -286,7 +286,7 @@ static void runAllpass_n(LADSPA_Handle instance, unsigned long sample_count) { plugin_data->delay_samples = delay_samples = CALC_DELAY (delay_time); plugin_data->feedback = feedback = calc_feedback (delay_time, decay_time); } - + if (delay_time == last_delay_time) { long read_phase = write_phase - (long)delay_samples; LADSPA_Data *readptr = buffer + (read_phase & buffer_mask); diff --git a/plugins/ladspa_effect/tap/tap_rotspeak.c b/plugins/ladspa_effect/tap/tap_rotspeak.c index aa86f1ea9..5b60b1b42 100644 --- a/plugins/ladspa_effect/tap/tap_rotspeak.c +++ b/plugins/ladspa_effect/tap/tap_rotspeak.c @@ -118,55 +118,131 @@ typedef struct { /* Construct a new plugin instance. */ -LADSPA_Handle +LADSPA_Handle instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, unsigned long sample_rate) { - - LADSPA_Handle * ptr; - - if ((ptr = malloc(sizeof(RotSpkr))) != NULL) { - ((RotSpkr *)ptr)->sample_rate = sample_rate; - ((RotSpkr *)ptr)->run_adding_gain = 1.0; - if ((((RotSpkr *)ptr)->ringbuffer_h_L = + LADSPA_Handle * ptr; + + if ((ptr = malloc(sizeof(RotSpkr))) != NULL) { + RotSpkr* rotSpeak = (RotSpkr*)ptr; + rotSpeak->sample_rate = sample_rate; + rotSpeak->run_adding_gain = 1.0; + + if ((rotSpeak->ringbuffer_h_L = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(ptr); return NULL; + } if ((((RotSpkr *)ptr)->ringbuffer_h_R = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(ptr); return NULL; - ((RotSpkr *)ptr)->buflen_h_L = ceil(0.3f * sample_rate / M_PI); - ((RotSpkr *)ptr)->buflen_h_R = ceil(0.3f * sample_rate / M_PI); - ((RotSpkr *)ptr)->pos_h_L = 0; - ((RotSpkr *)ptr)->pos_h_R = 0; + } + rotSpeak->buflen_h_L = ceil(0.3f * sample_rate / M_PI); + rotSpeak->buflen_h_R = ceil(0.3f * sample_rate / M_PI); + rotSpeak->pos_h_L = 0; + rotSpeak->pos_h_R = 0; - if ((((RotSpkr *)ptr)->ringbuffer_b_L = + if ((rotSpeak->ringbuffer_b_L = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(ptr); return NULL; - if ((((RotSpkr *)ptr)->ringbuffer_b_R = + } + if ((rotSpeak->ringbuffer_b_R = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(ptr); return NULL; - ((RotSpkr *)ptr)->buflen_b_L = ceil(0.3f * sample_rate / M_PI); - ((RotSpkr *)ptr)->buflen_b_R = ceil(0.3f * sample_rate / M_PI); - ((RotSpkr *)ptr)->pos_b_L = 0; - ((RotSpkr *)ptr)->pos_b_R = 0; + } + rotSpeak->buflen_b_L = ceil(0.3f * sample_rate / M_PI); + rotSpeak->buflen_b_R = ceil(0.3f * sample_rate / M_PI); + rotSpeak->pos_b_L = 0; + rotSpeak->pos_b_R = 0; + + if ((rotSpeak->eq_filter_L = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(ptr); + return NULL; + } + if ((rotSpeak->lp_filter_L = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(ptr); + return NULL; + } + if ((rotSpeak->hp_filter_L = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(ptr); + return NULL; + } + + if ((rotSpeak->eq_filter_R = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(ptr); + return NULL; + } + if ((rotSpeak->lp_filter_R = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(rotSpeak->eq_filter_R); + free(ptr); + return NULL; + } + if ((rotSpeak->hp_filter_R = calloc(1, sizeof(biquad))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(rotSpeak->eq_filter_R); + free(rotSpeak->lp_filter_R); + free(ptr); + return NULL; + } - if ((((RotSpkr *)ptr)->eq_filter_L = calloc(1, sizeof(biquad))) == NULL) - return NULL; - if ((((RotSpkr *)ptr)->lp_filter_L = calloc(1, sizeof(biquad))) == NULL) - return NULL; - if ((((RotSpkr *)ptr)->hp_filter_L = calloc(1, sizeof(biquad))) == NULL) - return NULL; - - if ((((RotSpkr *)ptr)->eq_filter_R = calloc(1, sizeof(biquad))) == NULL) - return NULL; - if ((((RotSpkr *)ptr)->lp_filter_R = calloc(1, sizeof(biquad))) == NULL) - return NULL; - if ((((RotSpkr *)ptr)->hp_filter_R = calloc(1, sizeof(biquad))) == NULL) - return NULL; - return ptr; } - + return NULL; } @@ -206,13 +282,13 @@ activate_RotSpkr(LADSPA_Handle Instance) { /* Connect a port to a data location. */ -void +void connect_port_RotSpkr(LADSPA_Handle Instance, unsigned long Port, LADSPA_Data * DataLocation) { - + RotSpkr * ptr; - + ptr = (RotSpkr *)Instance; switch (Port) { case HORNFREQ: @@ -229,7 +305,7 @@ connect_port_RotSpkr(LADSPA_Handle Instance, break; case LATENCY: ptr->latency = DataLocation; - *(ptr->latency) = ptr->buflen_h_L / 2; /* IS THIS LEGAL? */ + *(ptr->latency) = ptr->buflen_h_L / 2; /* IS THIS LEGAL? YES, ONLY IF DataLocation points to valid memory location on stack/heap*/ break; case INPUT_L: ptr->input_L = DataLocation; @@ -248,10 +324,10 @@ connect_port_RotSpkr(LADSPA_Handle Instance, -void +void run_RotSpkr(LADSPA_Handle Instance, unsigned long SampleCount) { - + RotSpkr * ptr = (RotSpkr *)Instance; LADSPA_Data * input_L = ptr->input_L; diff --git a/plugins/ladspa_effect/tap/tap_vibrato.c b/plugins/ladspa_effect/tap/tap_vibrato.c index c518116d2..6b9cc21ff 100644 --- a/plugins/ladspa_effect/tap/tap_vibrato.c +++ b/plugins/ladspa_effect/tap/tap_vibrato.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- Copyright (C) 2004 Tom Szilagyi - + 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 @@ -85,19 +85,22 @@ typedef struct { /* Construct a new plugin instance. */ -LADSPA_Handle +LADSPA_Handle instantiate_Vibrato(const LADSPA_Descriptor * Descriptor, unsigned long sample_rate) { - + LADSPA_Handle * ptr; - + if ((ptr = malloc(sizeof(Vibrato))) != NULL) { ((Vibrato *)ptr)->sample_rate = sample_rate; ((Vibrato *)ptr)->run_adding_gain = 1.0f; - if ((((Vibrato *)ptr)->ringbuffer = + if ((((Vibrato *)ptr)->ringbuffer = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(ptr); return NULL; + } ((Vibrato *)ptr)->buflen = ceil(0.2f * sample_rate / M_PI); ((Vibrato *)ptr)->pos = 0; diff --git a/src/core/audio/AudioFileOgg.cpp b/src/core/audio/AudioFileOgg.cpp index 24148bc26..8e09d0a9d 100644 --- a/src/core/audio/AudioFileOgg.cpp +++ b/src/core/audio/AudioFileOgg.cpp @@ -122,7 +122,7 @@ bool AudioFileOgg::startEncoding() vorbis_info_clear( &m_vi ); return false; } - + if( useVBR() == false ) { vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_AVG, NULL ); @@ -132,7 +132,7 @@ bool AudioFileOgg::startEncoding() // Turn off management entirely (if it was turned on). vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_SET, NULL ); } - + vorbis_encode_setup_init( &m_vi ); // Now, set up the analysis engine, stream encoder, and other @@ -171,10 +171,12 @@ bool AudioFileOgg::startEncoding() { // clean up finishEncoding(); + delete[] user_comments; return false; } } + delete[] user_comments; return true; } From 3dad5f2940516023a6459f22028c55a9a5742949 Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Sat, 25 Jan 2014 21:27:28 +0100 Subject: [PATCH 4/6] fixed code formatting --- plugins/ladspa_effect/tap/tap_rotspeak.c | 204 +++++++++++------------ plugins/ladspa_effect/tap/tap_vibrato.c | 8 +- src/core/audio/AudioFileOgg.cpp | 4 +- 3 files changed, 108 insertions(+), 108 deletions(-) diff --git a/plugins/ladspa_effect/tap/tap_rotspeak.c b/plugins/ladspa_effect/tap/tap_rotspeak.c index 5b60b1b42..7aa09d648 100644 --- a/plugins/ladspa_effect/tap/tap_rotspeak.c +++ b/plugins/ladspa_effect/tap/tap_rotspeak.c @@ -125,120 +125,120 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, LADSPA_Handle * ptr; if ((ptr = malloc(sizeof(RotSpkr))) != NULL) { - RotSpkr* rotSpeak = (RotSpkr*)ptr; + RotSpkr* rotSpeak = (RotSpkr*)ptr; rotSpeak->sample_rate = sample_rate; rotSpeak->run_adding_gain = 1.0; - if ((rotSpeak->ringbuffer_h_L = - calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) - { - free(ptr); - return NULL; - } - if ((((RotSpkr *)ptr)->ringbuffer_h_R = - calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(ptr); - return NULL; - } - rotSpeak->buflen_h_L = ceil(0.3f * sample_rate / M_PI); - rotSpeak->buflen_h_R = ceil(0.3f * sample_rate / M_PI); - rotSpeak->pos_h_L = 0; - rotSpeak->pos_h_R = 0; + if ((rotSpeak->ringbuffer_h_L = + calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(ptr); + return NULL; + } + if ((((RotSpkr *)ptr)->ringbuffer_h_R = + calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(ptr); + return NULL; + } + rotSpeak->buflen_h_L = ceil(0.3f * sample_rate / M_PI); + rotSpeak->buflen_h_R = ceil(0.3f * sample_rate / M_PI); + rotSpeak->pos_h_L = 0; + rotSpeak->pos_h_R = 0; - if ((rotSpeak->ringbuffer_b_L = - calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(ptr); - return NULL; - } - if ((rotSpeak->ringbuffer_b_R = - calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(ptr); - return NULL; - } - rotSpeak->buflen_b_L = ceil(0.3f * sample_rate / M_PI); - rotSpeak->buflen_b_R = ceil(0.3f * sample_rate / M_PI); - rotSpeak->pos_b_L = 0; - rotSpeak->pos_b_R = 0; + if ((rotSpeak->ringbuffer_b_L = + calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(ptr); + return NULL; + } + if ((rotSpeak->ringbuffer_b_R = + calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(ptr); + return NULL; + } + rotSpeak->buflen_b_L = ceil(0.3f * sample_rate / M_PI); + rotSpeak->buflen_b_R = ceil(0.3f * sample_rate / M_PI); + rotSpeak->pos_b_L = 0; + rotSpeak->pos_b_R = 0; if ((rotSpeak->eq_filter_L = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(ptr); + return NULL; + } if ((rotSpeak->lp_filter_L = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(ptr); + return NULL; + } if ((rotSpeak->hp_filter_L = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(ptr); + return NULL; + } if ((rotSpeak->eq_filter_R = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(ptr); + return NULL; + } if ((rotSpeak->lp_filter_R = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(rotSpeak->eq_filter_R); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(rotSpeak->eq_filter_R); + free(ptr); + return NULL; + } if ((rotSpeak->hp_filter_R = calloc(1, sizeof(biquad))) == NULL) - { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(rotSpeak->eq_filter_R); - free(rotSpeak->lp_filter_R); - free(ptr); - return NULL; - } + { + free(rotSpeak->ringbuffer_h_L); + free(rotSpeak->ringbuffer_h_R); + free(rotSpeak->ringbuffer_b_L); + free(rotSpeak->ringbuffer_b_R); + free(rotSpeak->eq_filter_L); + free(rotSpeak->lp_filter_L); + free(rotSpeak->hp_filter_L); + free(rotSpeak->eq_filter_R); + free(rotSpeak->lp_filter_R); + free(ptr); + return NULL; +} return ptr; } diff --git a/plugins/ladspa_effect/tap/tap_vibrato.c b/plugins/ladspa_effect/tap/tap_vibrato.c index 6b9cc21ff..b7780b46a 100644 --- a/plugins/ladspa_effect/tap/tap_vibrato.c +++ b/plugins/ladspa_effect/tap/tap_vibrato.c @@ -89,7 +89,7 @@ LADSPA_Handle instantiate_Vibrato(const LADSPA_Descriptor * Descriptor, unsigned long sample_rate) { - LADSPA_Handle * ptr; + LADSPA_Handle * ptr; if ((ptr = malloc(sizeof(Vibrato))) != NULL) { ((Vibrato *)ptr)->sample_rate = sample_rate; @@ -97,10 +97,10 @@ instantiate_Vibrato(const LADSPA_Descriptor * Descriptor, if ((((Vibrato *)ptr)->ringbuffer = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) - { - free(ptr); + { + free(ptr); return NULL; - } + } ((Vibrato *)ptr)->buflen = ceil(0.2f * sample_rate / M_PI); ((Vibrato *)ptr)->pos = 0; diff --git a/src/core/audio/AudioFileOgg.cpp b/src/core/audio/AudioFileOgg.cpp index 8e09d0a9d..dbf52c5e3 100644 --- a/src/core/audio/AudioFileOgg.cpp +++ b/src/core/audio/AudioFileOgg.cpp @@ -171,12 +171,12 @@ bool AudioFileOgg::startEncoding() { // clean up finishEncoding(); - delete[] user_comments; + delete[] user_comments; return false; } } - delete[] user_comments; + delete[] user_comments; return true; } From eb8fb3134a17751e905ca351540e16e1a5a2a3c1 Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Sat, 25 Jan 2014 23:39:03 +0100 Subject: [PATCH 5/6] tap_rotspeak - cleanup --- .gitignore | 174 ----------------------- CMakeLists.txt | 2 +- plugins/ladspa_effect/tap/tap_rotspeak.c | 118 ++++++--------- 3 files changed, 46 insertions(+), 248 deletions(-) diff --git a/.gitignore b/.gitignore index fe25a45d8..113a4c133 100644 --- a/.gitignore +++ b/.gitignore @@ -2,177 +2,3 @@ .*.sw? *~ /CMakeLists.txt.user -.vimrc -*.so -*.a -*.cxx -*.cmake -*Makefile -*CMakeFiles -*CMakeCache.txt - -# autogenerated files -bin2res -embedded_resources.h -install_manifest.txt -lmms -lmms.1.gz -lmms.rc -lmmsconfig.h -lmmsversion.h -plugins/audio_file_processor/embedded_resources.h -plugins/bass_booster/embedded_resources.h -plugins/bit_invader/embedded_resources.h -plugins/kicker/embedded_resources.h -plugins/ladspa_browser/embedded_resources.h -plugins/ladspa_effect/embedded_resources.h -plugins/lb302/embedded_resources.h -plugins/opl2/embedded_resources.h -plugins/organic/embedded_resources.h -plugins/papu/embedded_resources.h -plugins/patman/embedded_resources.h -plugins/peak_controller_effect/embedded_resources.h -plugins/sf2_player/embedded_resources.h -plugins/sf2_player/ui_patches_dialog.h -plugins/sid/embedded_resources.h -plugins/spectrum_analyzer/embedded_resources.h -plugins/stereo_enhancer/embedded_resources.h -plugins/stereo_matrix/embedded_resources.h -plugins/stk/mallets/embedded_resources.h -plugins/triple_oscillator/embedded_resources.h -plugins/vestige/embedded_resources.h -plugins/vibed/embedded_resources.h -plugins/vst_base/RemoteVstPlugin -plugins/vst_effect/embedded_resources.h -plugins/zynaddsubfx/RemoteZynAddSubFx -plugins/zynaddsubfx/embedded_resources.h -plugins/zynaddsubfx/fltk/FL/Enumerations.h -plugins/zynaddsubfx/fltk/FL/Fl.h -plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.h -plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.h -plugins/zynaddsubfx/fltk/FL/Fl_Box.h -plugins/zynaddsubfx/fltk/FL/Fl_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_Browser_.h -plugins/zynaddsubfx/fltk/FL/Fl_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Chart.h -plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Choice.h -plugins/zynaddsubfx/fltk/FL/Fl_Clock.h -plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.h -plugins/zynaddsubfx/fltk/FL/Fl_Counter.h -plugins/zynaddsubfx/fltk/FL/Fl_Device.h -plugins/zynaddsubfx/fltk/FL/Fl_Dial.h -plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.h -plugins/zynaddsubfx/fltk/FL/Fl_Export.h -plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.h -plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.h -plugins/zynaddsubfx/fltk/FL/Fl_File_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.h -plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.h -plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.h -plugins/zynaddsubfx/fltk/FL/Fl_Free.h -plugins/zynaddsubfx/fltk/FL/Fl_Group.h -plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.h -plugins/zynaddsubfx/fltk/FL/Fl_Help_View.h -plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Image.h -plugins/zynaddsubfx/fltk/FL/Fl_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Input_.h -plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.h -plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu_.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.h -plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.h -plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.h -plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.h -plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.h -plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Object.h -plugins/zynaddsubfx/fltk/FL/Fl_Output.h -plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.h -plugins/zynaddsubfx/fltk/FL/Fl_Pack.h -plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.h -plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.h -plugins/zynaddsubfx/fltk/FL/Fl_Plugin.h -plugins/zynaddsubfx/fltk/FL/Fl_Positioner.h -plugins/zynaddsubfx/fltk/FL/Fl_PostScript.h -plugins/zynaddsubfx/fltk/FL/Fl_Preferences.h -plugins/zynaddsubfx/fltk/FL/Fl_Printer.h -plugins/zynaddsubfx/fltk/FL/Fl_Progress.h -plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.h -plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Roller.h -plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.h -plugins/zynaddsubfx/fltk/FL/Fl_Scroll.h -plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.h -plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.h -plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.h -plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.h -plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.h -plugins/zynaddsubfx/fltk/FL/Fl_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Spinner.h -plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.h -plugins/zynaddsubfx/fltk/FL/Fl_Table.h -plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.h -plugins/zynaddsubfx/fltk/FL/Fl_Tabs.h -plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.h -plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.h -plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.h -plugins/zynaddsubfx/fltk/FL/Fl_Tile.h -plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.h -plugins/zynaddsubfx/fltk/FL/Fl_Timer.h -plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.h -plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.h -plugins/zynaddsubfx/fltk/FL/Fl_Tree.h -plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.h -plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.h -plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.h -plugins/zynaddsubfx/fltk/FL/Fl_Valuator.h -plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.h -plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.h -plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.h -plugins/zynaddsubfx/fltk/FL/Fl_Widget.h -plugins/zynaddsubfx/fltk/FL/Fl_Window.h -plugins/zynaddsubfx/fltk/FL/Fl_Wizard.h -plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.h -plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.h -plugins/zynaddsubfx/fltk/FL/filename.h -plugins/zynaddsubfx/fltk/FL/fl_ask.h -plugins/zynaddsubfx/fltk/FL/fl_draw.h -plugins/zynaddsubfx/fltk/FL/fl_message.h -plugins/zynaddsubfx/fltk/FL/fl_show_colormap.h -plugins/zynaddsubfx/fltk/FL/fl_show_input.h -plugins/zynaddsubfx/fltk/FL/mac.h -plugins/zynaddsubfx/fltk/FL/win32.h -plugins/zynaddsubfx/fltk/FL/x.h -plugins/zynaddsubfx/fltk/Fl -plugins/zynaddsubfx/fltk/config.h -plugins/zynaddsubfx/fltk/fltk-config -plugins/zynaddsubfx/zynaddsubfx.rc -ui_EffectSelectDialog.h -ui_about_dialog.h -ui_export_project.h - diff --git a/CMakeLists.txt b/CMakeLists.txt index 9428e7f05..397eecdeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,7 +332,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmms.rc.in ${CMAKE_BINARY_DIR}/lmms.rc) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc) # set compiler flags -SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-strict-overflow") +SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow") SET(CMAKE_C_FLAGS "-O2 -g ${WERROR_FLAGS} ${CMAKE_C_FLAGS}") SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS_DEBUG "-DLMMS_DEBUG") diff --git a/plugins/ladspa_effect/tap/tap_rotspeak.c b/plugins/ladspa_effect/tap/tap_rotspeak.c index 7aa09d648..7ec435bd0 100644 --- a/plugins/ladspa_effect/tap/tap_rotspeak.c +++ b/plugins/ladspa_effect/tap/tap_rotspeak.c @@ -116,6 +116,7 @@ typedef struct { } RotSpkr; +void cleanup_RotSpkr(LADSPA_Handle Instance); /* Construct a new plugin instance. */ LADSPA_Handle @@ -124,7 +125,7 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, LADSPA_Handle * ptr; - if ((ptr = malloc(sizeof(RotSpkr))) != NULL) { + if ((ptr = calloc(1, sizeof(RotSpkr))) != NULL) { RotSpkr* rotSpeak = (RotSpkr*)ptr; rotSpeak->sample_rate = sample_rate; rotSpeak->run_adding_gain = 1.0; @@ -132,14 +133,13 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, if ((rotSpeak->ringbuffer_h_L = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) { - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } - if ((((RotSpkr *)ptr)->ringbuffer_h_R = + if ((rotSpeak->ringbuffer_h_R = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } rotSpeak->buflen_h_L = ceil(0.3f * sample_rate / M_PI); @@ -150,18 +150,13 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, if ((rotSpeak->ringbuffer_b_L = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->ringbuffer_b_R = calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } rotSpeak->buflen_b_L = ceil(0.3f * sample_rate / M_PI); @@ -171,74 +166,35 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, if ((rotSpeak->eq_filter_L = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->lp_filter_L = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->hp_filter_L = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->eq_filter_R = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->lp_filter_R = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(rotSpeak->eq_filter_R); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; } if ((rotSpeak->hp_filter_R = calloc(1, sizeof(biquad))) == NULL) { - free(rotSpeak->ringbuffer_h_L); - free(rotSpeak->ringbuffer_h_R); - free(rotSpeak->ringbuffer_b_L); - free(rotSpeak->ringbuffer_b_R); - free(rotSpeak->eq_filter_L); - free(rotSpeak->lp_filter_L); - free(rotSpeak->hp_filter_L); - free(rotSpeak->eq_filter_R); - free(rotSpeak->lp_filter_R); - free(ptr); + cleanup_RotSpkr((LADSPA_Handle)rotSpeak); return NULL; -} + } return ptr; } @@ -246,6 +202,7 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor, return NULL; } + void activate_RotSpkr(LADSPA_Handle Instance) { @@ -627,23 +584,38 @@ run_adding_RotSpkr(LADSPA_Handle Instance, -/* Throw away an RotSpkr effect instance. */ -void +/* + Throw away an RotSpkr effect instance. + This function should be called only when RotSpkr was allocated with calloc. + */ +void cleanup_RotSpkr(LADSPA_Handle Instance) { - RotSpkr * ptr = (RotSpkr *)Instance; - - free(ptr->ringbuffer_h_L); - free(ptr->ringbuffer_h_R); - free(ptr->ringbuffer_b_L); - free(ptr->ringbuffer_b_R); - free(ptr->eq_filter_L); - free(ptr->eq_filter_R); - free(ptr->lp_filter_L); - free(ptr->lp_filter_R); - free(ptr->hp_filter_L); - free(ptr->hp_filter_R); - free(Instance); + RotSpkr * ptr = (RotSpkr *)Instance; + if (!ptr) + return; + if (ptr->ringbuffer_h_L) + free(ptr->ringbuffer_h_L); + if (ptr->ringbuffer_h_R) + free(ptr->ringbuffer_h_R); + if (ptr->ringbuffer_b_L) + free(ptr->ringbuffer_b_L); + if (ptr->ringbuffer_b_R) + free(ptr->ringbuffer_b_R); + if (ptr->eq_filter_L) + free(ptr->eq_filter_L); + if (ptr->eq_filter_R) + free(ptr->eq_filter_R); + if (ptr->lp_filter_L) + free(ptr->lp_filter_L); + if (ptr->lp_filter_R) + free(ptr->lp_filter_R); + if (ptr->hp_filter_L) + free(ptr->hp_filter_L); + if (ptr->hp_filter_R) + free(ptr->hp_filter_R); + if (Instance) + free(Instance); } From 869229025c1ae0107f83f3b1c5559222deda1c03 Mon Sep 17 00:00:00 2001 From: 8tab <8tab@wp.pl> Date: Sun, 26 Jan 2014 15:44:51 +0100 Subject: [PATCH 6/6] restored fltk-config --- plugins/zynaddsubfx/fltk/fltk-config | 388 +++++++++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100755 plugins/zynaddsubfx/fltk/fltk-config diff --git a/plugins/zynaddsubfx/fltk/fltk-config b/plugins/zynaddsubfx/fltk/fltk-config new file mode 100755 index 000000000..97ed9a514 --- /dev/null +++ b/plugins/zynaddsubfx/fltk/fltk-config @@ -0,0 +1,388 @@ +#!/bin/sh +# +# "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $" +# +# FLTK configuration utility. +# +# Copyright 2000-2009 by Bill Spitzak and others. +# Original version Copyright 2000 by James Dean Palmer +# Adapted by Vincent Penne and Michael Sweet +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# Please report all bugs and problems on the following page: +# +# http://www.fltk.org/str.php +# + +MAJOR_VERSION=1 +MINOR_VERSION=3 +PATCH_VERSION=0 +VERSION=1.3.0 +APIVERSION=1.3 + +### BEGIN fltk-config +selfdir=`dirname "$0"` + +prefix=/usr/local +exec_prefix= +exec_prefix_set=no +bindir=/usr/local/bin +includedir= +libdir=/usr/local/lib +srcdir=. + +# compiler names +CC="gcc" +CXX="c++" + +# flags for C++ compiler: +ARCHFLAGS="" +CFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" +CXXFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" +LDFLAGS="" +LDLIBS="-lX11 -lpthread -lXinerama -lXft -lXext" +OPTIM="" +CAIROFLAGS="" + +# Check for local invocation, and update paths accordingly... +if test -f "$selfdir/FL/Fl_Window.H"; then + bindir="$selfdir/fluid" + includedir="$selfdir" + libdir="$selfdir/lib" + + if test -f "$libdir/libfltk_jpeg.a"; then + CFLAGS="-I$includedir/jpeg $CFLAGS" + CXXFLAGS="-I$includedir/jpeg $CXXFLAGS" + fi + + if test -f "$libdir/libfltk_z.a"; then + CFLAGS="-I$includedir/zlib $CFLAGS" + CXXFLAGS="-I$includedir/zlib $CXXFLAGS" + fi + + if test -f "$libdir/libfltk_png.a"; then + CFLAGS="-I$includedir/png $CFLAGS" + CXXFLAGS="-I$includedir/png $CXXFLAGS" + fi +fi + +if test -d $includedir/FL/images; then + CFLAGS="-I$includedir/FL/images $CFLAGS" + CXXFLAGS="-I$includedir/FL/images $CXXFLAGS" +fi + +if test -f "$libdir/libfltk_cairo.a"; then + CFLAGS="$CAIROFLAGS $CFLAGS" + CXXFLAGS="$CAIROFLAGS $CXXFLAGS" +fi + +# libraries to link with: +LIBNAME="" +DSONAME="" +DSOLINK="" +IMAGELIBS="" +STATICIMAGELIBS="" +CAIROLIBS="" +SHAREDSUFFIX="" + +usage () +{ + echo "Usage: fltk-config [OPTIONS] +Options: + [--version] + [--api-version] + +Options telling what we are doing: + [--use-gl] use GL + [--use-images] use extra image formats (PNG, JPEG) + [--use-glut] use glut compatibility layer + [--use-forms] use forms compatibility layer + [--use-cairo] use cairo graphics lib + +Options telling what information we request: + [--cc] return C compiler used to compile FLTK + [--cxx] return C++ compiler used to compile FLTK + [--optim] return compiler optimization used to compile FLTK + [--cflags] return flags to compile C using FLTK + [--cxxflags] return flags to compile C++ using FLTK + [--ldflags] return flags to link against FLTK + [--ldstaticflags] return flags to link against static FLTK library + even if there are DSOs installed + [--libs] return FLTK libraries full path for dependencies + +Options to compile and link an application: + [-g] compile the program with debugging information + [-Dname[=value]] compile the program with the given define + [--compile program.cxx] + [--post program] prepare the program for desktop use +" + exit $1 +} + +if test $# -eq 0; then + usage 1 +fi + +no_plugins=no +compile= +post= +debug= + +# Parse command line options +while test $# -gt 0 +do + case "$1" in + -*=*) + optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` + ;; + *) + optarg= + ;; + esac + + case $1 in + --version) + echo $VERSION + ;; + --api-version) + echo $APIVERSION + ;; + --cc) + echo $CC + ;; + --cxx) + echo $CXX + ;; + --optim) + echo_optim=yes + ;; + --use-gl | --use-glut) + use_gl=yes + ;; + --use-forms) + use_forms=yes + ;; + --use-images) + use_images=yes + ;; + --use-cairo) + use_cairo=yes + ;; + --cflags) + echo_cflags=yes + ;; + --cxxflags) + echo_cxxflags=yes + ;; + --ldflags) + echo_ldflags=yes + ;; + --ldstaticflags) + echo_ldstaticflags=yes + ;; + --libs) + echo_libs=yes + ;; + -g) + debug=-g + ;; + -D*) + CXXFLAGS="$CXXFLAGS $1" + ;; + --compile) + compile="$2" + shift + ;; + --post) + post="$2" + shift + ;; + *) + echo_help=yes + ;; + esac + shift +done + +if test "$includedir" != /usr/include; then + includes=-I$includedir +else + includes= +fi + +if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then + libs=-L$libdir +else + libs= +fi + +# Calculate needed libraries +LDSTATIC="$libdir/libfltk.a $LDLIBS" +LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS" + +if test x$use_forms = xyes; then + LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS" + LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC" +fi +if test x$use_gl = xyes; then + LDLIBS="-lfltk_gl$SHAREDSUFFIX $LDLIBS" + LDSTATIC="$libdir/libfltk_gl.a $LDSTATIC" +fi +if test x$use_images = xyes; then + LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS" + LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC" +fi + +if test x$use_cairo = xyes; then + LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS" + LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC" +fi + +LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS" +LDSTATIC="$LDFLAGS $LDSTATIC" + +# Answer to user requests +if test -n "$echo_help"; then + usage 1 +fi + +if test -n "$compile"; then + case "$compile" in + *.cxx) + prog="`basename \"$compile\" .cxx`" + ;; + *.cpp) + prog="`basename \"$compile\" .cpp`" + ;; + *.cc) + prog="`basename \"$compile\" .cc`" + ;; + *.C) + prog="`basename \"$compile\" .C`" + ;; + *) + echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!" + exit 1 + ;; + esac + + post="$prog" + + echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC + $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1 +fi + +if test -n "$post"; then + case "`uname`" in + Darwin) + echo Creating "'$post.app'" bundle for desktop... + id=`echo $post | tr ' ' '_'` + + # Make the bundle directory and move the executable there + rm -rf "$post.app/Contents/MacOS" + mkdir -p "$post.app/Contents/MacOS" + mv "$post" "$post.app/Contents/MacOS" + + # Make a shell script that runs the bundled executable + echo "#!/bin/sh" >"$post" + echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post" + echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post" + chmod +x "$post" + + # Make the simplest Info.plist needed for an application + cat >"$post.app/Contents/Info.plist" < + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleExecutable + $post + CFBundleIdentifier + org.fltk.$id + CFBundleName + $post + CFBundlePackageType + APPL + + +EOF + ;; + esac +fi + +if test "$echo_cflags" = "yes"; then + echo $includes $CFLAGS +fi + +if test "$echo_cxxflags" = "yes"; then + echo $includes $CXXFLAGS +fi + +if test "$echo_optim" = "yes"; then + echo $OPTIM +fi + +if test "$echo_ldflags" = "yes"; then + my_libs= + libdirs=$libs + + for i in $LDLIBS ; do + if test $i != -L$libdir ; then + if test -z "$my_libs" ; then + my_libs="$i" + else + my_libs="$my_libs $i" + fi + fi + done + echo $libdirs $my_libs +fi + +if test "$echo_ldstaticflags" = "yes"; then + echo $LDSTATIC +fi + +if test "$echo_libs" = "yes"; then + echo $libdir/libfltk.a + + if test x$use_forms = xyes; then + echo $libdir/libfltk_forms.a + fi + + if test x$use_gl = xyes; then + echo $libdir/libfltk_gl.a + fi + + if test x$use_cairo = xyes; then + echo $libdir/libfltk_cairo.a + fi + + if test x$use_images = xyes; then + echo $libdir/libfltk_images.a + + for lib in fltk_jpeg fltk_png fltk_z; do + if test -f $libdir/lib$lib.a; then + echo $libdir/lib$lib.a + fi + done + fi +fi + +# +# End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $". +#