fix const on hyperlink urls

terminology-1.3
Boris Faure 4 years ago
parent dc5c291bb9
commit a11c591cce
  1. 20
      src/bin/gravatar.c
  2. 2
      src/bin/gravatar.h
  3. 4
      src/bin/termiolink.h
  4. 6
      src/bin/termptyesc.c

@ -56,7 +56,7 @@ _tooltip_del(void *data,
}
void
gravatar_tooltip(Evas_Object *obj, const Config *config, char *email)
gravatar_tooltip(Evas_Object *obj, const Config *config, const char *email)
{
int n;
MD5_CTX ctx;
@ -65,18 +65,29 @@ gravatar_tooltip(Evas_Object *obj, const Config *config, char *email)
static const char hex[] = "0123456789abcdef";
const char *url;
Gravatar *g;
size_t len;
char *str;
if (!config->gravatar)
return;
g = calloc(sizeof(Gravatar), 1);
if (!g) return;
if (!g)
return;
g->config = config;
eina_str_tolower(&email);
len = strlen(email);
str = strndup(email, len);
if (!str)
{
free(g);
return;
}
eina_str_tolower(&str);
MD5Init(&ctx);
MD5Update(&ctx, (unsigned char const*)email, (unsigned)strlen(email));
MD5Update(&ctx, (unsigned char const*)str, (unsigned)len);
MD5Final(hash, &ctx);
for (n = 0; n < MD5_HASHBYTES; n++)
@ -93,6 +104,7 @@ gravatar_tooltip(Evas_Object *obj, const Config *config, char *email)
elm_object_tooltip_content_cb_set(obj, _tooltip_content,
g,
_tooltip_del);
free(str);
}
void

@ -4,7 +4,7 @@
#include "config.h"
void
gravatar_tooltip(Evas_Object *obj, const Config *config, char *email);
gravatar_tooltip(Evas_Object *obj, const Config *config, const char *email);
void gravatar_init(void);
void gravatar_shutdown(void);

@ -7,8 +7,8 @@ typedef struct _Termlink Term_Link;
struct _Termlink
{
char *key;
char *url;
const char *key;
const char *url;
unsigned int refcount;
};

@ -1806,8 +1806,8 @@ _handle_hyperlink(Termpty *ty,
char *s,
int len)
{
char *url = NULL;
char *key = NULL;
const char *url = NULL;
const char *key = NULL;
Term_Link *hl = NULL;
if (!s || len <= 0)
@ -1848,7 +1848,7 @@ _handle_hyperlink(Termpty *ty,
if (len > 3 && strncmp(s, "id=", 3) == 0)
{
free(key);
eina_stringshare_del(key);
s += 3;
len -= 3;

Loading…
Cancel
Save