resolve some compiler warnings with intel c/c++ compiler
[blender.git] / source / blender / blenkernel / intern / suggestions.c
index edccc0886f6df8d5df7d650a0c939b3aad4339cd..6530909336ccb50042f01b775e46fb515cc57a80 100644 (file)
 static Text *activeToolText = NULL;
 static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
 static char *documentation = NULL;
-static int doc_lines = 0;
+//static int doc_lines = 0;
 
 static int txttl_cmp(const char *first, const char *second, int len) { 
        int cmp, i;
        for (cmp=0, i=0; i<len; i++) {
-               if (cmp= toupper(first[i])-toupper(second[i])) {
+               if ( (cmp= toupper(first[i])-toupper(second[i])) ) {
                        break;
                }
        }
@@ -65,6 +65,7 @@ static void txttl_free_suggest() {
        suggestions.first = suggestions.last = NULL;
        suggestions.firstmatch = suggestions.lastmatch = NULL;
        suggestions.selected = NULL;
+       suggestions.top = 0;
 }
 
 static void txttl_free_docs() {
@@ -149,11 +150,12 @@ void texttool_suggest_add(const char *name, char type) {
                }
        }
        suggestions.firstmatch = suggestions.lastmatch = suggestions.selected = NULL;
+       suggestions.top= 0;
 }
 
 void texttool_suggest_prefix(const char *prefix) {
        SuggItem *match, *first, *last;
-       int cmp, len = strlen(prefix);
+       int cmp, len = strlen(prefix), top = 0;
 
        if (!suggestions.first) return;
        if (len==0) {
@@ -166,14 +168,17 @@ void texttool_suggest_prefix(const char *prefix) {
        for (match=suggestions.first; match; match=match->next) {
                cmp = txttl_cmp(prefix, match->name, len);
                if (cmp==0) {
-                       if (!first)
+                       if (!first) {
                                first = match;
+                               suggestions.top = top;
+                       }
                } else if (cmp<0) {
                        if (!last) {
                                last = match->prev;
                                break;
                        }
                }
+               top++;
        }
        if (first) {
                if (!last) last = suggestions.last;
@@ -184,6 +189,7 @@ void texttool_suggest_prefix(const char *prefix) {
                suggestions.firstmatch = NULL;
                suggestions.lastmatch = NULL;
                suggestions.selected = NULL;
+               suggestions.top = 0;
        }
 }
 
@@ -207,6 +213,10 @@ SuggItem *texttool_suggest_selected() {
        return suggestions.selected;
 }
 
+int *texttool_suggest_top() {
+       return &suggestions.top;
+}
+
 /*************************/
 /* Documentation methods */
 /*************************/