mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 21:48:08 +02:00
trivial: try harder to not print invalid ASCII codes
This commit is contained in:
parent
7382bcc168
commit
61fad487ba
1 changed files with 2 additions and 8 deletions
|
|
@ -274,6 +274,8 @@ dkp_wup_parse_command (DkpWup *wup, const gchar *data)
|
|||
/* replace the first ';' char with a NULL if it exists */
|
||||
length = strlen (packet);
|
||||
for (i=0; i<length; i++) {
|
||||
if (packet[i] < 0x20 && packet[i] > 0x7e)
|
||||
packet[i] = '?';
|
||||
if (packet[i] == ';') {
|
||||
packet[i] = '\0';
|
||||
break;
|
||||
|
|
@ -326,14 +328,6 @@ dkp_wup_parse_command (DkpWup *wup, const gchar *data)
|
|||
goto out;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* print the data */
|
||||
egg_debug ("command=%c:%c", command, subcommand);
|
||||
for (i=0; i<size; i++) {
|
||||
egg_debug ("%i\t'%s'", i, tokens[i+offset]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* update the command fields */
|
||||
if (command == 'd' && subcommand == '-' && number_tokens - offset == 18) {
|
||||
obj->energy_rate = strtod (tokens[offset+DKP_WUP_RESPONSE_HEADER_WATTS], NULL) / 10.0f;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue