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)
project(pbl C)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} -Wall")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -O3")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-sign-compare")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-sign-compare -O3")
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)
{
#if defined(USE_BIG_ENDIAN) || defined(FORCE_ALIGNMENT)
t_block tmp1;
t_block tmp2;
#endif
const char * end = str1 + (length&(-64));
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;
endianvars_2;
(void)reallength1;
(void)reallength2;
i=length & 63;
//Padding on last block
//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__
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 tmp2;
#endif
const char * end = str1 + length;
while(str1<end)

View file

@ -90,6 +90,9 @@ static void insert_pair (PblMap* parMap, Character parKey, int parValue) {
sizeof(parValue)
);
assert(0 <= retval);
#ifdef NDEBUG
(void)retval;
#endif
}
static int get_value (PblMap* parMap, Character parKey) {
@ -177,7 +180,7 @@ int damerau_levenshtein_with_size (
if (0 == parTargetLen)
return parSourceLen * parDeleteCost;
const int table_length = parSourceLen * parTargetLen;
const size_t table_length = parSourceLen * parTargetLen;
table = malloc(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);
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);
delete_distance = table[i - 1 + 0 * parSourceLen] + parDeleteCost;
insert_distance = (i + 1) * parDeleteCost + parInsertCost;
@ -209,7 +213,8 @@ int damerau_levenshtein_with_size (
}
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);
delete_distance = (j + 1) * parInsertCost + parDeleteCost;
insert_distance = table[0 + (j - 1) * parSourceLen] + parInsertCost;
@ -221,11 +226,13 @@ int damerau_levenshtein_with_size (
}
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);
maxSourceLetterMatchIndex = (source_char == target_char_0 ? 0 : -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);
candidateSwapIndex = get_value(sourceIndexByCharacter, target_char);
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) {
DIR* d;
struct dirent* dir;
size_t z;
struct stat st;
char* path_buff;
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) {
(void)parName;
++parList->count;
}

View file

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