diff options
fmt: Grab fmt_context_id for tests
1 files changed, 3 insertions, 24 deletions
| -rw-r--r-- | badwolf.c | 27 |
@@ -7,6 +7,7 @@ #include "bookmarks.h" #include "config.h" #include "downloads.h" +#include "fmt.h" #include "keybindings.h" #include "uri.h" @@ -132,34 +133,12 @@ WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_d return TRUE; } -static char * -fmt_context_id(uint64_t num, char *out) -{ - const char alpha_digits[27] = {" ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; - char buf[66] = {'\0'}; - int i, len = 0; - - // Get 0 = 'A' instead of 0 = '' and 1 = 'A' - num++; - - buf[len++] = ' '; - buf[len++] = ':'; - do - { - buf[len++] = alpha_digits[num % 26]; - } while(num /= 26); - - for(i = 0; len > 0; i++) - out[i] = buf[--len]; - - return out; -} - GtkWidget * badwolf_new_tab_box(const gchar *title, struct Client *browser) { (void)browser; - char context_id_str[7] = ""; + /* flawfinder: ignore. bound checks are done */ + char context_id_str[BADWOLF_CTX_SIZ] = {0, 0, 0, 0, 0, 0, 0}; fmt_context_id(browser->context_id, context_id_str); |