Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 3521 Details for
Bug 6991
colortail segfaults under newer gcc builds
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Attachment per request.
colortail.patch (text/plain), 8.47 KB, created by
Paul Giordano
on 2002-08-28 21:55:42 UTC
(
hide
)
Description:
Attachment per request.
Filename:
MIME Type:
Creator:
Paul Giordano
Created:
2002-08-28 21:55:42 UTC
Size:
8.47 KB
patch
obsolete
>diff -Naur colortail-0.3.0/CfgFileParser.cc colortail-0.3.0-new/CfgFileParser.cc >--- colortail-0.3.0/CfgFileParser.cc Tue Aug 3 14:40:44 1999 >+++ colortail-0.3.0-new/CfgFileParser.cc Sat Aug 24 16:03:58 2002 >@@ -19,12 +19,12 @@ > > #include "CfgFileParser.h" > >-#include <stdio.h> >-#include <fstream.h> >+#include <iostream> > #include <assert.h> >-#include <string.h> >+#include <string> > #include <malloc.h> > >+using namespace std; > > // ## class SearchData ## > >@@ -499,7 +499,7 @@ > > > >-int CfgFileParser::parse(char *filename) >+int CfgFileParser::parse(const char *filename) > { > // parses the cfg file and sets up the list of SearchData elements > // returns number of SearchData items created >diff -Naur colortail-0.3.0/CfgFileParser.h colortail-0.3.0-new/CfgFileParser.h >--- colortail-0.3.0/CfgFileParser.h Tue Aug 3 14:40:52 1999 >+++ colortail-0.3.0-new/CfgFileParser.h Sat Aug 24 16:03:21 2002 >@@ -25,7 +25,8 @@ > > #include <sys/types.h> > #include <regex.h> >-#include <fstream.h> >+#include <iostream> >+#include <fstream> > > #ifdef HAVE_GNUREGEX_H > # include <gnuregex.h> >@@ -80,7 +81,7 @@ > { > private: > List<SearchData*> *m_items_list; >- ifstream m_infile; >+ std::ifstream m_infile; > char *m_filename; > int m_line; > >@@ -97,7 +98,7 @@ > CfgFileParser(); > ~CfgFileParser(); > >- int parse(char *filename); >+ int parse(const char *filename); > List<SearchData*>* get_items_list(); > }; > >diff -Naur colortail-0.3.0/ColorTail.cc colortail-0.3.0-new/ColorTail.cc >--- colortail-0.3.0/ColorTail.cc Tue Aug 3 14:41:02 1999 >+++ colortail-0.3.0-new/ColorTail.cc Sat Aug 24 15:28:21 2002 >@@ -17,7 +17,7 @@ > Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > >-#include <iostream.h> >+#include <iostream> > #include <assert.h> > #include <unistd.h> > >@@ -26,6 +26,7 @@ > #include "OptionsParser.h" > #include "Colorizer.h" > >+using namespace std; > > // the constructor > ColorTail::ColorTail() >diff -Naur colortail-0.3.0/Colorizer.cc colortail-0.3.0-new/Colorizer.cc >--- colortail-0.3.0/Colorizer.cc Tue Aug 3 14:41:17 1999 >+++ colortail-0.3.0-new/Colorizer.cc Sat Aug 24 16:07:33 2002 >@@ -22,9 +22,10 @@ > #include "TailFile.h" > > #include <assert.h> >-#include <stdio.h> >-#include <strstream.h> >+#include <iostream> >+#include <string> > >+using namespace std; > > Colorizer::Colorizer() > { >@@ -58,7 +59,7 @@ > } > > >-Colorizer::Colorizer(char *cfg_file) >+Colorizer::Colorizer(const char *cfg_file) > { > // other constructor > >@@ -85,7 +86,7 @@ > free_items(); > } > >-char* Colorizer::colorize(char *str) >+const char* Colorizer::colorize(const char *str) > { > // colorize the string, returns a new string containing > // the colorized version of str >@@ -111,7 +112,7 @@ > ListIterator<SearchData*> itr(*m_items_list); > > // will contain the new string >- ostrstream newstr; >+ ostringstream newstr; > > SearchData *current; > int i = 0; >@@ -174,7 +175,7 @@ > // write ansi reset str and a newline > newstr << ANSI_RESET_STR << endl << ends; > // return the new string >- return newstr.str(); >+ return newstr.str().c_str(); > } > } > } >@@ -196,7 +197,7 @@ > } > > // return the new string >- return newstr.str(); >+ return newstr.str().c_str(); > } > > // did we find submatches? >@@ -250,7 +251,7 @@ > // cout << "DEBUG: " << bla << " END DEBUG" << endl; > > >- return newstr.str(); >+ return newstr.str().c_str(); > > } > >diff -Naur colortail-0.3.0/Colorizer.h colortail-0.3.0-new/Colorizer.h >--- colortail-0.3.0/Colorizer.h Tue Aug 3 14:41:25 1999 >+++ colortail-0.3.0-new/Colorizer.h Sat Aug 24 16:07:43 2002 >@@ -35,10 +35,10 @@ > Colorizer(); > > public: >- Colorizer(char *cfg_file); >+ Colorizer(const char *cfg_file); > ~Colorizer(); > >- char* colorize(char *str); >+ const char* colorize(const char *str); > }; > > >diff -Naur colortail-0.3.0/Info.cc colortail-0.3.0-new/Info.cc >--- colortail-0.3.0/Info.cc Tue Aug 3 14:41:38 1999 >+++ colortail-0.3.0-new/Info.cc Sat Aug 24 15:58:29 2002 >@@ -17,11 +17,13 @@ > Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > >-#include <iostream.h> >+#include <iostream> > > #include "Info.h" > #include "config.h" > >+using namespace std; >+ > Info::Info() > { > } >diff -Naur colortail-0.3.0/OptionsParser.cc colortail-0.3.0-new/OptionsParser.cc >--- colortail-0.3.0/OptionsParser.cc Wed Aug 4 18:23:39 1999 >+++ colortail-0.3.0-new/OptionsParser.cc Sat Aug 24 15:59:41 2002 >@@ -17,8 +17,8 @@ > Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > >-#include <iostream.h> >-#include <strstream.h> >+#include <iostream> >+#include <sstream> > #include <string.h> > #include <stdio.h> > #include <stdlib.h> >@@ -27,6 +27,7 @@ > #include "Info.h" > #include "Usage.h" > >+using namespace std; > // methods for class Options > > Options::Options() >@@ -130,7 +131,7 @@ > int loop = 1; > while (loop) > { >- ostrstream filename; >+ ostringstream filename; > > while (1) > { >@@ -138,7 +139,7 @@ > { > // found seperator > // set filename in options class >- o->cfg_filenames[o->nr_cfg_files] = filename.str(); >+ o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str(); > > // increase the nr_cfg_files counter > (o->nr_cfg_files)++; >@@ -154,7 +155,7 @@ > { > // found end of string > // set filename in options class >- o->cfg_filenames[o->nr_cfg_files] = filename.str(); >+ o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str(); > > // increase the nr_cfg_files counter > (o->nr_cfg_files)++; >diff -Naur colortail-0.3.0/OptionsParser.h colortail-0.3.0-new/OptionsParser.h >--- colortail-0.3.0/OptionsParser.h Wed Aug 4 18:33:08 1999 >+++ colortail-0.3.0-new/OptionsParser.h Sat Aug 24 16:00:42 2002 >@@ -77,7 +77,7 @@ > int color; > int rows; > int verbose; >- char *cfg_filenames[MAX_FILES]; >+ const char *cfg_filenames[MAX_FILES]; > int nr_cfg_files; > int global_cfg_file; > >diff -Naur colortail-0.3.0/TailFile.cc colortail-0.3.0-new/TailFile.cc >--- colortail-0.3.0/TailFile.cc Wed Aug 4 18:09:38 1999 >+++ colortail-0.3.0-new/TailFile.cc Sat Aug 24 16:08:12 2002 >@@ -17,7 +17,7 @@ > Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > >-#include <iostream.h> >+#include <iostream> > #include <string.h> > #include <stdio.h> > #include <sys/stat.h> >@@ -25,6 +25,8 @@ > > #include "TailFile.h" > >+using namespace std; >+ > TailFile::TailFile() > { > m_filename = NULL; >@@ -375,7 +377,7 @@ > // check if there isn't a follow buffer > if (m_follow_buffer == NULL) > { >- m_follow_buffer = new ostrstream(); >+ m_follow_buffer = new ostringstream(); > } > > // make buffer >@@ -454,7 +456,7 @@ > m_follow_buffer->put('\0'); > > // get the string >- char *str = m_follow_buffer->str(); >+ const char *str = m_follow_buffer->str().c_str(); > > // print the line > print_to_stdout(str); >@@ -560,7 +562,7 @@ > // delete buf; > } > >-void TailFile::print_to_stdout(char *str) >+void TailFile::print_to_stdout(const char *str) > { > // checks if there is a colorizer. If so the string is colorized > // before it's printed. If not the string isn't colorized. >@@ -575,7 +577,7 @@ > if (m_colorizer) > { > // colorize the string >- char *buf = m_colorizer->colorize(str); >+ const char *buf = m_colorizer->colorize(str); > // print the new colorized string > cout << buf; > // free the mem >diff -Naur colortail-0.3.0/TailFile.h colortail-0.3.0-new/TailFile.h >--- colortail-0.3.0/TailFile.h Tue Aug 3 14:42:33 1999 >+++ colortail-0.3.0-new/TailFile.h Sat Aug 24 16:06:00 2002 >@@ -23,7 +23,7 @@ > #include "Colorizer.h" > > #include <stdio.h> >-#include <strstream.h> >+#include <sstream> > > #define MAX_CHARS_READ 1024 > >@@ -40,12 +40,12 @@ > // the stream position > long m_position; > // the follow buffer, used in follow_print >- ostrstream *m_follow_buffer; >+ std::ostringstream *m_follow_buffer; > > // private methods > void find_position(int n); > long end_of_file_position(); >- void print_to_stdout(char *str); >+ void print_to_stdout(const char *str); > > // methods > public: >diff -Naur colortail-0.3.0/Usage.cc colortail-0.3.0-new/Usage.cc >--- colortail-0.3.0/Usage.cc Wed Aug 4 18:44:37 1999 >+++ colortail-0.3.0-new/Usage.cc Sat Aug 24 16:08:35 2002 >@@ -17,10 +17,12 @@ > Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > >-#include <iostream.h> >+#include <iostream> > > #include "Usage.h" > >+using namespace std; >+ > Usage::Usage() > { > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 6991
: 3521