summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-06-11 20:52:22 +0000
committerDavid Robillard <d@drobilla.net>2011-06-11 20:52:22 +0000
commit555ac8bd15e17d52bbd04f78de71e03e131e7a48 (patch)
tree213dbf32522e1542ca61423542fb80d7cab64934 /src
parentfa52fa53605a91ba3507138dfa64fae35a59415b (diff)
downloadsord-555ac8bd15e17d52bbd04f78de71e03e131e7a48.tar.gz
sord-555ac8bd15e17d52bbd04f78de71e03e131e7a48.tar.bz2
sord-555ac8bd15e17d52bbd04f78de71e03e131e7a48.zip
Fix potential use of uninitialized value
git-svn-id: http://svn.drobilla.net/sord/trunk@150 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'src')
-rw-r--r--src/sord.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sord.c b/src/sord.c
index 1142b41..eafc99f 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -514,7 +514,7 @@ sord_best_index(SordModel* sord, const SordQuad pat, SearchMode* mode, int* n_pr
+ (pat[1] ? 1 : 0) * 0x010
+ (pat[2] ? 1 : 0) * 0x001;
- SordOrder good[2];
+ SordOrder good[2] = { (SordOrder)-1, (SordOrder)-1 };
// Good orderings that don't require filtering
*mode = RANGE;
@@ -530,10 +530,12 @@ sord_best_index(SordModel* sord, const SordQuad pat, SearchMode* mode, int* n_pr
case 0x111: *mode = SINGLE; return graph_search ? DEFAULT_GRAPH_ORDER : DEFAULT_ORDER;
}
- if (sord_has_index(sord, &good[0], n_prefix, graph_search)) {
- return good[0];
- } else if (sord_has_index(sord, &good[1], n_prefix, graph_search)) {
- return good[1];
+ if (*mode == RANGE) {
+ if (sord_has_index(sord, &good[0], n_prefix, graph_search)) {
+ return good[0];
+ } else if (sord_has_index(sord, &good[1], n_prefix, graph_search)) {
+ return good[1];
+ }
}
// Not so good orderings that require filtering, but can