Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 13th, 2010  |  syntax: None  |  size: 1.15 KB  |  views: 98  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Index: apps/gui/skin_engine/skin_tokens.c
  2. ===================================================================
  3. --- apps/gui/skin_engine/skin_tokens.c  (Revision 25983)
  4. +++ apps/gui/skin_engine/skin_tokens.c  (Arbeitskopie)
  5. @@ -398,13 +398,15 @@
  6.          case WPS_TOKEN_PRESET_NAME:
  7.          case WPS_TOKEN_PRESET_FREQ:
  8.          {
  9. -            int preset = radio_current_preset() + preset_offset;
  10. -            if (radio_preset_count() == 0 || preset == -1)
  11. +            int preset_count = radio_preset_count();
  12. +            int cur_preset = radio_current_preset();
  13. +            if (preset_count == 0 || cur_preset < 0)
  14.                  return NULL;
  15. -            /* make sure its in the valid range */
  16. +            int preset = cur_preset + preset_offset;
  17. +            /* make sure it's in the valid range */
  18.              while (preset < 0)
  19. -                preset += radio_preset_count();
  20. -            preset %= radio_preset_count();
  21. +                preset += preset_count;
  22. +            preset %= preset_count;
  23.              if (token->type == WPS_TOKEN_PRESET_NAME)
  24.              {
  25.                  snprintf(buf, buf_size, "%s", radio_get_preset(preset)->name);