Guest User

Untitled

a guest
Jul 16th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
  2. index c05ebca..cb9444a 100644
  3. --- a/apps/gui/skin_engine/skin_parser.c
  4. +++ b/apps/gui/skin_engine/skin_parser.c
  5. @@ -1387,6 +1387,44 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
  6. return skip;
  7. }
  8.  
  9. +static int find_false_branch(const char *wps_bufptr)
  10. +{
  11. + const char *buf = wps_bufptr;
  12. + int level = 1;
  13. + do
  14. + {
  15. + if (*buf == '<')
  16. + level++;
  17. + if (*buf == '>')
  18. + level--;
  19. + if (*buf == '|' && level == 1)
  20. + {
  21. + buf++;
  22. + break;
  23. + }
  24. + } while (buf && *buf++);
  25. +
  26. + printf("level %d\n", buf - wps_bufptr);
  27. + printf("buf: %8s\n", buf);
  28. + return buf - wps_bufptr;
  29. +}
  30. +
  31. +static int check_feature_tag(const char *wps_bufptr, const int type)
  32. +{
  33. + switch (type)
  34. + {
  35. + case WPS_TOKEN_RTC_PRESENT:
  36. +#if CONFIG_RTC && 0
  37. + printf("Hi\n");
  38. + return 0;
  39. +#else
  40. + return find_false_branch(wps_bufptr);
  41. +#endif
  42. + default: return 0;
  43. + }
  44. +}
  45. +
  46. +
  47. /* Parses the WPS.
  48. data is the pointer to the structure where the parsed WPS should be stored.
  49. It is initialised.
  50. @@ -1466,7 +1504,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
  51. fail = PARSE_FAIL_COND_SYNTAX_ERROR;
  52. break;
  53. }
  54. -
  55. + wps_bufptr += check_feature_tag(wps_bufptr, data->tokens[data->num_tokens-1].type);
  56. data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_START;
  57. lastcond[level] = data->num_tokens++;
  58. break;
Add Comment
Please, Sign In to add comment