mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-04 09:42:42 +01:00 
			
		
		
		
	Fix a few compiler warnings
There was one uninitialized value warning and two mismatched-sign
compare warnings. They both appear valid, the first occurring when MPD's
"format-stopped" contains {songPosition} or {queueLength} and the second
occurring when the clock's "timezones" array is more than 2 billion
items long (not likely, I admit). Fix both issues.
			
			
This commit is contained in:
		@@ -85,13 +85,11 @@ bool waybar::modules::Clock::handleScroll(GdkEventScroll *e) {
 | 
				
			|||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  auto nr_zones = config_["timezones"].size();
 | 
					  auto nr_zones = config_["timezones"].size();
 | 
				
			||||||
  int new_idx = time_zone_idx_ + ((dir == SCROLL_DIR::UP) ? 1 : -1);
 | 
					  if (dir == SCROLL_DIR::UP) {
 | 
				
			||||||
  if (new_idx < 0) {
 | 
					    size_t new_idx = time_zone_idx_ + 1;
 | 
				
			||||||
    time_zone_idx_ = nr_zones - 1;
 | 
					    time_zone_idx_ = new_idx == nr_zones ? 0 : new_idx;
 | 
				
			||||||
  } else if (new_idx >= nr_zones) {
 | 
					 | 
				
			||||||
    time_zone_idx_ = 0;
 | 
					 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    time_zone_idx_ = new_idx;
 | 
					    time_zone_idx_ = time_zone_idx_ == 0 ? nr_zones - 1 : time_zone_idx_ - 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  auto zone_name = config_["timezones"][time_zone_idx_];
 | 
					  auto zone_name = config_["timezones"][time_zone_idx_];
 | 
				
			||||||
  if (!zone_name.isString() || zone_name.empty()) {
 | 
					  if (!zone_name.isString() || zone_name.empty()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,7 +100,7 @@ void waybar::modules::MPD::setLabel() {
 | 
				
			|||||||
  auto format = format_;
 | 
					  auto format = format_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  std::string          artist, album_artist, album, title, date;
 | 
					  std::string          artist, album_artist, album, title, date;
 | 
				
			||||||
  int                  song_pos, queue_length;
 | 
					  int                  song_pos = 0, queue_length = 0;
 | 
				
			||||||
  std::chrono::seconds elapsedTime, totalTime;
 | 
					  std::chrono::seconds elapsedTime, totalTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  std::string stateIcon = "";
 | 
					  std::string stateIcon = "";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user