Merge branch '1774_build_cleanups'

* 1774_build_cleanups:
  Fixed several missing includes
  Changed include 'glib.h' to 'global.h' because global.h file has some things for
  vfs/mcserv.c: fixed variable name clashes and missing includes
  vfs/undelfs.c: Fixed variable name clashes
  vfs/vfs-impl.h: fixed missing includes
  vfs/utilvfs.h: fixed missing includes
  src/screen.c: const char* cleanup, fixing break on -Werror
  Dropping non-strftime() support and fixing -Werror problem
  m4.include/mc-use-termcap.m4: fixed const char* issue which triggers break on -Wall
  Ticket #1774: Various build fixups (missing includes, name clashes, ...)
This commit is contained in:
Enrico Weigelt, metux IT service 2009-11-09 13:50:34 +01:00
commit de4e40dd8f
17 changed files with 45 additions and 55 deletions

View File

@ -166,7 +166,7 @@ AC_CHECK_FUNCS([\
initgroups isascii \
memcpy memset \
putenv \
setreuid setuid statfs strerror strftime sysconf \
setreuid setuid statfs strerror sysconf \
tcgetattr tcsetattr truncate \
])

View File

@ -142,7 +142,7 @@ if test x"$ac_cv_func_getmntent" = xyes; then
# endif
#endif
],
[ struct mntent *mnt = 0; char *table = MOUNTED;
[ struct mntent *mnt = 0; const char *table = MOUNTED;
if (sizeof mnt && sizeof table) return 0;],
fu_cv_sys_mounted_getmntent1=yes,
fu_cv_sys_mounted_getmntent1=no)])

View File

@ -24,7 +24,7 @@ AC_DEFUN([MC_SLANG_TERMCAP], [
#include <slang.h>
#endif
],
[SLtt_get_terminfo(); SLtt_tgetflag("");],
[SLtt_get_terminfo(); SLtt_tgetflag((char*)"");],
[mc_cv_slang_termcap=no],
[mc_cv_slang_termcap=yes])
LIBS="$ac_save_LIBS"

View File

@ -32,7 +32,7 @@
#include "../src/tty/tty.h"
#include "../src/args.h"
#include "../src/strutil.h"
#include "../src/textconf.h"
/*** external variables **************************************************************************/

View File

@ -33,6 +33,7 @@
#include "../src/fileloc.h"
#include "../src/strescape.h"
#include "../src/skin/skin.h"
#include "../../src/util.h"
#include "fhl.h"
#include "internal.h"

View File

@ -30,6 +30,7 @@
#include "global.h"
#include "../../vfs/vfs.h" /* mc_stat */
#include "../../src/util.h"
#include "mcconfig.h"

View File

@ -1372,8 +1372,8 @@ panel_paint_sort_info(WPanel *panel)
static gchar*
panel_get_title_without_hotkey(const char *title)
{
gchar *translated_title;
const gchar *hkey;
char *translated_title;
char *hkey;
if (title == NULL)
return NULL;

View File

@ -31,6 +31,7 @@
#include "../src/global.h"
#include "../src/main.h"
#include "../src/fileloc.h"
#include "../../src/util.h"
#include "skin.h"
#include "internal.h"

View File

@ -31,6 +31,7 @@
#include "global.h"
#include "ecs.h"
#include "../src/textconf.h"
#ifdef USE_VFS
static const char *const vfs_supported[] = {

View File

@ -10,8 +10,6 @@
#define INVALID_TIME_TEXT "(invalid)"
#ifdef HAVE_STRFTIME
/* safe localtime formatting - strftime()-using version */
#define FMT_LOCALTIME(buffer, bufsize, fmt, when) \
{ \
@ -28,16 +26,6 @@
} \
} \
#else
/* fallback when strftime/localtime not available */
#define FMT_LOCALTIME(buffer,bufsize,fmt,when) \
{ \
ctime_r(when,buffer); \
} \
#endif
#define FMT_LOCALTIME_CURRENT(buffer, bufsize, fmt) \
{ \
time_t __current_time; \

View File

@ -34,7 +34,7 @@
#include "../../src/tty/tty.h" /* tty_gotoyx, tty_print_char */
#include "../../src/tty/win.h"
#include "../../src/util.h"
#include "../../src/cons.saver.h" /* console_flag */
/*** global variables **************************************************/

View File

@ -42,6 +42,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
@ -297,13 +298,13 @@ do_close (void)
/* {{{ Stat family routines */
static void
send_time (int sock, time_t time)
send_time (int sock, time_t t)
{
if (clnt_version == 1) {
char *ct;
int month;
ct = ctime (&time);
ct = ctime (&t);
ct[3] = ct[10] = ct[13] = ct[16] = ct[19] = 0;
/* Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec */
@ -326,7 +327,7 @@ send_time (int sock, time_t time)
month = 10;
} else
month = 11;
rpc_send (msock, RPC_INT, atoi (&ct[17]), /* sec */
rpc_send (sock, RPC_INT, atoi (&ct[17]), /* sec */
RPC_INT, atoi (&ct[14]), /* min */
RPC_INT, atoi (&ct[11]), /* hour */
RPC_INT, atoi (&ct[8]), /* mday */
@ -334,11 +335,11 @@ send_time (int sock, time_t time)
RPC_INT, month, /* month */
RPC_END);
} else {
long ltime = (long) time;
long ltime = (long) t;
char buf[BUF_SMALL];
snprintf (buf, sizeof (buf), "%lx", ltime);
rpc_send (msock, RPC_STRING, buf, RPC_END);
rpc_send (sock, RPC_STRING, buf, RPC_END);
}
}
@ -594,16 +595,16 @@ do_mknod (void)
static void
do_readlink (void)
{
char buffer[2048];
char buf[2048];
char *file;
int n;
rpc_get (msock, RPC_STRING, &file, RPC_END);
n = readlink (file, buffer, 2048 - 1);
n = readlink (file, buf, 2048 - 1);
send_status (n, errno);
if (n >= 0) {
buffer[n] = 0;
rpc_send (msock, RPC_STRING, buffer, RPC_END);
buf[n] = 0;
rpc_send (msock, RPC_STRING, buf, RPC_END);
}
g_free (file);
}
@ -818,12 +819,12 @@ mc_pam_auth (const char *username, const char *password)
/* Keep reading until we find a \n */
static int
next_line (int socket)
next_line (int sock)
{
char c;
while (1) {
if (read (socket, &c, 1) <= 0)
if (read (sock, &c, 1) <= 0)
return 0;
if (c == '\n')
return 1;
@ -1048,15 +1049,16 @@ do_rauth (int socket)
#endif
static int
do_rauth (int msock)
do_rauth (int sock)
{
sock = 0; /* prevent warning */
return 0;
}
static void
login_reply (int logged_in)
login_reply (int _logged_in)
{
rpc_send (msock, RPC_INT, logged_in ? MC_LOGINOK : MC_INVALID_PASS,
rpc_send (msock, RPC_INT, _logged_in ? MC_LOGINOK : MC_INVALID_PASS,
RPC_END);
}
@ -1168,7 +1170,7 @@ void
tcp_invalidate_socket (int sock)
{
if (verbose)
printf ("Connection closed\n");
printf ("Connection closed [socket %d]\n", sock);
DO_QUIT_VOID ();
}
@ -1193,7 +1195,7 @@ server (int sock)
/* {{{ Net support code */
static const char *
get_client (int portnum)
get_client (int port)
{
int sock, newsocket;
unsigned int clilen;
@ -1211,7 +1213,7 @@ get_client (int portnum)
memset ((char *) &server_address, 0, sizeof (server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = htonl (INADDR_ANY);
server_address.sin_port = htons (portnum);
server_address.sin_port = htons (port);
if (bind
(sock, (struct sockaddr *) &server_address,
@ -1285,13 +1287,13 @@ get_port_number (void)
}
static void
register_port (int portnum, int abort_if_fail)
register_port (int port, int abort_if_fail)
{
#ifdef HAVE_PMAP_SET
/* Register our service with the portmapper */
/* protocol: pmap_set (prognum, versnum, protocol, portp) */
if (pmap_set (RPC_PROGNUM, RPC_PROGVER, IPPROTO_TCP, portnum))
if (pmap_set (RPC_PROGNUM, RPC_PROGVER, IPPROTO_TCP, port))
signal (SIGINT, signal_int_handler);
else {
fprintf (stderr, "Cannot register service with portmapper\n");

View File

@ -142,7 +142,7 @@ fi
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid)
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
AC_CHECK_FUNCS(sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf)
AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam)

View File

@ -493,11 +493,7 @@ char *http_timestring(time_t t)
if (!tm)
slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
else
#ifndef HAVE_STRFTIME
fstrcpy(buf, asctime(tm));
#else /* !HAVE_STRFTIME */
strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
#endif /* !HAVE_STRFTIME */
return buf;
}
#endif /*0 */
@ -515,11 +511,7 @@ char *timestring(void )
if (!tm) {
slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
} else {
#ifdef HAVE_STRFTIME
strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm);
#else
fstrcpy(TimeBuf, asctime(tm));
#endif
}
return(TimeBuf);
}

View File

@ -158,20 +158,20 @@ undelfs_get_path (const char *dirname, char **fsname, char **file)
}
static int
undelfs_lsdel_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, void *private)
undelfs_lsdel_proc(ext2_filsys _fs, blk_t *block_nr, int blockcnt, void *private)
{
struct lsdel_struct *lsd = (struct lsdel_struct *) private;
struct lsdel_struct *_lsd = (struct lsdel_struct *) private;
(void) blockcnt;
lsd->num_blocks++;
_lsd->num_blocks++;
if (*block_nr < fs->super->s_first_data_block ||
*block_nr >= fs->super->s_blocks_count) {
lsd->bad_blocks++;
if (*block_nr < _fs->super->s_first_data_block ||
*block_nr >= _fs->super->s_blocks_count) {
_lsd->bad_blocks++;
return BLOCK_ABORT;
}
if (!ext2fs_test_block_bitmap(fs->block_map,*block_nr))
lsd->free_blocks++;
if (!ext2fs_test_block_bitmap(_fs->block_map,*block_nr))
_lsd->free_blocks++;
return 0;
}

View File

@ -11,6 +11,8 @@
#include <sys/stat.h>
#include "../src/global.h"
/* Flags for vfs_split_url() */
#define URL_ALLOW_ANON 1
#define URL_NOSLASH 2

View File

@ -11,6 +11,8 @@
#include <sys/types.h>
#include <dirent.h>
#include <stddef.h>
#include <utime.h>
#include "../src/fs.h" /* MC_MAXPATHLEN */