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.

simplify yearday_to_daymonth()

+8 -19
+8 -19
firmware/usbstack/usb_storage.c
··· 333 333 #if CONFIG_RTC 334 334 static void yearday_to_daymonth(int yd, int y, int *d, int *m) 335 335 { 336 - static const char tnl[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 337 - static const char tl[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 338 - const char *t; 339 - int i=0; 336 + static char t[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 340 337 341 - if((y%4 == 0 && y%100 != 0) || y%400 == 0) 342 - { 343 - t=tl; 344 - } 345 - else 346 - { 347 - t=tnl; 348 - } 338 + bool leap = (y%4 == 0 && y%100 != 0) || y%400 == 0; 339 + t[2] = leap ? 29 : 28; 349 340 350 - while(i<12 && yd >= t[i]) 351 - { 352 - yd-=t[i]; 353 - i++; 354 - } 341 + int i; 342 + for (i = 0; i < 12 && yd >= t[i]; i++) 343 + yd -= t[i]; 344 + 355 345 *d = yd+1; 356 346 *m = i; 357 347 } ··· 757 747 758 748 struct storage_info info; 759 749 unsigned int length = cbw->data_transfer_length; 760 - unsigned int block_size = 0; 761 - unsigned int block_count = 0; 750 + unsigned int block_size, block_count; 762 751 bool lun_present=true; 763 752 unsigned char lun = cbw->lun; 764 753 unsigned int block_size_mult = 1;