Skip to content

Commit

Permalink
unsigned values can't be less than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
fiendish committed Mar 11, 2016
1 parent 120b5b6 commit f425baa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions luacom/tCOMUtil.cpp
Expand Up @@ -367,9 +367,8 @@ ITypeLib* tCOMUtil::LoadTypeLibFromProgID(const char* ProgID,
return NULL;

bool version_found = false;
int version = -1;

if(major_version <= 0)
if(major_version == 0)
{
if(sscanf(ProgID, "%*s.%*s.%d", &major_version) == 1)
version_found = true;
Expand Down Expand Up @@ -497,8 +496,7 @@ ITypeLib* tCOMUtil::LoadTypeLibFromCLSID(CLSID clsid,

if(major_version > 0 &&
(
(!version_info_found) ||
(version_info_found && found == 0)
(!version_info_found) || (found == 0)
)
)
{
Expand Down Expand Up @@ -707,7 +705,6 @@ bool tCOMUtil::DelRegKey(const char *key,
const char *subkey)
{

bool ok = false;
LONG ec = 0;

const int bufsize = 10000;
Expand Down
4 changes: 2 additions & 2 deletions luacom/tLuaVector.cpp
Expand Up @@ -50,7 +50,7 @@ unsigned long tLuaVector::get_Dimensions()
unsigned long tLuaVector::get_Nth_Dimension(unsigned long n)
{
// precond
CHECKPRECOND(length >= 0 && n >= 0 && (n == 1 || elem_type == VECTOR));
CHECKPRECOND(n == 1 || elem_type == VECTOR);

if(n == 1)
return length;
Expand Down Expand Up @@ -323,7 +323,7 @@ void tLuaVector::InitVectorFromTable(lua_State* L, stkIndex table)
// Itera em tabela ou userdata, criando LuaVectors recursivamente
while(1)
{
CHECKPRECOND((length <= 0 || elem_type != UNKNOWN) &&
CHECKPRECOND((elem_type != UNKNOWN) &&
(length != 0 || elem_type == UNKNOWN));

lua_pushvalue(L, table);
Expand Down

0 comments on commit f425baa

Please sign in to comment.