From 58af594c9d9cfe7070742ff09ef8528c11d65bef Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 26 Feb 2022 13:41:55 +0100 Subject: fmt: Grab fmt_context_id for tests --- badwolf.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 8578404..fabd083 100644 --- a/badwolf.c +++ b/badwolf.c @@ -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); -- cgit v1.3.1-23-gd82d