-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
some patches for console i discovered in my ~/src/licq/ directory. they are
trivial, small, and just fix some things. i dont know whether they deserve
to exist :)
- --
Buenos Aires, Argentina
-----BEGIN PGP SIGNATURE-----
iD8DBQE+LMLXUMlRieHkprgRAou+AJ4l9lVlm89BBDqN2WlEEAvuiJgmwwCgwztT
UarOtxA1DL+8a8wLMThHI1s=
=3k1E
-----END PGP SIGNATURE-----
D:
D: kill gcc-3.2 warning
D:
only in patch2:
unchanged:
--- console1/src/window.h 2003-01-11 16:17:18.000000000 -0300
+++ console/src/window.h 2003-01-11 16:20:42.000000000 -0300
@@ -1,7 +1,7 @@
#ifndef WINDOW_H
#define WINDOW_H
-#include <iostream.h>
+#include <iostream>
#include <curses.h>
#define COLOR_YELLOW_BLUE COLOR_YELLOW + 8
only in patch2:
unchanged:
--- console1/src/console.cpp 2003-01-11 16:17:13.000000000 -0300
+++ console/src/console.cpp 2003-01-11 16:22:06.000000000 -0300
@@ -658,7 +658,7 @@
{
(*iter)->CloseFileTransfer();
delete *iter;
-#undef erase()
+#undef erase
m_lFileStat.erase(iter);
delete e;
return;
D:
D: Make the compiler should do the counts
D:
diff -u console/src/console.cpp console/src/console.cpp
--- console/src/console.cpp 2003-01-11 16:22:06.000000000 -0300
+++ console/src/console.cpp 2003-01-11 16:32:49.000000000 -0300
@@ -24,14 +24,16 @@
#include "licq_languagecodes.h"
#include "licq_countrycodes.h"
+#define NELEM(x) (sizeof(x)/sizeof(*(x)))
+
// Undefine what stupid ncurses defines as wclear(WINDOW *)
#undef clear()
extern "C" const char *LP_Version();
-const unsigned short NUM_STATUS = 13;
-const struct SStatus aStatus[NUM_STATUS] =
- {
+
+const struct SStatus aStatus[] =
+{
{ "online", ICQ_STATUS_ONLINE },
{ "away", ICQ_STATUS_AWAY },
{ "na", ICQ_STATUS_NA },
@@ -45,11 +47,12 @@
{ "*dnd", ICQ_STATUS_DND },
{ "*occupied", ICQ_STATUS_OCCUPIED },
{ "*ffc", ICQ_STATUS_FREEFORCHAT }
- };
+};
+const unsigned short NUM_STATUS = NELEM(aStatus);
-const unsigned short NUM_VARIABLES = 15;
-struct SVariable aVariables[NUM_VARIABLES] =
- {
+
+struct SVariable aVariables[] =
+{
{ "show_offline_users", BOOL, NULL }
, // 0
{ "show_dividers", BOOL, NULL }
@@ -80,9 +83,9 @@
, // 13
{ "command_character", STRING, NULL } // 14
};
+const unsigned short NUM_VARIABLES = NELEM(aVariables);
-const unsigned short NUM_COLORMAPS = 15;
-const struct SColorMap aColorMaps[NUM_COLORMAPS] =
+const struct SColorMap aColorMaps[] =
{
{ "green", COLOR_GREEN, A_NORMAL }
, // 0
@@ -114,6 +117,7 @@
, // 13
{ "bright_yellow", COLOR_YELLOW, A_BOLD } // 14
};
+const unsigned short NUM_COLORMAPS = NELEM(aColorMaps);
const char MLE_HELP[] =
"[ '.' send | '.d/s' force direct/server | '.u' send urgent | ',' abort ]";
D:
D: A gcc-3.2 warning i forgot
D:
diff -u console/src/console.cpp console/src/console.cpp
--- console/src/console.cpp 2003-01-11 16:32:49.000000000 -0300
+++ console/src/console.cpp 2003-01-11 16:36:25.000000000 -0300
@@ -27,7 +27,7 @@
#define NELEM(x) (sizeof(x)/sizeof(*(x)))
// Undefine what stupid ncurses defines as wclear(WINDOW *)
-#undef clear()
+#undef clear
extern "C" const char *LP_Version();
D:
D: use automake version for the plugin version
D:
only in patch2:
unchanged:
--- console1/src/main.cpp 2003-01-11 16:17:17.000000000 -0300
+++ console/src/main.cpp 2003-01-11 20:05:21.000000000 -0300
@@ -10,6 +10,8 @@
#include "console.h"
#include "licq_plugin.h"
+#include "config.h"
+
CLicqConsole *licqConsole;
const char *LP_Usage()
@@ -28,7 +30,7 @@
const char *LP_Version()
{
- static const char version[] = "1.2.1";
+ static const char version[] = VERSION;
return version;
}
D: Fix a buffer overflown in the main command line.
D: the bad thing is that nobody can free the memory...
D:
diff -u console/src/console.cpp console/src/console.cpp
--- console/src/console.cpp 2003-01-11 20:04:47.000000000 -0300
+++ console/src/console.cpp 2003-01-11 22:55:09.000000000 -0300
@@ -1041,11 +1041,33 @@
*-------------------------------------------------------------------------*/
void CLicqConsole::InputCommand(int cIn)
{
- static char szIn[1024];
+ static char *szIn;
static int nPos = 0;
+ static int nSize = 0;
static int nTabs = 0;
static struct STabCompletion sTabCompletion;
+ if( nPos + 1 >= nSize )
+ { /* resize the buffer */
+ char *p;
+
+ if( nSize == 0 )
+ nSize = 1024;
+ else
+ nSize*=2;
+
+ p = (char *) realloc(szIn,nSize);
+ if( p == NULL )
+ {
+ nSize /=2;
+ gLog.Error("%sMemory exhausted! you will lose this char.\n",
+ L_CONSOLExSTR);
+ return;
+ }
+ else
+ szIn = p;
+ }
+
// Now check for keys
switch (cIn)
{