Update of /cvsroot/luabind/luabind/luabind/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14830/src
Modified Files:
Tag: beta7-devel2
class_rep.cpp find_best_match.cpp
Log Message:
fixed bug in the const-pointer and const-reference matchers returning perfect matches for some non-matches
Index: find_best_match.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/src/find_best_match.cpp,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- find_best_match.cpp 7 Aug 2004 13:37:11 -0000 1.9
+++ find_best_match.cpp 25 Oct 2005 22:57:47 -0000 1.9.2.1
@@ -28,7 +28,7 @@
bool luabind::detail::find_best_match(
lua_State* L
- , const overload_rep_base* start
+ , overload_rep_base const* start
, int num_overloads
, size_t orep_size
, bool& ambiguous
@@ -42,6 +42,7 @@
for (int index = 0; index < num_overloads; ++index)
{
int match_value = start->match(L, num_params);
+
reinterpret_cast<const char*&>(start) += orep_size;
if (match_value < 0) continue;
@@ -58,13 +59,14 @@
}
}
- ambiguous = min_match == min_but_one_match && min_match < std::numeric_limits<int>::max();
+ ambiguous = min_match == min_but_one_match
+ && min_match < std::numeric_limits<int>::max();
return found;
}
void luabind::detail::find_exact_match(
lua_State* L
- , const overload_rep_base* start
+ , overload_rep_base const* start
, int num_overloads
, size_t orep_size
, int cmp_match
Index: class_rep.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/src/class_rep.cpp,v
retrieving revision 1.49.2.2
retrieving revision 1.49.2.3
diff -u -d -r1.49.2.2 -r1.49.2.3
--- class_rep.cpp 29 Jul 2005 14:45:54 -0000 1.49.2.2
+++ class_rep.cpp 25 Oct 2005 22:57:47 -0000 1.49.2.3
@@ -615,7 +615,8 @@
#endif
int num_params = lua_gettop(L) /*- 1*/;
- found = find_best_match(L, &rep->overloads().front(), rep->overloads().size(), sizeof(overload_rep), ambiguous, min_match, match_index, num_params);
+ found = find_best_match(L, &rep->overloads().front(), rep->overloads().size()
+ , sizeof(overload_rep), ambiguous, min_match, match_index, num_params);
#ifdef LUABIND_NO_ERROR_CHECKING
@@ -639,7 +640,8 @@
function_name += ":";
function_name += rep->name;
- msg += get_overload_signatures(L, rep->overloads().begin(), rep->overloads().end(), function_name);
+ msg += get_overload_signatures(L, rep->overloads().begin()
+ , rep->overloads().end(), function_name);
lua_pushstring(L, msg.c_str());
}
@@ -657,14 +659,16 @@
msg += ")' is ambiguous\nnone of the overloads have a best conversion:\n";
std::vector<const overload_rep_base*> candidates;
- find_exact_match(L, &rep->overloads().front(), rep->overloads().size(), sizeof(overload_rep), min_match, num_params, candidates);
+ find_exact_match(L, &rep->overloads().front(), rep->overloads().size()
+ , sizeof(overload_rep), min_match, num_params, candidates);
std::string function_name;
function_name += rep->crep->name();
function_name += ":";
function_name += rep->name;
- msg += get_overload_signatures_candidates(L, candidates.begin(), candidates.end(), function_name);
+ msg += get_overload_signatures_candidates(L, candidates.begin()
+ , candidates.end(), function_name);
lua_pushstring(L, msg.c_str());
}
|