diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-07 23:08:53 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-07 23:08:53 +0100 |
commit | eafe336a8e5580bbd76546970351956810f01d8f (patch) | |
tree | 131b770ca194f2d840208ae9e52ee650b12e75e0 /src/Daemon | |
parent | 5ddcae3c61341e655e98470ceb26dda91b013704 (diff) | |
download | abrt-eafe336a8e5580bbd76546970351956810f01d8f.tar.gz abrt-eafe336a8e5580bbd76546970351956810f01d8f.tar.xz abrt-eafe336a8e5580bbd76546970351956810f01d8f.zip |
*: 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 <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/CommLayerServer.cpp | 18 | ||||
-rw-r--r-- | src/Daemon/CommLayerServer.h | 19 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 18 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.h | 18 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerSocket.cpp | 18 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerSocket.h | 18 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 3 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.h | 3 | ||||
-rw-r--r-- | src/Daemon/Daemon.cpp | 3 | ||||
-rw-r--r-- | src/Daemon/Daemon.h | 3 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 3 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.h | 3 | ||||
-rw-r--r-- | src/Daemon/PluginManager.cpp | 23 | ||||
-rw-r--r-- | src/Daemon/PluginManager.h | 3 | ||||
-rw-r--r-- | src/Daemon/RPM.cpp | 18 | ||||
-rw-r--r-- | src/Daemon/RPM.h | 3 | ||||
-rw-r--r-- | src/Daemon/Settings.cpp | 58 | ||||
-rw-r--r-- | src/Daemon/Settings.h | 18 |
18 files changed, 198 insertions, 52 deletions
diff --git a/src/Daemon/CommLayerServer.cpp b/src/Daemon/CommLayerServer.cpp index d61da399..5e250121 100644 --- a/src/Daemon/CommLayerServer.cpp +++ b/src/Daemon/CommLayerServer.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 "CommLayerServer.h" #include "CrashWatcher.h" diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h index 367c0956..bb33a1e9 100644 --- a/src/Daemon/CommLayerServer.h +++ b/src/Daemon/CommLayerServer.h @@ -1,7 +1,24 @@ +/* + 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 COMMLAYERSERVER_H_ #define COMMLAYERSERVER_H_ -#include <string> #include "abrtlib.h" #include "CrashTypes.h" diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index f2471586..6dfc48b7 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.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 <dbus/dbus.h> #include "abrtlib.h" #include "abrt_dbus.h" diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h index 9bd77666..4fecf1be 100644 --- a/src/Daemon/CommLayerServerDBus.h +++ b/src/Daemon/CommLayerServerDBus.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 COMMLAYERSERVERDBUS_H_ #define COMMLAYERSERVERDBUS_H_ diff --git a/src/Daemon/CommLayerServerSocket.cpp b/src/Daemon/CommLayerServerSocket.cpp index ab880fb2..1e8bf6ee 100644 --- a/src/Daemon/CommLayerServerSocket.cpp +++ b/src/Daemon/CommLayerServerSocket.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 <sys/socket.h> #include <sys/un.h> #include "abrtlib.h" diff --git a/src/Daemon/CommLayerServerSocket.h b/src/Daemon/CommLayerServerSocket.h index c511954c..40f6f892 100644 --- a/src/Daemon/CommLayerServerSocket.h +++ b/src/Daemon/CommLayerServerSocket.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. +*/ #include "CommLayerServer.h" #include "DBusCommon.h" #include <glib.h> diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 93365f3b..4d68a811 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -15,8 +15,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 "Daemon.h" #include "ABRTException.h" diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 31b72e08..eaf24997 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -15,8 +15,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 CRASHWATCHER_H_ #define CRASHWATCHER_H_ diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 99214230..704d2c35 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -15,8 +15,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 <syslog.h> #include <pthread.h> #include <resolv.h> /* res_init */ diff --git a/src/Daemon/Daemon.h b/src/Daemon/Daemon.h index ac998b93..67a97ca7 100644 --- a/src/Daemon/Daemon.h +++ b/src/Daemon/Daemon.h @@ -15,8 +15,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 DAEMON_H_ #define DAEMON_H_ diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index ebd5c0fc..e0687fd5 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.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 "abrt_types.h" #include "Daemon.h" diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h index aa37e3ed..94f9fb99 100644 --- a/src/Daemon/MiddleWare.h +++ b/src/Daemon/MiddleWare.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 MIDDLEWARE_H_ #define MIDDLEWARE_H_ diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 5166c6a4..e63cb3ac 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.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 <fstream> -#include <iostream> +*/ #include <dlfcn.h> #include "abrtlib.h" #include "ABRTException.h" @@ -85,23 +82,21 @@ static const char *const plugin_type_str[] = { bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings) { - ifstream fIn; - fIn.open(pPath); - if (!fIn.is_open()) + FILE *fp = fopen(pPath, "r"); + if (!fp) return false; - string line; - while (!fIn.eof()) + char line[512]; + while (fgets(line, sizeof(line), fp)) { - getline(fIn, line); - - int ii; + strchrnul(line, '\n')[0] = '\0'; + unsigned ii; bool is_value = false; bool valid = false; bool in_quote = false; string key; string value; - for (ii = 0; ii < line.length(); ii++) + for (ii = 0; line[ii] != '\0'; ii++) { if (line[ii] == '"') { @@ -135,7 +130,7 @@ bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings) pSettings[key] = value; } } - fIn.close(); + fclose(fp); return true; } diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h index 8eebe7da..b5dcebc5 100644 --- a/src/Daemon/PluginManager.h +++ b/src/Daemon/PluginManager.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 PLUGINMANAGER_H_ #define PLUGINMANAGER_H_ diff --git a/src/Daemon/RPM.cpp b/src/Daemon/RPM.cpp index 6cc0ba68..c40f9a07 100644 --- a/src/Daemon/RPM.cpp +++ b/src/Daemon/RPM.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 "RPM.h" #include "CommLayerInner.h" diff --git a/src/Daemon/RPM.h b/src/Daemon/RPM.h index fed5e43d..4df868da 100644 --- a/src/Daemon/RPM.h +++ b/src/Daemon/RPM.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 RPM_H_ #define RPM_H_ diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp index 725c0d2a..9b0376b3 100644 --- a/src/Daemon/Settings.cpp +++ b/src/Daemon/Settings.cpp @@ -1,4 +1,21 @@ -#include <fstream> +/* + 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 "Settings.h" #include "abrtlib.h" #include "abrt_types.h" @@ -243,46 +260,45 @@ static void ParseAnalyzerActionsAndReporters() static void LoadGPGKeys() { - std::ifstream fIn; - fIn.open(CONF_DIR"/gpg_keys"); - if (fIn.is_open()) + FILE *fp = fopen(CONF_DIR"/gpg_keys", "r"); + if (fp) { - std::string line; /* every line is one key - FIXME: make it more robust, it doesn't handle comments - */ - while (fIn.good()) + * FIXME: make it more robust, it doesn't handle comments + */ + char line[512]; + while (fgets(line, sizeof(line), fp)) { - getline(fIn, line); if (line[0] == '/') // probably the begining of path, so let's handle it as a key + { + strchrnul(line, '\n')[0] = '\0'; g_settings_setOpenGPGPublicKeys.insert(line); + } } - fIn.close(); + fclose(fp); } } /* abrt daemon loads .conf file */ void LoadSettings() { - std::ifstream fIn; - fIn.open(CONF_DIR"/abrt.conf"); - if (fIn.is_open()) + FILE *fp = fopen(CONF_DIR"/abrt.conf", "r"); + if (fp) { - std::string line; + char line[512]; std::string section; - while (fIn.good()) + while (fgets(line, sizeof(line), fp)) { - getline(fIn, line); - - unsigned int ii; + strchrnul(line, '\n')[0] = '\0'; + unsigned ii; bool is_key = true; bool is_section = false; bool is_quote = false; std::string key; std::string value; - for (ii = 0; ii < line.length(); ii++) + for (ii = 0; line[ii] != '\0'; ii++) { - if (is_quote && line[ii] == '\\' && ii+1 < line.length()) + if (is_quote && line[ii] == '\\' && line[ii+1] != '\0') { value += line[ii]; ii++; @@ -355,7 +371,7 @@ void LoadSettings() } } } - fIn.close(); + fclose(fp); } ParseCommon(); ParseAnalyzerActionsAndReporters(); diff --git a/src/Daemon/Settings.h b/src/Daemon/Settings.h index 3fdb8b9d..cd3179d2 100644 --- a/src/Daemon/Settings.h +++ b/src/Daemon/Settings.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 SETTINGS_H_ #define SETTINGS_H_ |