From: Alexey Voinov <voins@voins.program.ru> To: devel@altlinux.ru Cc: Michael Shigorin <mike@osdn.org.ua> Subject: Re: [devel] Q: help with lavaps (c++ part) please Date: Thu, 28 Nov 2002 20:46:08 +0300 Message-ID: <20021128174608.GA2785@voins.local> (raw) In-Reply-To: <20021128122225.GF14732@osdn.org.ua> [-- Attachment #1.1: Type: text/plain, Size: 1056 bytes --] Michael Shigorin wrote > Кто-нибудь сведущий в C++ может чуток помочь с lavaps? > > Сейчас http://osdn.org.ua/~mike/lavaps-1.20-alt2.src.rpm > не собирается с такими жалобами: > <skip> > tcl_blob.cc: In method `void tcl_blob::redraw ()': > tcl_blob.cc:592: cannot convert `const char *' to `char *' in initialization > make[2]: *** [tcl_blob.o] Error 1 > make[2]: Leaving directory `/home/mike/RPM/BUILD/lavaps-1.20' > > [вываливаемся] Кривые руки у этого автора. Я тут немного затычек понаставил, это не настоящий фикс, но варнингов больше нет (ненавижу варнинги) и программа собирается. Разбираться в этой программе подробнее желания нет. (Вообще выглядит забавно, даже весело, но без чтения документации не очень поянтно как всем этим хозяйством управлять :) ) Патч прилагается. -- Best Regards! | Когда вам платят за работу, надо по крайней мере Alexey Voinov | делать вид, что вы работаете... | Б.Виан "Осень в Пекине" voins@voins.program.ru voins@online.ru vns@altlinux.ru [-- Attachment #1.2: lavaps-1.20-alt-voins.patch --] [-- Type: text/plain, Size: 5339 bytes --] --- lavaps-1.20/linux/proc/compare.c.voins 1998-10-03 01:34:07 +0400 +++ lavaps-1.20/linux/proc/compare.c 2002-11-28 20:25:37 +0300 @@ -85,13 +85,13 @@ */ #define CMP_STR(NAME) \ int cmp_ ## NAME(proc_t** P, proc_t** Q) { \ - return strcmp((*P)-> ## NAME, (*Q)-> ## NAME); \ + return strcmp((*P)->NAME, (*Q)->NAME); \ } #define CMP_INT(NAME) \ int cmp_ ## NAME (proc_t** P, proc_t** Q) { \ - if ((*P)-> ## NAME < (*Q)-> ## NAME) return -1; \ - if ((*P)-> ## NAME > (*Q)-> ## NAME) return 1; \ + if ((*P)->NAME < (*Q)->NAME) return -1; \ + if ((*P)->NAME > (*Q)->NAME) return 1; \ return 0; \ } --- lavaps-1.20/linux/proc/version.c.voins 1998-10-03 01:34:07 +0400 +++ lavaps-1.20/linux/proc/version.c 2002-11-28 20:26:13 +0300 @@ -5,6 +5,7 @@ * GNU Library General Public License; see ../COPYING.LIB */ #include <stdio.h> +#include <stdlib.h> #ifdef MINORVERSION char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION; --- lavaps-1.20/tcl2cc/tcl2cc.c.voins 2000-06-06 05:04:15 +0400 +++ lavaps-1.20/tcl2cc/tcl2cc.c 2002-11-28 20:22:40 +0300 @@ -46,6 +46,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> /* strcasecmp() */ #include <ctype.h> @@ -92,9 +93,7 @@ { int nl = 1; int skipping = 0; - int c; - char buf[6]; - int i; + int c = 0; int look_forward = 0; while (1) { --- lavaps-1.20/main.cc.voins 2001-10-31 00:25:57 +0300 +++ lavaps-1.20/main.cc 2002-11-28 20:29:24 +0300 @@ -24,8 +24,8 @@ #include "process_scan.hh" #include <unistd.h> -#include <stdlib.h> -#include <iostream.h> +#include <cstdlib> +#include <iostream> #include <string> --- lavaps-1.20/blob.cc.voins 2001-08-15 19:15:58 +0400 +++ lavaps-1.20/blob.cc 2002-11-28 20:30:54 +0300 @@ -21,11 +21,11 @@ #include "config.h" -#include <stdio.h> // snprintf +#include <cstdio> // snprintf -#include <stdlib.h> // atoi -#include <iostream.h> -#include <assert.h> +#include <cstdlib> // atoi +#include <iostream> +#include <cassert> #include <algorithm> // swap --- lavaps-1.20/process_list.cc.voins 2001-08-15 19:16:19 +0400 +++ lavaps-1.20/process_list.cc 2002-11-28 20:30:29 +0300 @@ -21,8 +21,8 @@ #include "config.h" -#include <stdlib.h> // atoi -#include <iostream.h> +#include <cstdlib> // atoi +#include <iostream> #include <unistd.h> #include <time.h> --- lavaps-1.20/tcl_blob.cc.voins 2001-04-19 19:51:34 +0400 +++ lavaps-1.20/tcl_blob.cc 2002-11-28 20:37:59 +0300 @@ -21,9 +21,9 @@ #ifdef USE_TCL_BLOB -#include <stdlib.h> // atoi +#include <cstdlib> // atoi #include <tcl.h> -#include <iostream.h> +#include <iostream> #include <signal.h> @@ -334,7 +334,7 @@ // const char* appname = "lavaps"; interp_ = Tcl_CreateInterp(); if (Tcl_Init(interp_) == TCL_ERROR) - die(Tcl_GetStringResult(interp_)); + die(const_cast<char*>(Tcl_GetStringResult(interp_))); Tk_Window tk = NULL; if (Tk_Init(interp_) == TCL_OK) tk = Tk_MainWindow(interp_); @@ -344,13 +344,21 @@ /* * add our new commands */ - (void) Tcl_CreateCommand(interp_, "lava_tick", lava_tick_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_id_to_info", lava_id_to_info_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_menu", lava_menu_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_resize", lava_resize_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_dump", lava_dump_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_version", lava_version_proc, NULL, NULL); - (void) Tcl_CreateCommand(interp_, "lava_default_resources", lava_default_resources_proc, NULL, NULL); + typedef int (*tmp_fun_type)(void*, Tcl_Interp*, int, const char**); + (void) Tcl_CreateCommand(interp_, "lava_tick", + reinterpret_cast<tmp_fun_type>(lava_tick_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_id_to_info", + reinterpret_cast<tmp_fun_type>(lava_id_to_info_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_menu", + reinterpret_cast<tmp_fun_type>(lava_menu_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_resize", + reinterpret_cast<tmp_fun_type>(lava_resize_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_dump", + reinterpret_cast<tmp_fun_type>(lava_dump_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_version", + reinterpret_cast<tmp_fun_type>(lava_version_proc), NULL, NULL); + (void) Tcl_CreateCommand(interp_, "lava_default_resources", + reinterpret_cast<tmp_fun_type>(lava_default_resources_proc), NULL, NULL); // (void) Tcl_CreateCommand(interp_, "lava_move", lava_move_proc, NULL, NULL); // (void) Tcl_CreateCommand(interp_, "lava_grow", lava_grow_proc, NULL, NULL); // (void) Tcl_CreateCommand(interp_, "lava_print", lava_print_proc, NULL, NULL); @@ -589,7 +597,7 @@ exit (1); }; if (dark_percentage_) { - char *cp = Tcl_GetStringResult(interp_); + const char *cp = Tcl_GetStringResult(interp_); assert(cp != NULL); assert(*cp != 0); id_ = atoi(cp+1); --- lavaps-1.20/tcl_blob_shape.cc.voins 2001-08-15 19:18:14 +0400 +++ lavaps-1.20/tcl_blob_shape.cc 2002-11-28 20:38:28 +0300 @@ -23,9 +23,9 @@ #ifdef USE_TCL_BLOB -#include <stdlib.h> // atoi +#include <cstdlib> // atoi #include <tcl.h> -#include <iostream.h> +#include <iostream> #include <tcl.h> #include <tk.h> [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2002-11-28 17:46 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-11-28 12:22 Michael Shigorin 2002-11-28 12:35 ` [devel] " Michael Shigorin 2002-11-28 13:19 ` Sergey Bolshakov 2002-11-28 17:46 ` Alexey Voinov [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021128174608.GA2785@voins.local \ --to=voins@voins.program.ru \ --cc=devel@altlinux.ru \ --cc=mike@osdn.org.ua \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git