neutrinordp: Allow fixed keyboard lauout information to be sent to remote. #1933

This commit is contained in:
TOMATO-ONE
2021-07-20 01:08:45 +09:00
parent e0a482fbfc
commit e3ffad77ca
5 changed files with 113 additions and 0 deletions
+24
View File
@@ -407,6 +407,30 @@ g_atoi(const char *str)
return atoi(str);
}
/*****************************************************************************/
/* As g_atoi() but allows for hexadecimal too */
int
g_atoix(const char *str)
{
int base = 10;
if (str == NULL)
{
str = "0";
}
while (isspace(*str))
{
++str;
}
if (*str == '0' && tolower(*(str + 1)) == 'x')
{
str += 2;
base = 16;
}
return strtol(str, NULL, base);
}
/*****************************************************************************/
int
g_htoi(char *str)
+9
View File
@@ -155,6 +155,15 @@ int g_strncmp_d(const char *c1, const char *c2, const char delim, int len);
int g_strcasecmp(const char *c1, const char *c2);
int g_strncasecmp(const char *c1, const char *c2, int len);
int g_atoi(const char *str);
/**
* Extends g_atoi(), Converts decimal and hexadecimal number String to integer
*
* Prefix hexadecimal numbers with '0x'
*
* @param str String to convert to an integer
* @return int Integer expression of a string
*/
int g_atoix(const char *str);
int g_htoi(char *str);
int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str,
int bytes_out_str);