surface_matching: fix infinite loop, whitespace issues

pull/1413/head
Alexander Alekhin 8 years ago
parent 11c90ea23c
commit 5ba8e40a53
  1. 2
      modules/surface_matching/src/ppf_helpers.cpp
  2. 12
      modules/surface_matching/src/t_hash_int.cpp

@ -121,7 +121,7 @@ Mat loadPLYSimple(const char* fileName, int withNormals)
{
float* data = cloud.ptr<float>(i);
int col = 0;
for (; col < withNormals ? 6 : 3; ++col)
for (; col < (withNormals ? 6 : 3); ++col)
{
ifs >> data[col];
}

@ -74,11 +74,11 @@ hashtable_int *hashtableCreate(size_t size, size_t (*hashfunc)(unsigned int))
size = (size_t)next_power_of_two((unsigned int)size);
}
hashtbl=(hashtable_int*)malloc(sizeof(hashtable_int));
hashtbl=(hashtable_int*)malloc(sizeof(hashtable_int));
if (!hashtbl)
return NULL;
hashtbl->nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
hashtbl->nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
if (!hashtbl->nodes)
{
free(hashtbl);
@ -136,7 +136,7 @@ int hashtableInsert(hashtable_int *hashtbl, KeyType key, void *data)
}
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
if (!node)
return -1;
node->key=key;
@ -168,7 +168,7 @@ int hashtableInsertHashed(hashtable_int *hashtbl, KeyType key, void *data)
node=node->next;
}
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
node=(hashnode_i*)malloc(sizeof(struct hashnode_i));
if (!node)
return -1;
@ -242,7 +242,7 @@ int hashtableResize(hashtable_int *hashtbl, size_t size)
newtbl.size=size;
newtbl.hashfunc=hashtbl->hashfunc;
newtbl.nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
newtbl.nodes=(hashnode_i**)calloc(size, sizeof(struct hashnode_i*));
if (!newtbl.nodes)
return -1;
@ -311,7 +311,7 @@ void hashtablePrint(hashtable_int *hashtbl)
for (node=hashtbl->nodes[n]; node; node=next)
{
next = node->next;
std::cout<<"Key : "<<node->key<<", Data : "<<node->data<<std::endl;
std::cout<<"Key : "<<node->key<<", Data : "<<node->data<<std::endl;
}
}
}

Loading…
Cancel
Save