Some patches
- From: Roland Illig <roland illig gmx de>
- To: MC Devel <mc-devel gnome org>
- Subject: Some patches
- Date: Tue, 28 Sep 2004 11:42:47 +0200
Hi,
I have banned me from doing any CVS commits for one week to let you all
calm down from the stressful last month with me. I think I can take that
promise, but I need some help from you. Please review these patches and
commit them if you like.
The patch for src/slint.c let's me build mc with the option
--with-screen=slang. For any reason the Debian-unstable SLang library
does not contain the symbol _SLsys_input_pending, but it contains
SLang_input_pending, so the patch adjusts the function call. I also use
the included ../slang/include/_slang.h file instead of declaring the
variables and functions again, just for consistency.
$ objdump -T /lib/libslang.so.1.4.9 | grep _input_
000224b0 g DF .text 00000063 SLANG_1.4.9 SLang_input_pending
The "named constant" patch replaces literal -1 with INVALID_OFFSET where
appropriate. I am not sure if the one line where INT_MAX is replaced
with INVALID_OFFSET is really correct. Please check.
The patch for src/file.c fixes the prototypes for some functions when mc
is configured --without-largefile.
Roland
Index: slint.c
===================================================================
RCS file: /cvsroot/mc/mc/src/slint.c,v
retrieving revision 1.36
diff -u -r1.36 slint.c
--- slint.c 25 Sep 2004 13:46:23 -0000 1.36
+++ slint.c 28 Sep 2004 09:34:02 -0000
@@ -71,14 +71,26 @@
/* Controls whether we should wait for input in getch */
static int no_slang_delay;
+#ifdef HAVE_SLANG
+# ifndef HAVE_SYSTEM_SLANG
+# include "../slang/include/_slang.h"
+# else
/* {{{ Copied from ../slang/slgetkey.c, removed the DEC_8Bit_HACK, */
extern unsigned char SLang_Input_Buffer [];
-#if SLANG_VERSION >= 10000
-extern unsigned int _SLsys_getkey (void);
-extern int _SLsys_input_pending (int);
+# endif
+#endif
+
+#if SLANG_VERSION >= 10409
+# define SLANG_GETKEY() SLang_getkey()
+# define SLANG_INPUT_PENDING(m_int) SLang_input_pending(m_int)
+#elif SLANG_VERSION >= 10000
+# define SLANG_GETKEY() _SLsys_getkey()
+# define SLANG_INPUT_PENDING(m_int) _SLsys_input_pending(m_int)
#else
extern unsigned int SLsys_getkey (void);
extern int SLsys_input_pending (int);
+# define SLANG_GETKEY() SLsys_getkey()
+# define SLANG_INPUT_PENDING(m_int) SLsys_input_pending(m_int)
#endif
/* Forward declarations */
@@ -99,11 +111,7 @@
(char *) (SLang_Input_Buffer + 1), imax);
return(ch);
}
-#if SLANG_VERSION >= 10000
- else return(_SLsys_getkey ());
-#else
- else return(SLsys_getkey());
-#endif
+ else return(SLANG_GETKEY());
}
static int SLang_input_pending2 (int tsecs)
@@ -112,11 +120,7 @@
unsigned char c;
if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len;
-#if SLANG_VERSION >= 10000
- n = _SLsys_input_pending (tsecs);
-#else
- n = SLsys_input_pending (tsecs);
-#endif
+ n = SLANG_INPUT_PENDING (tsecs);
if (n <= 0) return 0;
i = SLang_getkey2 ();
Index: mcmain.c
===================================================================
RCS file: mcmain.c
diff -N mcmain.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mcmain.c 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,6 @@
+#include "main.h"
+
+int main(int argc, char **argv)
+{
+ return mc_main(argc, argv);
+}
Index: view.c
===================================================================
RCS file: /cvsroot/mc/mc/src/view.c,v
retrieving revision 1.151
diff -u -r1.151 view.c
--- view.c 19 Aug 2004 19:34:16 -0000 1.151
+++ view.c 19 Aug 2004 20:28:16 -0000
@@ -78,7 +78,7 @@
/* Offset in bytes into a file */
typedef unsigned long offset_type;
-#define EOF_offset ((offset_type) -1)
+#define INVALID_OFFSET ((offset_type) -1)
/* A width or height on the screen */
typedef unsigned int screen_dimen;
@@ -296,7 +296,7 @@
if (n != -1)
view->bytes_read += n;
if (view->s.st_size < view->bytes_read) {
- view->bottom_first = -1; /* Invalidate cache */
+ view->bottom_first = INVALID_OFFSET; /* Invalidate cache */
view->s.st_size = view->bytes_read;
view->last_byte = view->bytes_read;
if (view->reading_pipe)
@@ -717,7 +717,7 @@
else
cols = view->widget.cols;
- view->bottom_first = -1;
+ view->bottom_first = INVALID_OFFSET;
if (cols < 80)
view->bytes_per_line = ((cols - 8) / 17) * 4;
else
@@ -1358,9 +1358,9 @@
offset_type bottom_first;
if (!have_fast_cpu && !really)
- return INT_MAX;
+ return INVALID_OFFSET;
- if (!do_not_cache && view->bottom_first != EOF_offset)
+ if (!do_not_cache && view->bottom_first != INVALID_OFFSET)
return view->bottom_first;
/* Force loading */
@@ -1705,8 +1705,9 @@
}
}
-/* Search buffer (it's size is len) in the complete buffer */
-/* returns the position where the block was found or -1 if not found */
+/* Search buffer (its size is len) in the complete buffer
+ * returns the position where the block was found or INVALID_OFFSET
+ * if not found */
static offset_type
block_search (WView *view, const char *buffer, int len)
{
@@ -1781,7 +1782,7 @@
}
}
disable_interrupt_key ();
- return EOF_offset;
+ return INVALID_OFFSET;
}
/*
@@ -1865,7 +1866,7 @@
g_free (buffer);
- if (pos == EOF_offset) {
+ if (pos == INVALID_OFFSET) {
message (0, _("Search"), _(" Search string not found "));
view->found_len = 0;
return;
@@ -2324,7 +2325,7 @@
if (view->monitor) {
move_to_bottom (view);
- view->bottom_first = -1;
+ view->bottom_first = INVALID_OFFSET;
set_idle_proc (view->widget.parent, 1);
} else {
if (old)
@@ -2732,7 +2733,7 @@
case WIDGET_IDLE:
/* This event is generated when the user is using the 'F' flag */
- view->bottom_first = -1;
+ view->bottom_first = INVALID_OFFSET;
move_to_bottom (view);
display (view);
view_status (view, TRUE);
Index: file.c
===================================================================
RCS file: /cvsroot/mc/mc/src/file.c,v
retrieving revision 1.129
diff -u -r1.129 file.c
--- file.c 25 Sep 2004 13:46:23 -0000 1.129
+++ file.c 27 Sep 2004 22:33:53 -0000
@@ -2259,19 +2259,19 @@
#else
static int
-do_file_error (char *str)
+do_file_error (const char *str)
{
return real_do_file_error (Foreground, str);
}
static int
-query_recursive (FileOpContext *ctx, char *s)
+query_recursive (FileOpContext *ctx, const char *s)
{
return real_query_recursive (ctx, Foreground, s);
}
static int
-query_replace (FileOpContext *ctx, char *destname, struct stat *_s_stat,
+query_replace (FileOpContext *ctx, const char *destname, struct stat *_s_stat,
struct stat *_d_stat)
{
return file_progress_real_query_replace (ctx, Foreground, destname,
Index: mcmain.c
===================================================================
RCS file: mcmain.c
diff -N mcmain.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mcmain.c 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,6 @@
+#include "main.h"
+
+int main(int argc, char **argv)
+{
+ return mc_main(argc, argv);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]