mirror of
https://github.com/glest/glest-source.git
synced 2025-08-19 22:51:24 +02:00
- phase 2 of cppcheck verbose fixes
This commit is contained in:
@@ -238,7 +238,7 @@ void findDirs(string path, vector<string> &results, bool errorOnNotFound,bool ke
|
||||
string searchpath = currentPath + "*.";
|
||||
vector<string> current_results;
|
||||
findAll(searchpath, current_results, false, errorOnNotFound);
|
||||
if(current_results.size() > 0) {
|
||||
if(current_results.empty() == false) {
|
||||
for(unsigned int folder_index = 0; folder_index < current_results.size(); folder_index++) {
|
||||
const string current_folder = current_results[folder_index];
|
||||
const string current_folder_path = currentPath + current_folder;
|
||||
@@ -263,7 +263,7 @@ void findDirs(const vector<string> &paths, vector<string> &results, bool errorOn
|
||||
string path = currentPath + "*.";
|
||||
vector<string> current_results;
|
||||
findAll(path, current_results, false, errorOnNotFound);
|
||||
if(current_results.size() > 0) {
|
||||
if(current_results.empty() == false) {
|
||||
for(unsigned int folder_index = 0; folder_index < current_results.size(); folder_index++) {
|
||||
const string current_folder = current_results[folder_index];
|
||||
const string current_folder_path = currentPath + current_folder;
|
||||
@@ -290,7 +290,7 @@ void findAll(const vector<string> &paths, const string &fileFilter, vector<strin
|
||||
string path = currentPath + fileFilter;
|
||||
vector<string> current_results;
|
||||
findAll(path, current_results, cutExtension, errorOnNotFound);
|
||||
if(current_results.size() > 0) {
|
||||
if(current_results.empty() == false) {
|
||||
for(unsigned int folder_index = 0; folder_index < current_results.size(); folder_index++) {
|
||||
string current_file = current_results[folder_index];
|
||||
if(keepDuplicates == true || std::find(results.begin(),results.end(),current_file) == results.end()) {
|
||||
@@ -347,7 +347,7 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
||||
|
||||
globfree(&globbuf);
|
||||
|
||||
if(results.size() == 0 && errorOnNotFound == true) {
|
||||
if(results.empty() == true && errorOnNotFound == true) {
|
||||
throw runtime_error("No files found in: " + mypath);
|
||||
}
|
||||
|
||||
|
@@ -591,7 +591,7 @@ string getNetworkInterfaceBroadcastAddress(string ipAddress)
|
||||
next = next->Next;
|
||||
}
|
||||
}
|
||||
char buf[128];
|
||||
//char buf[128];
|
||||
if (name == NULL)
|
||||
{
|
||||
//sprintf(buf, "unnamed-%i", i);
|
||||
@@ -901,7 +901,7 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
|
||||
|
||||
PLATFORM_SOCKET imaxsocket = 0;
|
||||
for(std::map<PLATFORM_SOCKET,bool>::iterator itermap = socketTriggeredList.begin();
|
||||
itermap != socketTriggeredList.end(); itermap++)
|
||||
itermap != socketTriggeredList.end(); ++itermap)
|
||||
{
|
||||
PLATFORM_SOCKET socket = itermap->first;
|
||||
if(Socket::isSocketValid(&socket) == true)
|
||||
@@ -933,7 +933,7 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
|
||||
bResult = true;
|
||||
|
||||
for(std::map<PLATFORM_SOCKET,bool>::iterator itermap = socketTriggeredList.begin();
|
||||
itermap != socketTriggeredList.end(); itermap++)
|
||||
itermap != socketTriggeredList.end(); ++itermap)
|
||||
{
|
||||
PLATFORM_SOCKET socket = itermap->first;
|
||||
if (FD_ISSET(socket, &rfds))
|
||||
@@ -1741,10 +1741,9 @@ void BroadCastClientSocketThread::execute() {
|
||||
struct sockaddr_in bcSender; // local socket address for the broadcast.
|
||||
struct sockaddr_in bcaddr; // The broadcast address for the receiver.
|
||||
PLATFORM_SOCKET bcfd; // The file descriptor used for the broadcast.
|
||||
bool one = true; // Parameter for "setscokopt".
|
||||
//bool one = true; // Parameter for "setscokopt".
|
||||
char buff[10024]; // Buffers the data to be broadcasted.
|
||||
socklen_t alen;
|
||||
int nb; // The number of bytes read.
|
||||
|
||||
port = htons( Socket::getBroadCastPort() );
|
||||
|
||||
@@ -1780,6 +1779,7 @@ void BroadCastClientSocketThread::execute() {
|
||||
// Keep getting packets forever.
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 5; ) {
|
||||
alen = sizeof(struct sockaddr);
|
||||
int nb=0; // The number of bytes read.
|
||||
bool gotData = (nb = recvfrom(bcfd, buff, 10024, 0, (struct sockaddr *) &bcSender, &alen)) > 0;
|
||||
|
||||
if(gotData == false) {
|
||||
@@ -2316,11 +2316,11 @@ void BroadCastSocketThread::execute() {
|
||||
char buff[buffMaxSize]=""; // Buffers the data to be broadcasted.
|
||||
char myhostname[100]=""; // hostname of local machine
|
||||
//char subnetmask[MAX_NIC_COUNT][100]; // Subnet mask to broadcast to
|
||||
struct hostent* myhostent=NULL;
|
||||
//struct hostent* myhostent=NULL;
|
||||
|
||||
/* get my host name */
|
||||
gethostname(myhostname,100);
|
||||
myhostent = gethostbyname(myhostname);
|
||||
struct hostent*myhostent = gethostbyname(myhostname);
|
||||
|
||||
// get all host IP addresses
|
||||
std::vector<std::string> ipList = Socket::getLocalIPAddressList();
|
||||
|
@@ -370,7 +370,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, newStencilBits);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, newDepthBits);
|
||||
|
||||
const SDL_VideoInfo *info = SDL_GetVideoInfo();
|
||||
//const SDL_VideoInfo *info = SDL_GetVideoInfo();
|
||||
#ifdef SDL_GL_SWAP_CONTROL
|
||||
if(Window::tryVSynch == true) {
|
||||
/* we want vsync for smooth scrolling */
|
||||
@@ -424,10 +424,10 @@ void Window::toggleFullscreen() {
|
||||
SDL_Surface *sf = SDL_GetVideoSurface();
|
||||
SDL_Surface **surface = &sf;
|
||||
uint32 *flags = NULL;
|
||||
void *pixels = NULL;
|
||||
SDL_Color *palette = NULL;
|
||||
//void *pixels = NULL;
|
||||
//SDL_Color *palette = NULL;
|
||||
SDL_Rect clip;
|
||||
int ncolors = 0;
|
||||
//int ncolors = 0;
|
||||
Uint32 tmpflags = 0;
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
|
@@ -52,7 +52,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||
DWORD dwErrorGL = 0;
|
||||
HDC hDC = 0;
|
||||
static std::vector<std::string> systemFontList;
|
||||
if(systemFontList.size() == 0) {
|
||||
if(systemFontList.empty() == true) {
|
||||
LOGFONT lf;
|
||||
//POSITION pos;
|
||||
//lf.lfCharSet = ANSI_CHARSET;
|
||||
|
Reference in New Issue
Block a user