1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00

Warning fix on gcc

This commit is contained in:
King_DuckZ 2016-05-14 16:14:58 +02:00
parent 70ec3e10d9
commit 1192ce7c18
5 changed files with 23 additions and 9 deletions

View file

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(pbl C) project(pbl C)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} -Wall") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-sign-compare")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -O3") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-sign-compare -O3")
option(PBL_WITH_TESTS "Enable building test programs" ON) option(PBL_WITH_TESTS "Enable building test programs" ON)

View file

@ -710,8 +710,10 @@ void tiger(const char *str, t_word length, t_res res, char pad)
void tiger_2_chunk(const char *str1, const char *str2, t_word length, t_res res1, t_res res2) void tiger_2_chunk(const char *str1, const char *str2, t_word length, t_res res1, t_res res2)
{ {
#if defined(USE_BIG_ENDIAN) || defined(FORCE_ALIGNMENT)
t_block tmp1; t_block tmp1;
t_block tmp2; t_block tmp2;
#endif
const char * end = str1 + (length&(-64)); const char * end = str1 + (length&(-64));
while(str1<end) while(str1<end)
@ -746,6 +748,9 @@ void tiger_2_last_chunk (const char *str1, const char *str2, t_word length, t_wo
t_block tmp2; t_block tmp2;
endianvars_2; endianvars_2;
(void)reallength1;
(void)reallength2;
i=length & 63; i=length & 63;
//Padding on last block //Padding on last block
//add 0x01 afterwards. //add 0x01 afterwards.
@ -803,8 +808,10 @@ void tiger_2(const char *str1, const char *str2, t_word length, t_res res1, t_re
#ifdef __SSE2__ #ifdef __SSE2__
void tiger_sse2_chunk(const char *str1, const char *str2, t_word length, t_res res1, t_res res2) void tiger_sse2_chunk(const char *str1, const char *str2, t_word length, t_res res1, t_res res2)
{ {
#ifdef FORCE_ALIGNMENT
t_block tmp1; t_block tmp1;
t_block tmp2; t_block tmp2;
#endif
const char * end = str1 + length; const char * end = str1 + length;
while(str1<end) while(str1<end)

View file

@ -90,6 +90,9 @@ static void insert_pair (PblMap* parMap, Character parKey, int parValue) {
sizeof(parValue) sizeof(parValue)
); );
assert(0 <= retval); assert(0 <= retval);
#ifdef NDEBUG
(void)retval;
#endif
} }
static int get_value (PblMap* parMap, Character parKey) { static int get_value (PblMap* parMap, Character parKey) {
@ -177,7 +180,7 @@ int damerau_levenshtein_with_size (
if (0 == parTargetLen) if (0 == parTargetLen)
return parSourceLen * parDeleteCost; return parSourceLen * parDeleteCost;
const int table_length = parSourceLen * parTargetLen; const size_t table_length = parSourceLen * parTargetLen;
table = malloc(sizeof(int) * table_length); table = malloc(sizeof(int) * table_length);
memset(table, 0, sizeof(int) * table_length); memset(table, 0, sizeof(int) * table_length);
@ -197,7 +200,8 @@ int damerau_levenshtein_with_size (
insert_pair(sourceIndexByCharacter, source_char_0, 0); insert_pair(sourceIndexByCharacter, source_char_0, 0);
assert(source = source_index_1); assert(source = source_index_1);
for (i = 1; i < parSourceLen; ++i) { assert(parSourceLen <= INT_MAX);
for (i = 1; i < (int)parSourceLen; ++i) {
source_char = utf8_advance(&source, source_end); source_char = utf8_advance(&source, source_end);
delete_distance = table[i - 1 + 0 * parSourceLen] + parDeleteCost; delete_distance = table[i - 1 + 0 * parSourceLen] + parDeleteCost;
insert_distance = (i + 1) * parDeleteCost + parInsertCost; insert_distance = (i + 1) * parDeleteCost + parInsertCost;
@ -209,7 +213,8 @@ int damerau_levenshtein_with_size (
} }
assert(target == target_index_1); assert(target == target_index_1);
for (j = 1; j < parTargetLen; ++j) { assert(parTargetLen <= INT_MAX);
for (j = 1; j < (int)parTargetLen; ++j) {
target_char = utf8_advance(&target, target_end); target_char = utf8_advance(&target, target_end);
delete_distance = (j + 1) * parInsertCost + parDeleteCost; delete_distance = (j + 1) * parInsertCost + parDeleteCost;
insert_distance = table[0 + (j - 1) * parSourceLen] + parInsertCost; insert_distance = table[0 + (j - 1) * parSourceLen] + parInsertCost;
@ -221,11 +226,13 @@ int damerau_levenshtein_with_size (
} }
source = source_index_1; source = source_index_1;
for (i = 1; i < parSourceLen; ++i) { assert(parSourceLen <= INT_MAX);
for (i = 1; i < (int)parSourceLen; ++i) {
source_char = utf8_advance(&source, source_end); source_char = utf8_advance(&source, source_end);
maxSourceLetterMatchIndex = (source_char == target_char_0 ? 0 : -1); maxSourceLetterMatchIndex = (source_char == target_char_0 ? 0 : -1);
target = target_index_1; target = target_index_1;
for (j = 1; j < parTargetLen; ++j) { assert(parTargetLen <= INT_MAX);
for (j = 1; j < (int)parTargetLen; ++j) {
target_char = utf8_advance(&target, target_end); target_char = utf8_advance(&target, target_end);
candidateSwapIndex = get_value(sourceIndexByCharacter, target_char); candidateSwapIndex = get_value(sourceIndexByCharacter, target_char);
j_swap = maxSourceLetterMatchIndex; j_swap = maxSourceLetterMatchIndex;

View file

@ -74,7 +74,6 @@ void free_actions (char** parActions, size_t parCount) {
static void foreach_dir (void(*parAction)(const char*, ActionList*), ActionList* parList) { static void foreach_dir (void(*parAction)(const char*, ActionList*), ActionList* parList) {
DIR* d; DIR* d;
struct dirent* dir; struct dirent* dir;
size_t z;
struct stat st; struct stat st;
char* path_buff; char* path_buff;
size_t path_buff_length; size_t path_buff_length;
@ -127,6 +126,7 @@ static void foreach_dir (void(*parAction)(const char*, ActionList*), ActionList*
} }
static void increase_actionlist (const char* parName, ActionList* parList) { static void increase_actionlist (const char* parName, ActionList* parList) {
(void)parName;
++parList->count; ++parList->count;
} }

View file

@ -127,7 +127,7 @@ int main (int parArgc, char* parArgv[]) {
argv = malloc(sizeof(char*) * (parArgc - 1 + 1)); argv = malloc(sizeof(char*) * (parArgc - 1 + 1));
argv[0] = action_path; argv[0] = action_path;
for (z = 2; z < parArgc; ++z) { for (z = 2; z < (size_t)parArgc; ++z) {
argv[z - 1] = parArgv[z]; argv[z - 1] = parArgv[z];
} }
argv[parArgc - 1] = NULL; argv[parArgc - 1] = NULL;