Cleanup some strcmps

This commit is contained in:
twinaphex 2015-06-14 19:42:25 +02:00
parent a7f1e43d81
commit ad5954862b
3 changed files with 24 additions and 12 deletions

View File

@ -555,7 +555,7 @@ static int android_input_get_id_index_from_name(android_input_t *android,
int i;
for (i = 0; i < android->pads_connected; i++)
{
if (strcmp(name, android->pad_states[i].name) == 0)
if (!strcmp(name, android->pad_states[i].name))
return i;
}

View File

@ -21,14 +21,12 @@
*/
#include <file/file_path.h>
#include <stdlib.h>
#include <boolean.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <retro_miscellaneous.h>
#ifdef __HAIKU__
#include <kernel/image.h>
@ -38,6 +36,12 @@
#include <unistd.h> /* stat() is defined here */
#endif
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <retro_miscellaneous.h>
#include <rhash.h>
#if defined(__CELLOS_LV2__)
#ifndef S_ISDIR
@ -122,6 +126,9 @@ bool path_contains_compressed_file(const char *path)
return (strchr(path,'#') != NULL);
}
#define FILE_EXT_7Z 0x005971d6U
#define FILE_EXT_ZIP 0x0b88c7d8U
/**
* path_is_compressed_file:
* @path : path
@ -133,15 +140,20 @@ bool path_contains_compressed_file(const char *path)
bool path_is_compressed_file(const char* path)
{
#ifdef HAVE_COMPRESSION
const char* file_ext = path_get_extension(path);
const char* file_ext = path_get_extension(path);
uint32_t file_ext_hash = djb2_calculate(file_ext);
switch (file_ext_hash)
{
#ifdef HAVE_7ZIP
if (strcmp(file_ext,"7z") == 0)
return true;
case FILE_EXT_7Z:
return true;
#endif
#ifdef HAVE_ZLIB
if (strcmp(file_ext,"zip") == 0)
return true;
case FILE_EXT_ZIP:
return true;
#endif
}
#endif
return false;

View File

@ -31,7 +31,7 @@ int main(int argc, char ** argv)
printf("Could not open db file '%s': %s\n", path, strerror(-rv));
return 1;
}
else if (strcmp(command, "list") == 0)
else if (!strcmp(command, "list"))
{
if ((rv = libretrodb_cursor_open(&db, &cur, NULL)) != 0)
{
@ -52,7 +52,7 @@ int main(int argc, char ** argv)
rmsgpack_dom_value_free(&item);
}
}
else if (strcmp(command, "find") == 0)
else if (!strcmp(command, "find"))
{
if (argc != 4)
{
@ -83,7 +83,7 @@ int main(int argc, char ** argv)
rmsgpack_dom_value_free(&item);
}
}
else if (strcmp(command, "create-index") == 0)
else if (!strcmp(command, "create-index"))
{
const char * index_name, * field_name;