You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
987 B

  1. From a59d98003c0b2364929ee23ed331d610029c6dcf Mon Sep 17 00:00:00 2001
  2. From: Michael Heimpold <michael.heimpold@i2se.com>
  3. Date: Tue, 18 Dec 2018 14:52:12 +0100
  4. Subject: [PATCH 3/9] Fix parsing of character in to_binstr()
  5. When a hex-digit > 'a' or 'A' is read, we have to add an offset of 10
  6. to access the valid symbol in our mapping table.
  7. Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
  8. Cc: Michael Heimpold <mhei@heimpold.de>
  9. ---
  10. lsmmc.c | 4 ++--
  11. 1 file changed, 2 insertions(+), 2 deletions(-)
  12. diff --git a/lsmmc.c b/lsmmc.c
  13. index a53bc57..e64117c 100644
  14. --- a/lsmmc.c
  15. +++ b/lsmmc.c
  16. @@ -386,9 +386,9 @@ char *to_binstr(char *hexstr)
  17. if (isdigit(*hexstr))
  18. strcat(binstr, bindigits[*hexstr - '0']);
  19. else if (islower(*hexstr))
  20. - strcat(binstr, bindigits[*hexstr - 'a']);
  21. + strcat(binstr, bindigits[*hexstr - 'a' + 10]);
  22. else
  23. - strcat(binstr, bindigits[*hexstr - 'A']);
  24. + strcat(binstr, bindigits[*hexstr - 'A' + 10]);
  25. hexstr++;
  26. }
  27. --
  28. 2.17.1