Author: dmacvicar Date: Mon May 19 14:55:03 2008 New Revision: 10142 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10142&view=rev Log: make solvable_look_bool more robust by allowing both the void or the num == 1 strategy. Modified: trunk/sat-solver/package/libsatsolver.changes trunk/sat-solver/src/solvable.c Modified: trunk/sat-solver/package/libsatsolver.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/package/libsatsolver.changes?rev=10142&r1=10141&r2=10142&view=diff ============================================================================== --- trunk/sat-solver/package/libsatsolver.changes (original) +++ trunk/sat-solver/package/libsatsolver.changes Mon May 19 14:55:03 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon May 19 14:53:01 CEST 2008 - dmacvicar@suse.de + +- make solvable_look_bool more robust by allowing both + the void or the num == 1 strategy. + +------------------------------------------------------------------- Thu May 15 16:05:50 CEST 2008 - coolo@suse.de - fix susetags parser Modified: trunk/sat-solver/src/solvable.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solvable.c?rev=10142&r1=10141&r2=10142&view=diff ============================================================================== --- trunk/sat-solver/src/solvable.c (original) +++ trunk/sat-solver/src/solvable.c Mon May 19 14:55:03 2008 @@ -257,7 +257,43 @@ int solvable_lookup_bool(Solvable *s, Id keyname) { - return solvable_lookup_void(s, keyname); + Repo *repo = s->repo; + Pool *pool; + Repodata *data; + int i, j, n; + + if (!repo) + return 0; + pool = repo->pool; + n = s - pool->solvables; + for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++) + { + if (n < data->start || n >= data->end) + continue; + /* there are two ways of storing a bool */ + for (j = 1; j < data->nkeys; j++) + { + /* as a num == 1 */ + if (data->keys[j].name == keyname + && (data->keys[j].type == REPOKEY_TYPE_U32 + || data->keys[j].type == REPOKEY_TYPE_NUM + || data->keys[j].type == REPOKEY_TYPE_CONSTANT)) + { + unsigned int value; + if (repodata_lookup_num(data, n - data->start, j, &value)) + return value == 1; + } + + /* as a void attribute, if it is there, then true */ + if (data->keys[j].name == keyname + && (data->keys[j].type == REPOKEY_TYPE_VOID)) + { + if (repodata_lookup_void(data, n - data->start, j)) + return 1; + } + } + } + return 0; } const unsigned char * -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org