From defe47ef9eddff712c1298861176ca6a8281ca0f Mon Sep 17 00:00:00 2001 From: Dominic Evans Date: Mon, 13 Sep 2010 11:26:35 +0100 Subject: [PATCH] Fix compilation errors on gcc 4.4.5 Signed-off-by: Dominic Evans --- Makefile | 48 ++++++++++++++++++++++++------------------------ commands.c | 2 +- menu-filebrowser.c | 12 +++++------- menu-filebrowser.h | 2 +- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 6f240d6..66d04e2 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,30 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' OBJS = $(PLUGIN).o menu-filebrowser.o commands.o threads.o menu-output.o statebag.o menu-threads.o menu-setup.o tools.o command-sources.o command-other.o commands-plugins.o menu-accesscode.o menu-userinput.o +### Targets: + +all: libvdr-$(PLUGIN).so i18n + +libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ + @cp $@ $(LIBDIR)/$@.$(APIVERSION) + +dist: clean + @$(MAKE) clean -C developers/filebrowserdemo > /dev/null + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @mkdir $(TMPDIR)/$(ARCHIVE) + @cp -a * $(TMPDIR)/$(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE)/filebrowser.{filelist,kdev*} + @-rm -rf $(TMPDIR)/$(ARCHIVE)/{*,*/*,*/*/*}~ + @-rm -rf $(TMPDIR)/$(ARCHIVE)/Doxyfile + @tar --numeric-owner -czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @echo Distribution package created as $(PACKAGE).tgz + +clean: + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ + ### Implicit rules: %.o: %.c @@ -96,27 +120,3 @@ $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo .PHONY: i18n i18n: $(I18Nmsgs) - -### Targets: - -all: libvdr-$(PLUGIN).so i18n - -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) - -dist: clean - @$(MAKE) clean -C developers/filebrowserdemo > /dev/null - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @mkdir $(TMPDIR)/$(ARCHIVE) - @cp -a * $(TMPDIR)/$(ARCHIVE) - @-rm -rf $(TMPDIR)/$(ARCHIVE)/filebrowser.{filelist,kdev*} - @-rm -rf $(TMPDIR)/$(ARCHIVE)/{*,*/*,*/*/*}~ - @-rm -rf $(TMPDIR)/$(ARCHIVE)/Doxyfile - @tar --numeric-owner -czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @echo Distribution package created as $(PACKAGE).tgz - -clean: - @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot - @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ diff --git a/commands.c b/commands.c index b956f18..379734d 100644 --- a/commands.c +++ b/commands.c @@ -97,7 +97,7 @@ bool cFilebrowserCommand::MatchesSingleFile(const char* Filename) if(Pattern[0]!='/') { char* filename_tmp=NULL; - Filename=(Filename && (filename_tmp=strrchr(Filename, '/'))) ? filename_tmp + 1 : NULL; + Filename=(Filename && (filename_tmp=(char*)strrchr(Filename, '/'))) ? filename_tmp + 1 : NULL; } if(Filename==NULL) { diff --git a/menu-filebrowser.c b/menu-filebrowser.c index da4f916..a1d812b 100644 --- a/menu-filebrowser.c +++ b/menu-filebrowser.c @@ -141,7 +141,7 @@ cOsdMenuFilebrowser::~cOsdMenuFilebrowser() if ( BaseDirectory ) delete BaseDirectory; } -int cOsdMenuFilebrowser::DirectorySort ( const void* File1, const void* File2 ) +int cOsdMenuFilebrowser::DirectorySort ( const dirent64** File1, const dirent64** File2 ) { struct dirent64* ent1=* ( struct dirent64** ) File1; @@ -202,7 +202,7 @@ void cOsdMenuFilebrowser::LoadDir ( cString Directory ) { if ( * ( Statebag->CurrentDirectory ) ) { - char* slash=strrchr ( * ( Statebag->CurrentDirectory ), '/' ); + char* slash = (char*) strrchr ( * ( Statebag->CurrentDirectory ), '/' ); if ( slash ) { @@ -240,7 +240,7 @@ void cOsdMenuFilebrowser::Refresh ( const char* CurrentFile ) { char* Title= ( char* ) malloc ( strlen ( tr ( "Filebrowser" ) ) + strlen ( Statebag->CurrentDirectory ) + 3 ); char* Title_tmp=NULL; - sprintf ( Title, "%s: %s", tr ( "Filebrowser" ), ( ( Title_tmp=strrchr ( Statebag->CurrentDirectory, '/' ) ) && ! ( Statebag->ShowFullPath ) ) ? Title_tmp + 1 : * ( Statebag->CurrentDirectory ) ); + sprintf ( Title, "%s: %s", tr ( "Filebrowser" ), ( ( Title_tmp=(char *) strrchr ( Statebag->CurrentDirectory, '/' ) ) && ! ( Statebag->ShowFullPath ) ) ? Title_tmp + 1 : * ( Statebag->CurrentDirectory ) ); SetTitle ( Title ); free ( Title ); } @@ -255,12 +255,10 @@ void cOsdMenuFilebrowser::Refresh ( const char* CurrentFile ) char* cwd=getcwd ( NULL, 0 ); dirent64** entries; - int count; + int count=scandir64 ( Statebag->CurrentDirectory, &entries, NULL, &cOsdMenuFilebrowser::DirectorySort ); - if ( chdir ( Statebag->CurrentDirectory ) == 0 && ( count=scandir64 ( Statebag->CurrentDirectory, &entries, NULL, &cOsdMenuFilebrowser::DirectorySort ) ) > 0 ) + if ( (chdir ( Statebag->CurrentDirectory ) == 0) && (count > 0) ) { - - for ( int i=0; id_name, "." ) ==0 || ( strcmp ( entries[i]->d_name, ".." ) ==0 && strcmp ( Statebag->BaseDir, Statebag->CurrentDirectory ) ==0 ) ) diff --git a/menu-filebrowser.h b/menu-filebrowser.h index 5a45f34..781058b 100644 --- a/menu-filebrowser.h +++ b/menu-filebrowser.h @@ -72,7 +72,7 @@ class cOsdMenuFilebrowser : public cOsdMenu, public cStatus eMenuFilebrowserTask Task; - static int DirectorySort(const void* File1, const void* File2); + static int DirectorySort(const dirent64** File1, const dirent64** File2); /* * This filters entries shown in Filebrowser * The function uses Statebag->ShowHiddenFiles and Statebag->Filter -- 1.7.1