forked from enlightenment/terminology
fix const on hyperlink urls
This commit is contained in:
parent
dc5c291bb9
commit
a11c591cce
|
@ -56,7 +56,7 @@ _tooltip_del(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gravatar_tooltip(Evas_Object *obj, const Config *config, char *email)
|
gravatar_tooltip(Evas_Object *obj, const Config *config, const char *email)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
MD5_CTX ctx;
|
MD5_CTX ctx;
|
||||||
|
@ -65,18 +65,29 @@ gravatar_tooltip(Evas_Object *obj, const Config *config, char *email)
|
||||||
static const char hex[] = "0123456789abcdef";
|
static const char hex[] = "0123456789abcdef";
|
||||||
const char *url;
|
const char *url;
|
||||||
Gravatar *g;
|
Gravatar *g;
|
||||||
|
size_t len;
|
||||||
|
char *str;
|
||||||
|
|
||||||
if (!config->gravatar)
|
if (!config->gravatar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g = calloc(sizeof(Gravatar), 1);
|
g = calloc(sizeof(Gravatar), 1);
|
||||||
if (!g) return;
|
if (!g)
|
||||||
|
return;
|
||||||
g->config = config;
|
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);
|
MD5Init(&ctx);
|
||||||
MD5Update(&ctx, (unsigned char const*)email, (unsigned)strlen(email));
|
MD5Update(&ctx, (unsigned char const*)str, (unsigned)len);
|
||||||
MD5Final(hash, &ctx);
|
MD5Final(hash, &ctx);
|
||||||
|
|
||||||
for (n = 0; n < MD5_HASHBYTES; n++)
|
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,
|
elm_object_tooltip_content_cb_set(obj, _tooltip_content,
|
||||||
g,
|
g,
|
||||||
_tooltip_del);
|
_tooltip_del);
|
||||||
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
void
|
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_init(void);
|
||||||
void gravatar_shutdown(void);
|
void gravatar_shutdown(void);
|
||||||
|
|
|
@ -7,8 +7,8 @@ typedef struct _Termlink Term_Link;
|
||||||
|
|
||||||
struct _Termlink
|
struct _Termlink
|
||||||
{
|
{
|
||||||
char *key;
|
const char *key;
|
||||||
char *url;
|
const char *url;
|
||||||
unsigned int refcount;
|
unsigned int refcount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1806,8 +1806,8 @@ _handle_hyperlink(Termpty *ty,
|
||||||
char *s,
|
char *s,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
char *url = NULL;
|
const char *url = NULL;
|
||||||
char *key = NULL;
|
const char *key = NULL;
|
||||||
Term_Link *hl = NULL;
|
Term_Link *hl = NULL;
|
||||||
|
|
||||||
if (!s || len <= 0)
|
if (!s || len <= 0)
|
||||||
|
@ -1848,7 +1848,7 @@ _handle_hyperlink(Termpty *ty,
|
||||||
|
|
||||||
if (len > 3 && strncmp(s, "id=", 3) == 0)
|
if (len > 3 && strncmp(s, "id=", 3) == 0)
|
||||||
{
|
{
|
||||||
free(key);
|
eina_stringshare_del(key);
|
||||||
|
|
||||||
s += 3;
|
s += 3;
|
||||||
len -= 3;
|
len -= 3;
|
||||||
|
|
Loading…
Reference in New Issue