1
0
Fork 0

fgadmin: fix compiler warnings

Also fixes mismatching "tarextract" declaration vs definition issue.
This commit is contained in:
ThorstenB 2011-12-18 19:43:46 +01:00
parent dc95e5e84b
commit 4b7d22fe0f
3 changed files with 21 additions and 13 deletions

View file

@ -123,7 +123,7 @@ void FGAdminUI::select_install_dest() {
} }
} }
#if 0
// Like strcmp, but for strings // Like strcmp, but for strings
static int stringCompare(const void *string1, const void *string2) static int stringCompare(const void *string1, const void *string2)
{ {
@ -133,7 +133,7 @@ static int stringCompare(const void *string1, const void *string2)
// Compare name first, and then index. // Compare name first, and then index.
return strcmp(s1->c_str(), s2->c_str()); return strcmp(s1->c_str(), s2->c_str());
} }
#endif
void FGAdminUI::update_install_box() { void FGAdminUI::update_install_box() {
set<string> file_list; set<string> file_list;
@ -149,7 +149,8 @@ void FGAdminUI::update_install_box() {
dirent *ent = list[i]; dirent *ent = list[i];
strncpy( base, ent->d_name, FL_PATH_MAX ); strncpy( base, ent->d_name, FL_PATH_MAX );
const char *p = fl_filename_ext( base ); const char *p = fl_filename_ext( base );
int offset, expected_length = 0; int offset;
string::size_type expected_length = 0;
if ( strcmp( p, ".gz" ) == 0 ) { if ( strcmp( p, ".gz" ) == 0 ) {
offset = p - base; offset = p - base;
base[offset] = '\0'; base[offset] = '\0';

View file

@ -99,6 +99,8 @@
# endif # endif
#endif #endif
#include "untarka.h"
static void error OF((const char *msg)); static void error OF((const char *msg));
static unsigned long total_read; static unsigned long total_read;
@ -997,13 +999,12 @@ static void error(const char *msg) {
exit(1); exit(1);
} }
#ifdef DOSISH
/* This will give a benign warning */ /* This will give a benign warning */
static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", ".tar.bz2", ".tar.Z", ".tar", NULL }; static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", ".tar.bz2", ".tar.Z", ".tar", NULL };
/* Return the real name of the TGZ archive */ /* Return the real name of the TGZ archive */
/* or NULL if it does not exist. */ /* or NULL if it does not exist. */
static char *TGZfname OF((const char *fname)) static char *TGZfname OF((const char *fname))
{ {
static char buffer[1024]; static char buffer[1024];
@ -1034,6 +1035,7 @@ static void TGZnotfound OF((const char *fname))
TGZprefix[i]); TGZprefix[i]);
exit(1); exit(1);
} }
#endif
/* help functions */ /* help functions */
@ -1178,7 +1180,7 @@ static int tar (Readable* rin,int action,int arg,int argc,char **argv, char cons
int remaining = 0; int remaining = 0;
FILE *outfile = NULL; FILE *outfile = NULL;
char fname[BLOCKSIZE]; char fname[BLOCKSIZE];
time_t tartime; time_t tartime = 0;
unsigned long last_read; unsigned long last_read;
#if 0 #if 0
@ -1359,6 +1361,7 @@ static int tar (Readable* rin,int action,int arg,int argc,char **argv, char cons
} }
#ifdef DOSISH
/* =========================================================== */ /* =========================================================== */
static void help(int exitval) static void help(int exitval)
@ -1382,7 +1385,6 @@ static void help(int exitval)
/* ====================================================================== */ /* ====================================================================== */
#ifdef DOSISH
extern int _CRT_glob; extern int _CRT_glob;
int _CRT_glob = 0; /* disable globbing of the arguments */ int _CRT_glob = 0; /* disable globbing of the arguments */
#endif #endif
@ -1453,7 +1455,7 @@ int main(int argc,char **argv) {
#endif #endif
void void
tarextract(char *TGZfile,char *dest,int verbose, void (*step)(void *), void *data) tarextract(char *TGZfile,char *dest,int verbose, void (*step)(void *,int), void *data)
{ {
Readable r; Readable r;
if (xOpen4Read(&r,TGZfile) == 0) if (xOpen4Read(&r,TGZfile) == 0)

View file

@ -1,10 +1,15 @@
#include <string>
using std::string;
// list the contents of the specified tar file // list the contents of the specified tar file
// bool tarlist( char *tarfile, char *destdir, bool verbose ); // bool tarlist( char *tarfile, char *destdir, bool verbose );
// extract the specified tar file into the specified destination // extract the specified tar file into the specified destination
// directory // directory
extern "C" void tarextract( char *tarfile, char *destdir, int verbose, void (*step)(void*,int), void *data ); #ifdef __cplusplus
extern "C" {
#endif
void tarextract( char *tarfile, char *destdir, int verbose, void (*step)(void*,int), void *data );
#ifdef __cplusplus
}
#endif