Browse Source

Fixed notes performance generated cppcheck

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Konstantin Goncharik 10 years ago
parent
commit
7aef5223e1
3 changed files with 3 additions and 7 deletions
  1. 0 1
      app.cpp
  2. 3 5
      cfg.cpp
  3. 0 1
      image.cpp

+ 0 - 1
app.cpp

@@ -1058,7 +1058,6 @@ void App::setBackground(const string& themedir) {
 	image = new Image;
 	bool loaded = image->Read(filename.c_str());
 	if (!loaded){ /* try jpeg if png failed */
-		filename = "";
 		filename = themedir + "/background.jpg";
 		loaded = image->Read(filename.c_str());
 	}

+ 3 - 5
cfg.cpp

@@ -173,7 +173,7 @@ bool Cfg::readConf(string configfile) {
 			n = line.find(op);
 			if (n == 0)
 				options[op] = parseOption(line, op);
-			it++;
+			++it;
 		}
 	}
 	cfgfile.close();
@@ -221,8 +221,7 @@ string Cfg::Trim( const string& s ) {
 /* Return the welcome message with replaced vars */
 string Cfg::getWelcomeMessage(){
 	string s = getOption("welcome_msg");
-	int n = -1;
-	n = s.find("%host");
+	int n = s.find("%host");
 	if (n >= 0) {
 		string tmp = s.substr(0, n);
 		char host[40];
@@ -258,8 +257,7 @@ int Cfg::getIntOption(std::string option) {
 
 /* Get absolute position */
 int Cfg::absolutepos(const string& position, int max, int width) {
-	int n = -1;
-	n = position.find("%");
+	int n = position.find("%");
 	if (n>0) { /* X Position expressed in percentage */
 		int result = (max*string2int(position.substr(0, n).c_str())/100) - (width / 2);
 		return result < 0 ? 0 : result ;

+ 0 - 1
image.cpp

@@ -302,7 +302,6 @@ void Image::Merge_non_crop(Image* background, const int x, const int y)
 
 	double tmp;
 	unsigned char *new_rgb = (unsigned char *)malloc(3 * bg_w * bg_h);
-	memset(new_rgb, 0, 3 * bg_w * bg_h);
 	const unsigned char *bg_rgb = background->getRGBData();
 	int pnl_pos = 0;
 	int bg_pos = 0;