From eafe336a8e5580bbd76546970351956810f01d8f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 7 Feb 2010 23:08:53 +0100 Subject: *: remove all usages of C++ streams (-10k in code size) Also add copyright banners to all files which were missing them Signed-off-by: Denys Vlasenko --- lib/Plugins/Bugzilla.cpp | 20 +++++++++++++++++- lib/Plugins/Bugzilla.h | 18 +++++++++++++++++ lib/Plugins/CCpp.cpp | 46 +++++++++++++++++++----------------------- lib/Plugins/CCpp.h | 5 ++--- lib/Plugins/Catcut.cpp | 18 +++++++++++++++++ lib/Plugins/Catcut.h | 18 +++++++++++++++++ lib/Plugins/FileTransfer.cpp | 3 +-- lib/Plugins/FileTransfer.h | 3 +-- lib/Plugins/Firefox.cpp | 5 +---- lib/Plugins/Firefox.h | 3 +-- lib/Plugins/Logger.cpp | 5 +---- lib/Plugins/Logger.h | 3 +-- lib/Plugins/Mailx.cpp | 5 +---- lib/Plugins/Mailx.h | 3 +-- lib/Plugins/Python.cpp | 18 +++++++++++++++++ lib/Plugins/Python.h | 18 +++++++++++++++++ lib/Plugins/RunApp.cpp | 3 +-- lib/Plugins/RunApp.h | 3 +-- lib/Plugins/SOSreport.cpp | 2 -- lib/Plugins/SOSreport.h | 3 +-- lib/Plugins/SQLite3.cpp | 4 +--- lib/Plugins/SQLite3.h | 3 +-- lib/Plugins/TicketUploader.cpp | 3 +-- lib/Plugins/TicketUploader.h | 3 +-- 24 files changed, 147 insertions(+), 68 deletions(-) (limited to 'lib/Plugins') diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index fa6b35e4..b809e34c 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #include #include #include "abrtlib.h" @@ -185,7 +203,7 @@ void ctx::add_plus_one_cc(uint32_t bug_id, const char* login) xmlrpc_env env; xmlrpc_env_init(&env); - xmlrpc_value* param = xmlrpc_build_value(&env, "({s:i,s:{s:(s)}})", "ids", bug_id, "updates", "add_cc", login); + xmlrpc_value* param = xmlrpc_build_value(&env, "({s:i,s:{s:(s)}})", "ids", bug_id, "updates", "add_cc", login); throw_if_xml_fault_occurred(&env); // failed to allocate memory xmlrpc_value* result = NULL; diff --git a/lib/Plugins/Bugzilla.h b/lib/Plugins/Bugzilla.h index 571d0c60..7ee7b01d 100644 --- a/lib/Plugins/Bugzilla.h +++ b/lib/Plugins/Bugzilla.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef BUGZILLA_H_ #define BUGZILLA_H_ diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 50423b7c..7b3eab1c 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -17,10 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include +*/ #include #include //#include @@ -702,21 +699,21 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) { perror_msg("abrt-backtrace not executed properly, " "status: %x signal: %d", status, WIFSIGNALED(status)); - } + } else { int exit_status = WEXITSTATUS(status); if (exit_status == 79) /* EX_PARSINGFAILED */ { - /* abrt-backtrace returns alternative backtrace - representation in this case, so everything will work + /* abrt-backtrace returns alternative backtrace + representation in this case, so everything will work as expected except worse duplication detection */ log_msg("abrt-backtrace failed to parse the backtrace"); } else if (exit_status == 80) /* EX_THREADDETECTIONFAILED */ { - /* abrt-backtrace returns backtrace with all threads - in this case, so everything will work as expected + /* abrt-backtrace returns backtrace with all threads + in this case, so everything will work as expected except worse duplication detection */ log_msg("abrt-backtrace failed to determine crash frame"); } @@ -890,12 +887,13 @@ static int set_limits() void CAnalyzerCCpp::Init() { - ifstream fInCorePattern; - fInCorePattern.open(CORE_PATTERN_IFACE); - if (fInCorePattern.is_open()) + FILE *fp = fopen(CORE_PATTERN_IFACE, "r"); + if (fp) { - getline(fInCorePattern, m_sOldCorePattern); - fInCorePattern.close(); + char line[PATH_MAX]; + if (fgets(line, sizeof(line), fp)) + m_sOldCorePattern = line; + fclose(fp); } if (m_sOldCorePattern[0] == '|') { @@ -915,28 +913,26 @@ void CAnalyzerCCpp::Init() } } #ifdef HOSTILE_KERNEL - if(set_limits() != 0) + if (set_limits() != 0) log("warning: failed to set core_size limit, ABRT won't detect crashes in" "compiled apps"); #endif - ofstream fOutCorePattern; - fOutCorePattern.open(CORE_PATTERN_IFACE); - if (fOutCorePattern.is_open()) + fp = fopen(CORE_PATTERN_IFACE, "w"); + if (fp) { - fOutCorePattern << CORE_PATTERN << endl; - fOutCorePattern.close(); + fputs(CORE_PATTERN, fp); + fclose(fp); } } void CAnalyzerCCpp::DeInit() { - ofstream fOutCorePattern; - fOutCorePattern.open(CORE_PATTERN_IFACE); - if (fOutCorePattern.is_open()) + FILE *fp = fopen(CORE_PATTERN_IFACE, "w"); + if (fp) { - fOutCorePattern << m_sOldCorePattern << endl; - fOutCorePattern.close(); + fputs(m_sOldCorePattern.c_str(), fp); + fclose(fp); } } diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h index 03ba5ee4..afdc2c6e 100644 --- a/lib/Plugins/CCpp.h +++ b/lib/Plugins/CCpp.h @@ -1,6 +1,6 @@ /* CCpp.h - header file for C/C++ analyzer plugin - - it can ger UUID and memory maps from core files + - it can get UUID and memory maps from core files Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) Copyright (C) 2009 RedHat inc. @@ -18,8 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef CCPP_H_ #define CCPP_H_ diff --git a/lib/Plugins/Catcut.cpp b/lib/Plugins/Catcut.cpp index badca4b4..48546367 100644 --- a/lib/Plugins/Catcut.cpp +++ b/lib/Plugins/Catcut.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #include "abrtlib.h" #include "abrt_xmlrpc.h" #include "Catcut.h" diff --git a/lib/Plugins/Catcut.h b/lib/Plugins/Catcut.h index 65c70444..427dd375 100644 --- a/lib/Plugins/Catcut.h +++ b/lib/Plugins/Catcut.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef CATCUT_H_ #define CATCUT_H_ diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp index 5479f9fb..8f5bc6db 100644 --- a/lib/Plugins/FileTransfer.cpp +++ b/lib/Plugins/FileTransfer.cpp @@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif diff --git a/lib/Plugins/FileTransfer.h b/lib/Plugins/FileTransfer.h index 2548c506..8f77223d 100644 --- a/lib/Plugins/FileTransfer.h +++ b/lib/Plugins/FileTransfer.h @@ -18,8 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef FILETRANSFER_H_ #define FILETRANSFER_H_ diff --git a/lib/Plugins/Firefox.cpp b/lib/Plugins/Firefox.cpp index 7bee46dc..3cb9c938 100644 --- a/lib/Plugins/Firefox.cpp +++ b/lib/Plugins/Firefox.cpp @@ -17,10 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include +*/ #include #include #include diff --git a/lib/Plugins/Firefox.h b/lib/Plugins/Firefox.h index dd7758d9..d3f67ba4 100644 --- a/lib/Plugins/Firefox.h +++ b/lib/Plugins/Firefox.h @@ -18,8 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef CCPP_H_ #define CCPP_H_ diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index 3424d73d..a0c23645 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -17,10 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include +*/ #include "abrtlib.h" #include "Logger.h" #include "DebugDump.h" diff --git a/lib/Plugins/Logger.h b/lib/Plugins/Logger.h index 02429b2c..8801dd4f 100644 --- a/lib/Plugins/Logger.h +++ b/lib/Plugins/Logger.h @@ -18,8 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef LOGGER_H_ #define LOGGER_H_ diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index 2ee96455..50bc3920 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -17,10 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - -#include +*/ #include "abrtlib.h" #include "Mailx.h" #include "DebugDump.h" diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h index 619e349c..c71d83d8 100644 --- a/lib/Plugins/Mailx.h +++ b/lib/Plugins/Mailx.h @@ -18,8 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef MAILX_H_ #define MAILX_H_ diff --git a/lib/Plugins/Python.cpp b/lib/Plugins/Python.cpp index ad954681..cf4d81e2 100644 --- a/lib/Plugins/Python.cpp +++ b/lib/Plugins/Python.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #include "abrtlib.h" #include "Python.h" #include "DebugDump.h" diff --git a/lib/Plugins/Python.h b/lib/Plugins/Python.h index 82f52c05..6de2cbbe 100644 --- a/lib/Plugins/Python.h +++ b/lib/Plugins/Python.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef PYTHON_H_ #define PYTHON_H_ diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp index ecbecf20..c7d5183b 100644 --- a/lib/Plugins/RunApp.cpp +++ b/lib/Plugins/RunApp.cpp @@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #include "abrtlib.h" #include "RunApp.h" #include "DebugDump.h" diff --git a/lib/Plugins/RunApp.h b/lib/Plugins/RunApp.h index da465f89..390b60a2 100644 --- a/lib/Plugins/RunApp.h +++ b/lib/Plugins/RunApp.h @@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef RUNAPP_H_ #define RUNAPP_H_ diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp index bc71e236..188d16d6 100644 --- a/lib/Plugins/SOSreport.cpp +++ b/lib/Plugins/SOSreport.cpp @@ -17,8 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -//#include -//#include #include "abrtlib.h" #include "abrt_types.h" #include "ABRTException.h" diff --git a/lib/Plugins/SOSreport.h b/lib/Plugins/SOSreport.h index bd08eee1..d5c44235 100644 --- a/lib/Plugins/SOSreport.h +++ b/lib/Plugins/SOSreport.h @@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef SOSREPORT_H_ #define SOSREPORT_H_ diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp index 80cbd82b..97f99b68 100644 --- a/lib/Plugins/SQLite3.cpp +++ b/lib/Plugins/SQLite3.cpp @@ -17,10 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #include -#include #include "abrtlib.h" #include "SQLite3.h" #include "ABRTException.h" diff --git a/lib/Plugins/SQLite3.h b/lib/Plugins/SQLite3.h index dfebf5d7..d4b321a2 100644 --- a/lib/Plugins/SQLite3.h +++ b/lib/Plugins/SQLite3.h @@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef SQLITE3_H_ #define SQLITE3_H_ diff --git a/lib/Plugins/TicketUploader.cpp b/lib/Plugins/TicketUploader.cpp index d924b916..a7151b5e 100644 --- a/lib/Plugins/TicketUploader.cpp +++ b/lib/Plugins/TicketUploader.cpp @@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#include +*/ #include "abrtlib.h" #include "abrt_xmlrpc.h" /* for xcurl_easy_init */ #include "TicketUploader.h" diff --git a/lib/Plugins/TicketUploader.h b/lib/Plugins/TicketUploader.h index a719d0bd..402e2ccf 100644 --- a/lib/Plugins/TicketUploader.h +++ b/lib/Plugins/TicketUploader.h @@ -20,8 +20,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +*/ #ifndef TICKETUPLOADER_H_ #define TICKETUPLOADER_H_ -- cgit