Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

bookmark.c parse_bookmark remove redundant conditional

we can just use the buffer not being NULL to decide

Change-Id: I233191ce16db4c18ed418794c18b8c51bb05399d

authored by

William Wilgus and committed by
William Wilgus
3a22322a 780990fe

+8 -10
+8 -10
apps/bookmark.c
··· 131 131 132 132 /* ----------------------------------------------------------------------- */ 133 133 /* This function takes a bookmark and parses it. This function also */ 134 - /* validates the bookmark. The parse_filenames flag indicates whether */ 134 + /* validates the bookmark. Valid filenamebuf indicates whether */ 135 135 /* the filename tokens are to be extracted. */ 136 136 /* Returns true on successful bookmark parse. */ 137 137 /* ----------------------------------------------------------------------- */ 138 138 static bool parse_bookmark(char *filenamebuf, 139 139 size_t filenamebufsz, 140 140 const char *bookmark, 141 - const bool parse_filenames, 142 141 const bool strip_dir) 143 142 { 144 143 const char* s = bookmark; ··· 182 181 end = strchr(s, ';'); 183 182 184 183 /* extract file names */ 185 - if (parse_filenames) 184 + if(filenamebuf) 186 185 { 187 186 size_t len = (end == NULL) ? strlen(s) : (size_t) (end - s); 188 187 len = MIN(TEMP_BUF_SIZE - 1, len); ··· 200 199 end++; 201 200 } 202 201 } 203 - if(filenamebuf) 204 - strmemccpy(filenamebuf, end, filenamebufsz); 202 + strmemccpy(filenamebuf, end, filenamebufsz); 205 203 } 206 204 } 207 205 ··· 279 277 if (most_recent && (bookmark_count >= MAX_BOOKMARKS)) 280 278 break; 281 279 282 - if (!parse_bookmark(NULL, 0, global_temp_buffer, false, false)) 280 + if (!parse_bookmark(NULL, 0, global_temp_buffer, false)) 283 281 break; 284 282 285 283 equal = false; ··· 541 539 } 542 540 543 541 if (!parse_bookmark(fnamebuf, sizeof(fnamebuf), 544 - bookmarks->items[index - bookmarks->start], true, true)) 542 + bookmarks->items[index - bookmarks->start], true)) 545 543 { 546 544 return list_index % 2 == 0 ? (char*) str(LANG_BOOKMARK_INVALID) : " "; 547 545 } ··· 602 600 bool show_playlist_name) 603 601 { 604 602 char fnamebuf[MAX_PATH]; 605 - if (!parse_bookmark(fnamebuf, sizeof(fnamebuf), bookmark, true, false)) 603 + if (!parse_bookmark(fnamebuf, sizeof(fnamebuf), bookmark, false)) 606 604 { 607 605 talk_id(LANG_BOOKMARK_INVALID, false); 608 606 return; ··· 881 879 bm.speed = dsp_get_timestretch(); 882 880 #endif 883 881 884 - if (parse_bookmark(fnamebuf, sizeof(fnamebuf), bookmark, true, true)) 882 + if (parse_bookmark(fnamebuf, sizeof(fnamebuf), bookmark, true)) 885 883 { 886 884 global_settings.repeat_mode = bm.repeat_mode; 887 885 global_settings.playlist_shuffle = bm.shuffle; ··· 968 966 file); 969 967 970 968 /* checking to see if the bookmark is valid */ 971 - if (parse_bookmark(NULL, 0, global_bookmark, false, false)) 969 + if (parse_bookmark(NULL, 0, global_bookmark, false)) 972 970 return global_bookmark; 973 971 else 974 972 return NULL;