mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
opts: Change alias to be u8*, better matches the unicode nature
We are still generating only char* style aliases, but the field is defined to be unicode, which doesn't mix too well with char. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
19c030ea1f
commit
67c6d4d1f1
@ -89,7 +89,7 @@ struct lightningd {
|
||||
struct pubkey id;
|
||||
|
||||
/* My name is... my favorite color is... */
|
||||
char *alias; /* At least 32 bytes (zero-filled) */
|
||||
u8 *alias; /* At least 32 bytes (zero-filled) */
|
||||
u8 *rgb; /* tal_len() == 3. */
|
||||
|
||||
/* Any pending timers. */
|
||||
|
@ -168,8 +168,8 @@ static char *opt_set_alias(const char *arg, struct lightningd *ld)
|
||||
*/
|
||||
if (strlen(arg) > 32)
|
||||
return tal_fmt(NULL, "Alias '%s' is over 32 characters", arg);
|
||||
ld->alias = tal_arrz(ld, char, 33);
|
||||
strncpy(ld->alias, arg, 32);
|
||||
ld->alias = tal_arrz(ld, u8, 33);
|
||||
strncpy((char*)ld->alias, arg, 32);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -572,11 +572,11 @@ void setup_color_and_alias(struct lightningd *ld)
|
||||
memcpy(&noun, der+3+sizeof(adjective), sizeof(noun));
|
||||
noun %= ARRAY_SIZE(codename_noun);
|
||||
adjective %= ARRAY_SIZE(codename_adjective);
|
||||
ld->alias = tal_arrz(ld, char, 33);
|
||||
ld->alias = tal_arrz(ld, u8, 33);
|
||||
assert(strlen(codename_adjective[adjective])
|
||||
+ strlen(codename_noun[noun]) < 33);
|
||||
strcpy(ld->alias, codename_adjective[adjective]);
|
||||
strcat(ld->alias, codename_noun[noun]);
|
||||
strcpy((char*)ld->alias, codename_adjective[adjective]);
|
||||
strcat((char*)ld->alias, codename_noun[noun]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user