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
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.
return strcmp(s1->c_str(), s2->c_str());
}
#endif
void FGAdminUI::update_install_box() {
set<string> file_list;
@ -149,7 +149,8 @@ void FGAdminUI::update_install_box() {
dirent *ent = list[i];
strncpy( base, ent->d_name, FL_PATH_MAX );
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 ) {
offset = p - base;
base[offset] = '\0';

View file

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

View file

@ -1,10 +1,15 @@
#include <string>
using std::string;
// list the contents of the specified tar file
// bool tarlist( char *tarfile, char *destdir, bool verbose );
// extract the specified tar file into the specified destination
// 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