Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 19614 19615 19616 19617 19618 19619 19620 19621 19622 19623 19624 19625 19626 19627 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 20000 20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 22004 22005 22006 22007 22008 22009 22010 22011 22012 22013 22014 22015 22016 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 22310 22311 22312 22313 22314 22315 22316 22317 22318 22319 22320 22321 22322 22323 22324 22325 22326 22327 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 22368 22369 22370 22371 22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 22416 22417 22418 22419 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 22507 22508 22509 22510 22511 22512 22513 22514 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 22532 22533 22534 22535 22536 22537 22538 22539 22540 22541 22542 22543 22544 22545 22546 22547 22548 22549 22550 22551 22552 22553 22554 22555 22556 22557 22558 22559 22560 22561 22562 22563 22564 22565 22566 22567 22568 22569 22570 22571 22572 22573 22574 22575 22576 22577 22578 22579 22580 22581 22582 22583 22584 22585 22586 22587 22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 22626 22627 22628 22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 22657 22658 22659 22660 22661 22662 22663 22664 22665 22666 22667 22668 22669 22670 22671 22672 22673 22674 22675 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712 22713 22714 22715 22716 22717 22718 22719 22720 22721 22722 22723 22724 22725 22726 22727 22728 22729 22730 22731 22732 22733 22734 22735 22736 22737 22738 22739 22740 22741 22742 22743 22744 22745 22746 22747 22748 22749 22750 22751 22752 22753 22754 22755 22756 22757 22758 22759 22760 22761 22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 22783 22784 22785 22786 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 22802 22803 22804 22805 22806 22807 22808 22809 22810 22811 22812 22813 22814 22815 22816 22817 22818 22819 22820 22821 22822 22823 22824 22825 22826 22827 22828 22829 22830 22831 22832 22833 22834 22835 22836 22837 22838 22839 22840 22841 22842 22843 22844 22845 22846 22847 22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 22866 22867 22868 22869 22870 22871 22872 22873 22874 22875 22876 22877 22878 22879 22880 22881 22882 22883 22884 22885 22886 22887 22888 22889 22890 22891 22892 22893 22894 22895 22896 22897 22898 22899 22900 22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 22987 22988 22989 22990 22991 22992 22993 22994 22995 22996 22997 22998 22999 23000 23001 23002 23003 23004 23005 23006 23007 23008 23009 23010 23011 23012 23013 23014 23015 23016 23017 23018 23019 23020 23021 23022 23023 23024 23025 23026 23027 23028 23029 23030 23031 23032 23033 23034 23035 23036 23037 23038 23039 23040 23041 23042 23043 23044 23045 23046 23047 23048 23049 23050 23051 23052 23053 23054 23055 23056 23057 23058 23059 23060 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 23084 23085 23086 23087 23088 23089 23090 23091 23092 23093 23094 23095 23096 23097 23098 23099 23100 23101 23102 23103 23104 23105 23106 23107 23108 23109 23110 23111 23112 23113 23114 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 23126 23127 23128 23129 23130 23131 23132 23133 23134 23135 23136 23137 23138 23139 23140 23141 23142 23143 23144 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 23187 23188 23189 23190 23191 23192 23193 23194 23195 23196 23197 23198 23199 23200 23201 23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 23394 23395 23396 23397 23398 23399 23400 23401 23402 23403 23404 23405 23406 23407 23408 23409 23410 23411 23412 23413 23414 23415 23416 23417 23418 23419 23420 23421 23422 23423 23424 23425 23426 23427 23428 23429 23430 23431 23432 23433 23434 23435 23436 23437 23438 23439 23440 23441 23442 23443 23444 23445 23446 23447 23448 23449 23450 23451 23452 23453 23454 23455 23456 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 23475 23476 23477 23478 23479 23480 23481 23482 23483 23484 23485 23486 23487 23488 23489 23490 23491 23492 23493 23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 23504 23505 23506 23507 23508 23509 23510 23511 23512 23513 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 23552 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 23575 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 23587 23588 23589 23590 23591 23592 23593 23594 23595 23596 23597 23598 23599 23600 23601 23602 23603 23604 23605 23606 23607 23608 23609 23610 23611 23612 23613 23614 23615 23616 23617 23618 23619 23620 23621 23622 23623 23624 23625 23626 23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 23663 23664 23665 23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 23693 23694 23695 23696 23697 23698 23699 23700 23701 23702 23703 23704 23705 23706 23707 23708 23709 23710 23711 23712 23713 23714 23715 23716 23717 23718 23719 23720 23721 23722 23723 23724 23725 23726 23727 23728 23729 23730 23731 23732 23733 23734 23735 23736 23737 23738 23739 23740 23741 23742 23743 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 23756 23757 23758 23759 23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 23775 23776 23777 23778 23779 23780 23781 23782 23783 23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 23799 23800 23801 23802 23803 23804 23805 23806 23807 23808 23809 23810 23811 23812 23813 23814 23815 23816 23817 23818 23819 23820 23821 23822 23823 23824 23825 23826 23827 23828 23829 23830 23831 23832 23833 23834 23835 23836 23837 23838 23839 23840 23841 23842 23843 23844 23845 23846 23847 23848 23849 23850 23851 23852 23853 23854 23855 23856 23857 23858 23859 23860 23861 23862 23863 23864 23865 23866 23867 23868 23869 23870 23871 23872 23873 23874 23875 23876 23877 23878 23879 23880 23881 23882 23883 23884 23885 23886 23887 23888 23889 23890 23891 23892 23893 23894 23895 23896 23897 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 23936 23937 23938 23939 23940 23941 23942 23943 23944 23945 23946 23947 23948 23949 23950 23951 23952 23953 23954 23955 23956 23957 23958 23959 23960 23961 23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 23984 23985 23986 23987 23988 23989 23990 23991 23992 23993 23994 23995 23996 23997 23998 23999 24000 24001 24002 24003 24004 24005 24006 24007 24008 24009 24010 24011 24012 24013 24014 24015 24016 24017 24018 24019 24020 24021 24022 24023 24024 24025 24026 24027 24028 24029 24030 24031 24032 24033 24034 24035 24036 24037 24038 24039 24040 24041 24042 24043 24044 24045 24046 24047 24048 24049 24050 24051 24052 24053 24054 24055 24056 24057 24058 24059 24060 24061 24062 24063 24064 24065 24066 24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 24127 24128 24129 24130 24131 24132 24133 24134 24135 24136 24137 24138 24139 24140 24141 24142 24143 24144 24145 24146 24147 24148 24149 24150 24151 24152 24153 24154 24155 24156 24157 24158 24159 24160 24161 24162 24163 24164 24165 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 24314 24315 24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 24394 24395 24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 24514 24515 24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 24554 24555 24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 24594 24595 24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 24634 24635 24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 24675 24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 24714 24715 24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 24757 24758 24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 24797 24798 24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 24837 24838 24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 24940 24941 24942 24943 24944 24945 24946 24947 24948 24949 24950 24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 25001 25002 25003 25004 25005 25006 25007 25008 25009 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 25165 25166 25167 25168 25169 25170 25171 25172 25173 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 25192 25193 25194 25195 25196 25197 25198 25199 25200 25201 25202 25203 25204 25205 25206 25207 25208 25209 25210 25211 25212 25213 25214 25215 25216 25217 25218 25219 25220 25221 25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 25240 25241 25242 25243 25244 25245 25246 25247 25248 25249 25250 25251 25252 25253 25254 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 25282 25283 25284 25285 25286 25287 25288 25289 25290 25291 25292 25293 25294 25295 25296 25297 25298 25299 25300 25301 25302 25303 25304 25305 25306 25307 25308 25309 25310 25311 25312 25313 25314 25315 25316 25317 25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 25330 25331 25332 25333 25334 25335 25336 25337 25338 25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 25349 25350 25351 25352 25353 25354 25355 25356 25357 25358 25359 25360 25361 25362 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 25374 25375 25376 25377 25378 25379 25380 25381 25382 25383 25384 25385 25386 25387 25388 25389 25390 25391 25392 25393 25394 25395 25396 25397 25398 25399 25400 25401 25402 25403 25404 25405 25406 25407 25408 25409 25410 25411 25412 25413 25414 25415 25416 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 25427 25428 25429 25430 25431 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443 25444 25445 25446 25447 25448 25449 25450 25451 25452 25453 25454 25455 25456 25457 25458 25459 25460 25461 25462 25463 25464 25465 25466 25467 25468 25469 25470 25471 25472 25473 25474 25475 25476 25477 25478 25479 25480 25481 25482 25483 25484 25485 25486 25487 25488 25489 25490 25491 25492 25493 25494 25495 25496 25497 25498 25499 25500 25501 25502 25503 25504 25505 25506 25507 25508 25509 25510 25511 25512 25513 25514 25515 25516 25517 25518 25519 25520 25521 25522 25523 25524 25525 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561 25562 25563 25564 25565 25566 25567 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584 25585 25586 25587 25588 25589 25590 25591 25592 25593 25594 25595 25596 25597 25598 25599 25600 25601 25602 25603 25604 25605 25606 25607 25608 25609 25610 25611 25612 25613 25614 25615 25616 25617 25618 25619 25620 25621 25622 25623 25624 25625 25626 25627 25628 25629 25630 25631 25632 25633 25634 25635 25636 25637 25638 25639 25640 25641 25642 25643 25644 25645 25646 25647 25648 25649 25650 25651 25652 25653 25654 25655 25656 25657 25658 25659 25660 25661 25662 25663 25664 25665 25666 25667 25668 25669 25670 25671 25672 25673 25674 25675 25676 25677 25678 25679 25680 25681 25682 25683 25684 25685 25686 25687 25688 25689 25690 25691 25692 25693 25694 25695 25696 25697 25698 25699 25700 25701 25702 25703 25704 25705 25706 25707 25708 25709 25710 25711 25712 25713 25714 25715 25716 25717 25718 25719 25720 25721 25722 25723 25724 25725 25726 25727 25728 25729 25730 25731 25732 25733 25734 25735 25736 25737 25738 25739 25740 25741 25742 25743 25744 25745 25746 25747 25748 25749 25750 25751 25752 25753 25754 25755 25756 25757 25758 25759 25760 25761 25762 25763 25764 25765 25766 25767 25768 25769 25770 25771 25772 25773 25774 25775 25776 25777 25778 25779 25780 25781 25782 25783 25784 25785 25786 25787 25788 25789 25790 25791 25792 25793 25794 25795 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 25821 25822 25823 25824 25825 25826 25827 25828 25829 25830 25831 25832 25833 25834 25835 25836 25837 25838 25839 25840 25841 25842 25843 25844 25845 25846 25847 25848 25849 25850 25851 25852 25853 25854 25855 25856 25857 25858 25859 25860 25861 25862 25863 25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 25875 25876 25877 25878 25879 25880 25881 25882 25883 25884 25885 25886 25887 25888 25889 25890 25891 25892 25893 25894 25895 25896 25897 25898 25899 25900 25901 25902 25903 25904 25905 25906 25907 25908 25909 25910 25911 25912 25913 25914 25915 25916 25917 25918 25919 25920 25921 25922 25923 25924 25925 25926 25927 25928 25929 25930 25931 25932 25933 25934 25935 25936 25937 25938 25939 25940 25941 25942 25943 25944 25945 25946 25947 25948 25949 25950 25951 25952 25953 25954 25955 25956 25957 25958 25959 25960 25961 25962 25963 25964 25965 25966 25967 25968 25969 25970 25971 25972 25973 25974 25975 25976 25977 25978 25979 25980 25981 25982 25983 25984 25985 25986 25987 25988 25989 25990 25991 25992 25993 25994 25995 25996 25997 25998 25999 26000 26001 26002 26003 26004 26005 26006 26007 26008 26009 26010 26011 26012 26013 26014 26015 26016 26017 26018 26019 26020 26021 26022 26023 26024 26025 26026 26027 26028 26029 26030 26031 26032 26033 26034 26035 26036 26037 26038 26039 26040 26041 26042 26043 26044 26045 26046 26047 26048 26049 26050 26051 26052 26053 26054 26055 26056 26057 26058 26059 26060 26061 26062 26063 26064 26065 26066 26067 26068 26069 26070 26071 26072 26073 26074 26075 26076 26077 26078 26079 26080 26081 26082 26083 26084 26085 26086 26087 26088 26089 26090 26091 26092 26093 26094 26095 26096 26097 26098 26099 26100 26101 26102 26103 26104 26105 26106 26107 26108 26109 26110 26111 26112 26113 26114 26115 26116 26117 26118 26119 26120 26121 26122 26123 26124 26125 26126 26127 26128 26129 26130 26131 26132 26133 26134 26135 26136 26137 26138 26139 26140 26141 26142 26143 26144 26145 26146 26147 26148 26149 26150 26151 26152 26153 26154 26155 26156 26157 26158 26159 26160 26161 26162 26163 26164 26165 26166 26167 26168 26169 26170 26171 26172 26173 26174 26175 26176 26177 26178 26179 26180 26181 26182 26183 26184 26185 26186 26187 26188 26189 26190 26191 26192 26193 26194 26195 26196 26197 26198 26199 26200 26201 26202 26203 26204 26205 26206 26207 26208 26209 26210 26211 26212 26213 26214 26215 26216 26217 26218 26219 26220 26221 26222 26223 26224 26225 26226 26227 26228 26229 26230 26231 26232 26233 26234 26235 26236 26237 26238 26239 26240 26241 26242 26243 26244 26245 26246 26247 26248 26249 26250 26251 26252 26253 26254 26255 26256 26257 26258 26259 26260 26261 26262 26263 26264 26265 26266 26267 26268 26269 26270 26271 26272 26273 26274 26275 26276 26277 26278 26279 26280 26281 26282 26283 26284 26285 26286 26287 26288 26289 26290 26291 26292 26293 26294 26295 26296 26297 26298 26299 26300 26301 26302 26303 26304 26305 26306 26307 26308 26309 26310 26311 26312 26313 26314 26315 26316 26317 26318 26319 26320 26321 26322 26323 26324 26325 26326 26327 26328 26329 26330 26331 26332 26333 26334 26335 26336 26337 26338 26339 26340 26341 26342 26343 26344 26345 26346 26347 26348 26349 26350 26351 26352 26353 26354 26355 26356 26357 26358 26359 26360 26361 26362 26363 26364 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 26384 26385 26386 26387 26388 26389 26390 26391 26392 26393 26394 26395 26396 26397 26398 26399 26400 26401 26402 26403 26404 26405 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 26428 26429 26430 26431 26432 26433 26434 26435 26436 26437 26438 26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 26455 26456 26457 26458 26459 26460 26461 26462 26463 26464 26465 26466 26467 26468 26469 26470 26471 26472 26473 26474 26475 26476 26477 26478 26479 26480 26481 26482 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 26493 26494 26495 26496 26497 26498 26499 26500 26501 26502 26503 26504 26505 26506 26507 26508 26509 26510 26511 26512 26513 26514 26515 26516 26517 26518 26519 26520 26521 26522 26523 26524 26525 26526 26527 26528 26529 26530 26531 26532 26533 26534 26535 26536 26537 26538 26539 26540 26541 26542 26543 26544 26545 26546 26547 26548 26549 26550 26551 26552 26553 26554 26555 26556 26557 26558 26559 26560 26561 26562 26563 26564 26565 26566 26567 26568 26569 26570 26571 26572 26573 26574 26575 26576 26577 26578 26579 26580 26581 26582 26583 26584 26585 26586 26587 26588 26589 26590 26591 26592 26593 26594 26595 26596 26597 26598 26599 26600 26601 26602 26603 26604 26605 26606 26607 26608 26609 26610 26611 26612 26613 26614 26615 26616 26617 26618 26619 26620 26621 26622 26623 26624 26625 26626 26627 26628 26629 26630 26631 26632 26633 26634 26635 26636 26637 26638 26639 26640 26641 26642 26643 26644 26645 26646 26647 26648 26649 26650 26651 26652 26653 26654 26655 26656 26657 26658 26659 26660 26661 26662 26663 26664 26665 26666 26667 26668 26669 26670 26671 26672 26673 26674 26675 26676 26677 26678 26679 26680 26681 26682 26683 26684 26685 26686 26687 26688 26689 26690 26691 26692 26693 26694 26695 26696 26697 26698 26699 26700 26701 26702 26703 26704 26705 26706 26707 26708 26709 26710 26711 26712 26713 26714 26715 26716 26717 26718 26719 26720 26721 26722 26723 26724 26725 26726 26727 26728 26729 26730 26731 26732 26733 26734 26735 26736 26737 26738 26739 26740 26741 26742 26743 26744 26745 26746 26747 26748 26749 26750 26751 26752 26753 26754 26755 26756 26757 26758 26759 26760 26761 26762 26763 26764 26765 26766 26767 26768 26769 26770 26771 26772 26773 26774 26775 26776 26777 26778 26779 26780 26781 26782 26783 26784 26785 26786 26787 26788 26789 26790 26791 26792 26793 26794 26795 26796 26797 26798 26799 26800 26801 26802 26803 26804 26805 26806 26807 26808 26809 26810 26811 26812 26813 26814 26815 26816 26817 26818 26819 26820 26821 26822 26823 26824 26825 26826 26827 26828 26829 26830 26831 26832 26833 26834 26835 26836 26837 26838 26839 26840 26841 26842 26843 26844 26845 26846 26847 26848 26849 26850 26851 26852 26853 26854 26855 26856 26857 26858 26859 26860 26861 26862 26863 26864 26865 26866 26867 26868 26869 26870 26871 26872 26873 26874 26875 26876 26877 26878 26879 26880 26881 26882 26883 26884 26885 26886 26887 26888 26889 26890 26891 26892 26893 26894 26895 26896 26897 26898 26899 26900 26901 26902 26903 26904 26905 26906 26907 26908 26909 26910 26911 26912 26913 26914 26915 26916 26917 26918 26919 26920 26921 26922 26923 26924 26925 26926 26927 26928 26929 26930 26931 26932 26933 26934 26935 26936 26937 26938 26939 26940 26941 26942 26943 26944 26945 26946 26947 26948 26949 26950 26951 26952 26953 26954 26955 26956 26957 26958 26959 26960 26961 26962 26963 26964 26965 26966 26967 26968 26969 26970 26971 26972 26973 26974 26975 26976 26977 26978 26979 26980 26981 26982 26983 26984 26985 26986 26987 26988 26989 26990 26991 26992 26993 26994 26995 26996 26997 26998 26999 27000 27001 27002 27003 27004 27005 27006 27007 27008 27009 27010 27011 27012 27013 27014 27015 27016 27017 27018 27019 27020 27021 27022 27023 27024 27025 27026 27027 27028 27029 27030 27031 27032 27033 27034 27035 27036 27037 27038 27039 27040 27041 27042 27043 27044 27045 27046 27047 27048 27049 27050 27051 27052 27053 27054 27055 27056 27057 27058 27059 27060 27061 27062 27063 27064 27065 27066 27067 27068 27069 27070 27071 27072 27073 27074 27075 27076 27077 27078 27079 27080 27081 27082 27083 27084 27085 27086 27087 27088 27089 27090 27091 27092 27093 27094 27095 27096 27097 27098 27099 27100 27101 27102 27103 27104 27105 27106 27107 27108 27109 27110 27111 27112 27113 27114 27115 27116 27117 27118 27119 27120 27121 27122 27123 27124 27125 27126 27127 27128 27129 27130 27131 27132 27133 27134 27135 27136 27137 27138 27139 27140 27141 27142 27143 27144 27145 27146 27147 27148 27149 27150 27151 27152 27153 27154 27155 27156 27157 27158 27159 27160 27161 27162 27163 27164 27165 27166 27167 27168 27169 27170 27171 27172 27173 27174 27175 27176 27177 27178 27179 27180 27181 27182 27183 27184 27185 27186 27187 27188 27189 27190 27191 27192 27193 27194 27195 27196 27197 27198 27199 27200 27201 27202 27203 27204 27205 27206 27207 27208 27209 27210 27211 27212 27213 27214 27215 27216 27217 27218 27219 27220 27221 27222 27223 27224 27225 27226 27227 27228 27229 27230 27231 27232 27233 27234 27235 27236 27237 27238 27239 27240 27241 27242 27243 27244 27245 27246 27247 27248 27249 27250 27251 27252 27253 27254 27255 27256 27257 27258 27259 27260 27261 27262 27263 27264 27265 27266 27267 27268 27269 27270 27271 27272 27273 27274 27275 27276 27277 27278 27279 27280 27281 27282 27283 27284 27285 27286 27287 27288 27289 27290 27291 27292 27293 27294 27295 27296 27297 27298 27299 27300 27301 27302 27303 27304 27305 27306 27307 27308 27309 27310 27311 27312 27313 27314 27315 27316 27317 27318 27319 27320 27321 27322 27323 27324 27325 27326 27327 27328 27329 27330 27331 27332 27333 27334 27335 27336 27337 27338 27339 27340 27341 27342 27343 27344 27345 27346 27347 27348 27349 27350 27351 27352 27353 27354 27355 27356 27357 27358 27359 27360 27361 27362 27363 27364 27365 27366 27367 27368 27369 27370 27371 27372 27373 27374 27375 27376 27377 27378 27379 27380 27381 27382 27383 27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 27394 27395 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 27417 27418 27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 27437 27438 27439 27440 27441 27442 27443 27444 27445 27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 27465 27466 27467 27468 27469 27470 27471 27472 27473 27474 27475 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 27488 27489 27490 27491 27492 27493 27494 27495 27496 27497 27498 27499 27500 27501 27502 27503 27504 27505 27506 27507 27508 27509 27510 27511 27512 27513 27514 27515 27516 27517 27518 27519 27520 27521 27522 27523 27524 27525 27526 27527 27528 27529 27530 27531 27532 27533 27534 27535 27536 27537 27538 27539 27540 27541 27542 27543 27544 27545 27546 27547 27548 27549 27550 27551 27552 27553 27554 27555 27556 27557 27558 27559 27560 27561 27562 27563 27564 27565 27566 27567 27568 27569 27570 27571 27572 27573 27574 27575 27576 27577 27578 27579 27580 27581 27582 27583 27584 27585 27586 27587 27588 27589 27590 27591 27592 27593 27594 27595 27596 27597 27598 27599 27600 27601 27602 27603 27604 27605 27606 27607 27608 27609 27610 27611 27612 27613 27614 27615 27616 27617 27618 27619 27620 27621 27622 27623 27624 27625 27626 27627 27628 27629 27630 27631 27632 27633 27634 27635 27636 27637 27638 27639 27640 27641 27642 27643 27644 27645 27646 27647 27648 27649 27650 27651 27652 27653 27654 27655 27656 27657 27658 27659 27660 27661 27662 27663 27664 27665 27666 27667 27668 27669 27670 27671 27672 27673 27674 27675 27676 27677 27678 27679 27680 27681 27682 27683 27684 27685 27686 27687 27688 27689 27690 27691 27692 27693 27694 27695 27696 27697 27698 27699 27700 27701 27702 27703 27704 27705 27706 27707 27708 27709 27710 27711 27712 27713 27714 27715 27716 27717 27718 27719 27720 27721 27722 27723 27724 27725 27726 27727 27728 27729 27730 27731 27732 27733 27734 27735 27736 27737 27738 27739 27740 27741 27742 27743 27744 27745 27746 27747 27748 27749 27750 27751 27752 27753 27754 27755 27756 27757 27758 27759 27760 27761 27762 27763 27764 27765 27766 27767 27768 27769 27770 27771 27772 27773 27774 27775 27776 27777 27778 27779 27780 27781 27782 27783 27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 27847 27848 27849 27850 27851 27852 27853 27854 27855 27856 27857 27858 27859 27860 27861 27862 27863 27864 27865 27866 27867 27868 27869 27870 27871 27872 27873 27874 27875 27876 27877 27878 27879 27880 27881 27882 27883 27884 27885 27886 27887 27888 27889 27890 27891 27892 27893 27894 27895 27896 27897 27898 27899 27900 27901 27902 27903 27904 27905 27906 27907 27908 27909 27910 27911 27912 27913 27914 27915 27916 27917 27918 27919 27920 27921 27922 27923 27924 27925 27926 27927 27928 27929 27930 27931 27932 27933 27934 27935 27936 27937 27938 27939 27940 27941 27942 27943 27944 27945 27946 27947 27948 27949 27950 27951 27952 27953 27954 27955 27956 27957 27958 27959 27960 27961 27962 27963 27964 27965 27966 27967 27968 27969 27970 27971 27972 27973 27974 27975 27976 27977 27978 27979 27980 27981 27982 27983 27984 27985 27986 27987 27988 27989 27990 27991 27992 27993 27994 27995 27996 27997 27998 27999 28000 28001 28002 28003 28004 28005 28006 28007 28008 28009 28010 28011 28012 28013 28014 28015 28016 28017 28018 28019 28020 28021 28022 28023 28024 28025 28026 28027 28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 28041 28042 28043 28044 28045 28046 28047 28048 28049 28050 28051 28052 28053 28054 28055 28056 28057 28058 28059 28060 28061 28062 28063 28064 28065 28066 28067 28068 28069 28070 28071 28072 28073 28074 28075 28076 28077 28078 28079 28080 28081 28082 28083 28084 28085 28086 28087 28088 28089 28090 28091 28092 28093 28094 28095 28096 28097 28098 28099 28100 28101 28102 28103 28104 28105 28106 28107 28108 28109 28110 28111 28112 28113 28114 28115 28116 28117 28118 28119 28120 28121 28122 28123 28124 28125 28126 28127 28128 28129 28130 28131 28132 28133 28134 28135 28136 28137 28138 28139 28140 28141 28142 28143 28144 28145 28146 28147 28148 28149 28150 28151 28152 28153 28154 28155 28156 28157 28158 28159 28160 28161 28162 28163 28164 28165 28166 28167 28168 28169 28170 28171 28172 28173 28174 28175 28176 28177 28178 28179 28180 28181 28182 28183 28184 28185 28186 28187 28188 28189 28190 28191 28192 28193 28194 28195 28196 28197 28198 28199 28200 28201 28202 28203 28204 28205 28206 28207 28208 28209 28210 28211 28212 28213 28214 28215 28216 28217 28218 28219 28220 28221 28222 28223 28224 28225 28226 28227 28228 28229 28230 28231 28232 28233 28234 28235 28236 28237 28238 28239 28240 28241 28242 28243 28244 28245 28246 28247 28248 28249 28250 28251 28252 28253 28254 28255 28256 28257 28258 28259 28260 28261 28262 28263 28264 28265 28266 28267 28268 28269 28270 28271 28272 28273 28274 28275 28276 28277 28278 28279 28280 28281 28282 28283 28284 28285 28286 28287 28288 28289 28290 28291 28292 28293 28294 28295 28296 28297 28298 28299 28300 28301 28302 28303 28304 28305 28306 28307 28308 28309 28310 28311 28312 28313 28314 28315 28316 28317 28318 28319 28320 28321 28322 28323 28324 28325 28326 28327 28328 28329 28330 28331 28332 28333 28334 28335 28336 28337 28338 28339 28340 28341 28342 28343 28344 28345 28346 28347 28348 28349 28350 28351 28352 28353 28354 28355 28356 28357 28358 28359 28360 28361 28362 28363 28364 28365 28366 28367 28368 28369 28370 28371 28372 28373 28374 28375 28376 28377 28378 28379 28380 28381 28382 28383 28384 28385 28386 28387 28388 28389 28390 28391 28392 28393 28394 28395 28396 28397 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 28413 28414 28415 28416 28417 28418 28419 28420 28421 28422 28423 28424 28425 28426 28427 28428 28429 28430 28431 28432 28433 28434 28435 28436 28437 28438 28439 28440 28441 28442 28443 28444 28445 28446 28447 28448 28449 28450 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 28469 28470 28471 28472 28473 28474 28475 28476 28477 28478 28479 28480 28481 28482 28483 28484 28485 28486 28487 28488 28489 28490 28491 28492 28493 28494 28495 28496 28497 28498 28499 28500 28501 28502 28503 28504 28505 28506 28507 28508 28509 28510 28511 28512 28513 28514 28515 28516 28517 28518 28519 28520 28521 28522 28523 28524 28525 28526 28527 28528 28529 28530 28531 28532 28533 28534 28535 28536 28537 28538 28539 28540 28541 28542 28543 28544 28545 28546 28547 28548 28549 28550 28551 28552 28553 28554 28555 28556 28557 28558 28559 28560 28561 28562 28563 28564 28565 28566 28567 28568 28569 28570 28571 28572 28573 28574 28575 28576 28577 28578 28579 28580 28581 28582 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 28593 28594 28595 28596 28597 28598 28599 28600 28601 28602 28603 28604 28605 28606 28607 28608 28609 28610 28611 28612 28613 28614 28615 28616 28617 28618 28619 28620 28621 28622 28623 28624 28625 28626 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 28644 28645 28646 28647 28648 28649 28650 28651 28652 28653 28654 28655 28656 28657 28658 28659 28660 28661 28662 28663 28664 28665 28666 28667 28668 28669 28670 28671 28672 28673 28674 28675 28676 28677 28678 28679 28680 28681 28682 28683 28684 28685 28686 28687 28688 28689 28690 28691 28692 28693 28694 28695 28696 28697 28698 28699 28700 28701 28702 28703 28704 28705 28706 28707 28708 28709 28710 28711 28712 28713 28714 28715 28716 28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 28727 28728 28729 28730 28731 28732 28733 28734 28735 28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 28746 28747 28748 28749 28750 28751 28752 28753 28754 28755 28756 28757 28758 28759 28760 28761 28762 28763 28764 28765 28766 28767 28768 28769 28770 28771 28772 28773 28774 28775 28776 28777 28778 28779 28780 28781 28782 28783 28784 28785 28786 28787 28788 28789 28790 28791 28792 28793 28794 28795 28796 28797 28798 28799 28800 28801 28802 28803 28804 28805 28806 28807 28808 28809 28810 28811 28812 28813 28814 28815 28816 28817 28818 28819 28820 28821 28822 28823 28824 28825 28826 28827 28828 28829 28830 28831 28832 28833 28834 28835 28836 28837 28838 28839 28840 28841 28842 28843 28844 28845 28846 28847 28848 28849 28850 28851 28852 28853 28854 28855 28856 28857 28858 28859 28860 28861 28862 28863 28864 28865 28866 28867 28868 28869 28870 28871 28872 28873 28874 28875 28876 28877 28878 28879 28880 28881 28882 28883 28884 28885 28886 28887 28888 28889 28890 28891 28892 28893 28894 28895 28896 28897 28898 28899 28900 28901 28902 28903 28904 28905 28906 28907 28908 28909 28910 28911 28912 28913 28914 28915 28916 28917 28918 28919 28920 28921 28922 28923 28924 28925 28926 28927 28928 28929 28930 28931 28932 28933 28934 28935 28936 28937 28938 28939 28940 28941 28942 28943 28944 28945 28946 28947 28948 28949 28950 28951 28952 28953 28954 28955 28956 28957 28958 28959 28960 28961 28962 28963 28964 28965 28966 28967 28968 28969 28970 28971 28972 28973 28974 28975 28976 28977 28978 28979 28980 28981 28982 28983 28984 28985 28986 28987 28988 28989 28990 28991 28992 28993 28994 28995 28996 28997 28998 28999 29000 29001 29002 29003 29004 29005 29006 29007 29008 29009 29010 29011 29012 29013 29014 29015 29016 29017 29018 29019 29020 29021 29022 29023 29024 29025 29026 29027 29028 29029 29030 29031 29032 29033 29034 29035 29036 29037 29038 29039 29040 29041 29042 29043 29044 29045 29046 29047 29048 29049 29050 29051 29052 29053 29054 29055 29056 29057 29058 29059 29060 29061 29062 29063 29064 29065 29066 29067 29068 29069 29070 29071 29072 29073 29074 29075 29076 29077 29078 29079 29080 29081 29082 29083 29084 29085 29086 29087 29088 29089 29090 29091 29092 29093 29094 29095 29096 29097 29098 29099 29100 29101 29102 29103 29104 29105 29106 29107 29108 29109 29110 29111 29112 29113 29114 29115 29116 29117 29118 29119 29120 29121 29122 29123 29124 29125 29126 29127 29128 29129 29130 29131 29132 29133 29134 29135 29136 29137 29138 29139 29140 29141 29142 29143 29144 29145 29146 29147 29148 29149 29150 29151 29152 29153 29154 29155 29156 29157 29158 29159 29160 29161 29162 29163 29164 29165 29166 29167 29168 29169 29170 29171 29172 29173 29174 29175 29176 29177 29178 29179 29180 29181 29182 29183 29184 29185 29186 29187 29188 29189 29190 29191 29192 29193 29194 29195 29196 29197 29198 29199 29200 29201 29202 29203 29204 29205 29206 29207 29208 29209 29210 29211 29212 29213 29214 29215 29216 29217 29218 29219 29220 29221 29222 29223 29224 29225 29226 29227 29228 29229 29230 29231 29232 29233 29234 29235 29236 29237 29238 29239 29240 29241 29242 29243 29244 29245 29246 29247 29248 29249 29250 29251 29252 29253 29254 29255 29256 29257 29258 29259 29260 29261 29262 29263 29264 29265 29266 29267 29268 29269 29270 29271 29272 29273 29274 29275 29276 29277 29278 29279 29280 29281 29282 29283 29284 29285 29286 29287 29288 29289 29290 29291 29292 29293 29294 29295 29296 29297 29298 29299 29300 29301 29302 29303 29304 29305 29306 29307 29308 29309 29310 29311 29312 29313 29314 29315 29316 29317 29318 29319 29320 29321 29322 29323 29324 29325 29326 29327 29328 29329 29330 29331 29332 29333 29334 29335 29336 29337 29338 29339 29340 29341 29342 29343 29344 29345 29346 29347 29348 29349 29350 29351 29352 29353 29354 29355 29356 29357 29358 29359 29360 29361 29362 29363 29364 29365 29366 29367 29368 29369 29370 29371 29372 29373 29374 29375 29376 29377 29378 29379 29380 29381 29382 29383 29384 29385 29386 29387 29388 29389 29390 29391 29392 29393 29394 29395 29396 29397 29398 29399 29400 29401 29402 29403 29404 29405 29406 29407 29408 29409 29410 29411 29412 29413 29414 29415 29416 29417 29418 29419 29420 29421 29422 29423 29424 29425 29426 29427 29428 29429 29430 29431 29432 29433 29434 29435 29436 29437 29438 29439 29440 29441 29442 29443 29444 29445 29446 29447 29448 29449 29450 29451 29452 29453 29454 29455 29456 29457 29458 29459 29460 29461 29462 29463 29464 29465 29466 29467 29468 29469 29470 29471 29472 29473 29474 29475 29476 29477 29478 29479 29480 29481 29482 29483 29484 29485 29486 29487 29488 29489 29490 29491 29492 29493 29494 29495 29496 29497 29498 29499 29500 29501 29502 29503 29504 29505 29506 29507 29508 29509 29510 29511 29512 29513 29514 29515 29516 29517 29518 29519 29520 29521 29522 29523 29524 29525 29526 29527 29528 29529 29530 29531 29532 29533 29534 29535 29536 29537 29538 29539 29540 29541 29542 29543 29544 29545 29546 29547 29548 29549 29550 29551 29552 29553 29554 29555 29556 29557 29558 29559 29560 29561 29562 29563 29564 29565 29566 29567 29568 29569 29570 29571 29572 29573 29574 29575 29576 29577 29578 29579 29580 29581 29582 29583 29584 29585 29586 29587 29588 29589 29590 29591 29592 29593 29594 29595 29596 29597 29598 29599 29600 29601 29602 29603 29604 29605 29606 29607 29608 29609 29610 29611 29612 29613 29614 29615 29616 29617 29618 29619 29620 29621 29622 29623 29624 29625 29626 29627 29628 29629 29630 29631 29632 29633 29634 29635 29636 29637 29638 29639 29640 29641 29642 29643 29644 29645 29646 29647 29648 29649 29650 29651 29652 29653 29654 29655 29656 29657 29658 29659 29660 29661 29662 29663 29664 29665 29666 29667 29668 29669 29670 29671 29672 29673 29674 29675 29676 29677 29678 29679 29680 29681 29682 29683 29684 29685 29686 29687 29688 29689 29690 29691 29692 29693 29694 29695 29696 29697 29698 29699 29700 29701 29702 29703 29704 29705 29706 29707 29708 29709 29710 29711 29712 29713 29714 29715 29716 29717 29718 29719 29720 29721 29722 29723 29724 29725 29726 29727 29728 29729 29730 29731 29732 29733 29734 29735 29736 29737 29738 29739 29740 29741 29742 29743 29744 29745 29746 29747 29748 29749 29750 29751 29752 29753 29754 29755 29756 29757 29758 29759 29760 29761 29762 29763 29764 29765 29766 29767 29768 29769 29770 29771 29772 29773 29774 29775 29776 29777 29778 29779 29780 29781 29782 29783 29784 29785 29786 29787 29788 29789 29790 29791 29792 29793 29794 29795 29796 29797 29798 29799 29800 29801 29802 29803 29804 29805 29806 29807 29808 29809 29810 29811 29812 29813 29814 29815 29816 29817 29818 29819 29820 29821 29822 29823 29824 29825 29826 29827 29828 29829 29830 29831 29832 29833 29834 29835 29836 29837 29838 29839 29840 29841 29842 29843 29844 29845 29846 29847 29848 29849 29850 29851 29852 29853 29854 29855 29856 29857 29858 29859 29860 29861 29862 29863 29864 29865 29866 29867 29868 29869 29870 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 29882 29883 29884 29885 29886 29887 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 29903 29904 29905 29906 29907 29908 29909 29910 29911 29912 29913 29914 29915 29916 29917 29918 29919 29920 29921 29922 29923 29924 29925 29926 29927 29928 29929 29930 29931 29932 29933 29934 29935 29936 29937 29938 29939 29940 29941 29942 29943 29944 29945 29946 29947 29948 29949 29950 29951 29952 29953 29954 29955 29956 29957 29958 29959 29960 29961 29962 29963 29964 29965 29966 29967 29968 29969 29970 29971 29972 29973 29974 29975 29976 29977 29978 29979 29980 29981 29982 29983 29984 29985 29986 29987 29988 29989 29990 29991 29992 29993 29994 29995 29996 29997 29998 29999 30000 30001 30002 30003 30004 30005 30006 30007 30008 30009 30010 30011 30012 30013 30014 30015 30016 30017 30018 30019 30020 30021 30022 30023 30024 30025 30026 30027 30028 30029 30030 30031 30032 30033 30034 30035 30036 30037 30038 30039 30040 30041 30042 30043 30044 30045 30046 30047 30048 30049 30050 30051 30052 30053 30054 30055 30056 30057 30058 30059 30060 30061 30062 30063 30064 30065 30066 30067 30068 30069 30070 30071 30072 30073 30074 30075 30076 30077 30078 30079 30080 30081 30082 30083 30084 30085 30086 30087 30088 30089 30090 30091 30092 30093 30094 30095 30096 30097 30098 30099 30100 30101 30102 30103 30104 30105 30106 30107 30108 30109 30110 30111 30112 30113 30114 30115 30116 30117 30118 30119 30120 30121 30122 30123 30124 30125 30126 30127 30128 30129 30130 30131 30132 30133 30134 30135 30136 30137 30138 30139 30140 30141 30142 30143 30144 30145 30146 30147 30148 30149 30150 30151 30152 30153 30154 30155 30156 30157 30158 30159 30160 30161 30162 30163 30164 30165 30166 30167 30168 30169 30170 30171 30172 30173 30174 30175 30176 30177 30178 30179 30180 30181 30182 30183 30184 30185 30186 30187 30188 30189 30190 30191 30192 30193 30194 30195 30196 30197 30198 30199 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 30211 30212 30213 30214 30215 30216 30217 30218 30219 30220 30221 30222 30223 30224 30225 30226 30227 30228 30229 30230 30231 30232 30233 30234 30235 30236 30237 30238 30239 30240 30241 30242 30243 30244 30245 30246 30247 30248 30249 30250 30251 30252 30253 30254 30255 30256 30257 30258 30259 30260 30261 30262 30263 30264 30265 30266 30267 30268 30269 30270 30271 30272 30273 30274 30275 30276 30277 30278 30279 30280 30281 30282 30283 30284 30285 30286 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 30309 30310 30311 30312 30313 30314 30315 30316 30317 30318 30319 30320 30321 30322 30323 30324 30325 30326 30327 30328 30329 30330 30331 30332 30333 30334 30335 30336 30337 30338 30339 30340 30341 30342 30343 30344 30345 30346 30347 30348 30349 30350 30351 30352 30353 30354 30355 30356 30357 30358 30359 30360 30361 30362 30363 30364 30365 30366 30367 30368 30369 30370 30371 30372 30373 30374 30375 30376 30377 30378 30379 30380 30381 30382 30383 30384 30385 30386 30387 30388 30389 30390 30391 30392 30393 30394 30395 30396 30397 30398 30399 30400 30401 30402 30403 30404 30405 30406 30407 30408 30409 30410 30411 30412 30413 30414 30415 30416 30417 30418 30419 30420 30421 30422 30423 30424 30425 30426 30427 30428 30429 30430 30431 30432 30433 30434 30435 30436 30437 30438 30439 30440 30441 30442 30443 30444 30445 30446 30447 30448 30449 30450 30451 30452 30453 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 30468 30469 30470 30471 30472 30473 30474 30475 30476 30477 30478 30479 30480 30481 30482 30483 30484 30485 30486 30487 30488 30489 30490 30491 30492 30493 30494 30495 30496 30497 30498 30499 30500 30501 30502 30503 30504 30505 30506 30507 30508 30509 30510 30511 30512 30513 30514 30515 30516 30517 30518 30519 30520 30521 30522 30523 30524 30525 30526 30527 30528 30529 30530 30531 30532 30533 30534 30535 30536 30537 30538 30539 30540 30541 30542 30543 30544 30545 30546 30547 30548 30549 30550 30551 30552 30553 30554 30555 30556 30557 30558 30559 30560 30561 30562 30563 30564 30565 30566 30567 30568 30569 30570 30571 30572 30573 30574 30575 30576 30577 30578 30579 30580 30581 30582 30583 30584 30585 30586 30587 30588 30589 30590 30591 30592 30593 30594 30595 30596 30597 30598 30599 30600 30601 30602 30603 30604 30605 30606 30607 30608 30609 30610 30611 30612 30613 30614 30615 30616 30617 30618 30619 30620 30621 30622 30623 30624 30625 30626 30627 30628 30629 30630 30631 30632 30633 30634 30635 30636 30637 30638 30639 30640 30641 30642 30643 30644 30645 30646 30647 30648 30649 30650 30651 30652 30653 30654 30655 30656 30657 30658 30659 30660 30661 30662 30663 30664 30665 30666 30667 30668 30669 30670 30671 30672 30673 30674 30675 30676 30677 30678 30679 30680 30681 30682 30683 30684 30685 30686 30687 30688 30689 30690 30691 30692 30693 30694 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 30706 30707 30708 30709 30710 30711 30712 30713 30714 30715 30716 30717 30718 30719 30720 30721 30722 30723 30724 30725 30726 30727 30728 30729 30730 30731 30732 30733 30734 30735 30736 30737 30738 30739 30740 30741 30742 30743 30744 30745 30746 30747 30748 30749 30750 30751 30752 30753 30754 30755 30756 30757 30758 30759 30760 30761 30762 30763 30764 30765 30766 30767 30768 30769 30770 30771 30772 30773 30774 30775 30776 30777 30778 30779 30780 30781 30782 30783 30784 30785 30786 30787 30788 30789 30790 30791 30792 30793 30794 30795 30796 30797 30798 30799 30800 30801 30802 30803 30804 30805 30806 30807 30808 30809 30810 30811 30812 30813 30814 30815 30816 30817 30818 30819 30820 30821 30822 30823 30824 30825 30826 30827 30828 30829 30830 30831 30832 30833 30834 30835 30836 30837 30838 30839 30840 30841 30842 30843 30844 30845 30846 30847 30848 30849 30850 30851 30852 30853 30854 30855 30856 30857 30858 30859 30860 30861 30862 30863 30864 30865 30866 30867 30868 30869 30870 30871 30872 30873 30874 30875 30876 30877 30878 30879 30880 30881 30882 30883 30884 30885 30886 30887 30888 30889 30890 30891 30892 30893 30894 30895 30896 30897 30898 30899 30900 30901 30902 30903 30904 30905 30906 30907 30908 30909 30910 30911 30912 30913 30914 30915 30916 30917 30918 30919 30920 30921 30922 30923 30924 30925 30926 30927 30928 30929 30930 30931 30932 30933 30934 30935 30936 30937 30938 30939 30940 30941 30942 30943 30944 30945 30946 30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 30958 30959 30960 30961 30962 30963 30964 30965 30966 30967 30968 30969 30970 30971 30972 30973 30974 30975 30976 30977 30978 30979 30980 30981 30982 30983 30984 30985 30986 30987 30988 30989 30990 30991 30992 30993 30994 30995 30996 30997 30998 30999 31000 31001 31002 31003 31004 31005 31006 31007 31008 31009 31010 31011 31012 31013 31014 31015 31016 31017 31018 31019 31020 31021 31022 31023 31024 31025 31026 31027 31028 31029 31030 31031 31032 31033 31034 31035 31036 31037 31038 31039 31040 31041 31042 31043 31044 31045 31046 31047 31048 31049 31050 31051 31052 31053 31054 31055 31056 31057 31058 31059 31060 31061 31062 31063 31064 31065 31066 31067 31068 31069 31070 31071 31072 31073 31074 31075 31076 31077 31078 31079 31080 31081 31082 31083 31084 31085 31086 31087 31088 31089 31090 31091 31092 31093 31094 31095 31096 31097 31098 31099 31100 31101 31102 31103 31104 31105 31106 31107 31108 31109 31110 31111 31112 31113 31114 31115 31116 31117 31118 31119 31120 31121 31122 31123 31124 31125 31126 31127 31128 31129 31130 31131 31132 31133 31134 31135 31136 31137 31138 31139 31140 31141 31142 31143 31144 31145 31146 31147 31148 31149 31150 31151 31152 31153 31154 31155 31156 31157 31158 31159 31160 31161 31162 31163 31164 31165 31166 31167 31168 31169 31170 31171 31172 31173 31174 31175 31176 31177 31178 31179 31180 31181 31182 31183 31184 31185 31186 31187 31188 31189 31190 31191 31192 31193 31194 31195 31196 31197 31198 31199 31200 31201 31202 31203 31204 31205 31206 31207 31208 31209 31210 31211 31212 31213 31214 31215 31216 31217 31218 31219 31220 31221 31222 31223 31224 31225 31226 31227 31228 31229 31230 31231 31232 31233 31234 31235 31236 31237 31238 31239 31240 31241 31242 31243 31244 31245 31246 31247 31248 31249 31250 31251 31252 31253 31254 31255 31256 31257 31258 31259 31260 31261 31262 31263 31264 31265 31266 31267 31268 31269 31270 31271 31272 31273 31274 31275 31276 31277 31278 31279 31280 31281 31282 31283 31284 31285 31286 31287 31288 31289 31290 31291 31292 31293 31294 31295 31296 31297 31298 31299 31300 31301 31302 31303 31304 31305 31306 31307 31308 31309 31310 31311 31312 31313 31314 31315 31316 31317 31318 31319 31320 31321 31322 31323 31324 31325 31326 31327 31328 31329 31330 31331 31332 31333 31334 31335 31336 31337 31338 31339 31340 31341 31342 31343 31344 31345 31346 31347 31348 31349 31350 31351 31352 31353 31354 31355 31356 31357 31358 31359 31360 31361 31362 31363 31364 31365 31366 31367 31368 31369 31370 31371 31372 31373 31374 31375 31376 31377 31378 31379 31380 31381 31382 31383 31384 31385 31386 31387 31388 31389 31390 31391 31392 31393 31394 31395 31396 31397 31398 31399 31400 31401 31402 31403 31404 31405 31406 31407 31408 31409 31410 31411 31412 31413 31414 31415 31416 31417 31418 31419 31420 31421 31422 31423 31424 31425 31426 31427 31428 31429 31430 31431 31432 31433 31434 31435 31436 31437 31438 31439 31440 31441 31442 31443 31444 31445 31446 31447 31448 31449 31450 31451 31452 31453 31454 31455 31456 31457 31458 31459 31460 31461 31462 31463 31464 31465 31466 31467 31468 31469 31470 31471 31472 31473 31474 31475 31476 31477 31478 31479 31480 31481 31482 31483 31484 31485 31486 31487 31488 31489 31490 31491 31492 31493 31494 31495 31496 31497 31498 31499 31500 31501 31502 31503 31504 31505 31506 31507 31508 31509 31510 31511 31512 31513 31514 31515 31516 31517 31518 31519 31520 31521 31522 31523 31524 31525 31526 31527 31528 31529 31530 31531 31532 31533 31534 31535 31536 31537 31538 31539 31540 31541 31542 31543 31544 31545 31546 31547 31548 31549 31550 31551 31552 31553 31554 31555 31556 31557 31558 31559 31560 31561 31562 31563 31564 31565 31566 31567 31568 31569 31570 31571 31572 31573 31574 31575 31576 31577 31578 31579 31580 31581 31582 31583 31584 31585 31586 31587 31588 31589 31590 31591 31592 31593 31594 31595 31596 31597 31598 31599 31600 31601 31602 31603 31604 31605 31606 31607 31608 31609 31610 31611 31612 31613 31614 31615 31616 31617 31618 31619 31620 31621 31622 31623 31624 31625 31626 31627 31628 31629 31630 31631 31632 31633 31634 31635 31636 31637 31638 31639 31640 31641 31642 31643 31644 31645 31646 31647 31648 31649 31650 31651 31652 31653 31654 31655 31656 31657 31658 31659 31660 31661 31662 31663 31664 31665 31666 31667 31668 31669 31670 31671 31672 31673 31674 31675 31676 31677 31678 31679 31680 31681 31682 31683 31684 31685 31686 31687 31688 31689 31690 31691 31692 31693 31694 31695 31696 31697 31698 31699 31700 31701 31702 31703 31704 31705 31706 31707 31708 31709 31710 31711 31712 31713 31714 31715 31716 31717 31718 31719 31720 31721 31722 31723 31724 31725 31726 31727 31728 31729 31730 31731 31732 31733 31734 31735 31736 31737 31738 31739 31740 31741 31742 31743 31744 31745 31746 31747 31748 31749 31750 31751 31752 31753 31754 31755 31756 31757 31758 31759 31760 31761 31762 31763 31764 31765 31766 31767 31768 31769 31770 31771 31772 31773 31774 31775 31776 31777 31778 31779 31780 31781 31782 31783 31784 31785 31786 31787 31788 31789 31790 31791 31792 31793 31794 31795 31796 31797 31798 31799 31800 31801 31802 31803 31804 31805 31806 31807 31808 31809 31810 31811 31812 31813 31814 31815 31816 31817 31818 31819 31820 31821 31822 31823 31824 31825 31826 31827 31828 31829 31830 31831 31832 31833 31834 31835 31836 31837 31838 31839 31840 31841 31842 31843 31844 31845 31846 31847 31848 31849 31850 31851 31852 31853 31854 31855 31856 31857 31858 31859 31860 31861 31862 31863 31864 31865 31866 31867 31868 31869 31870 31871 31872 31873 31874 31875 31876 31877 31878 31879 31880 31881 31882 31883 31884 31885 31886 31887 31888 31889 31890 31891 31892 31893 31894 31895 31896 31897 31898 31899 31900 31901 31902 31903 31904 31905 31906 31907 31908 31909 31910 31911 31912 31913 31914 31915 31916 31917 31918 31919 31920 31921 31922 31923 31924 31925 31926 31927 31928 31929 31930 31931 31932 31933 31934 31935 31936 31937 31938 31939 31940 31941 31942 31943 31944 31945 31946 31947 31948 31949 31950 31951 31952 31953 31954 31955 31956 31957 31958 31959 31960 31961 31962 31963 31964 31965 31966 31967 31968 31969 31970 31971 31972 31973 31974 31975 31976 31977 31978 31979 31980 31981 31982 31983 31984 31985 31986 31987 31988 31989 31990 31991 31992 31993 31994 31995 31996 31997 31998 31999 32000 32001 32002 32003 32004 32005 32006 32007 32008 32009 32010 32011 32012 32013 32014 32015 32016 32017 32018 32019 32020 32021 32022 32023 32024 32025 32026 32027 32028 32029 32030 32031 32032 32033 32034 32035 32036 32037 32038 32039 32040 32041 32042 32043 32044 32045 32046 32047 32048 32049 32050 32051 32052 32053 32054 32055 32056 32057 32058 32059 32060 32061 32062 32063
diff --git a/VisualC-GDK/tests/testgdk/src/testgdk.cpp b/VisualC-GDK/tests/testgdk/src/testgdk.cpp
index ed69ecb..8395c8b 100644
--- a/VisualC-GDK/tests/testgdk/src/testgdk.cpp
+++ b/VisualC-GDK/tests/testgdk/src/testgdk.cpp
@@ -239,17 +239,17 @@ LoadSprite(const char *file)
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
if (!sprites[i]) {
- return (-1);
+ return -1;
}
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_DestroyTexture(sprites[i]);
- return (-1);
+ return -1;
}
}
/* We're ready to roll. :) */
- return (0);
+ return 0;
}
void
@@ -364,8 +364,9 @@ loop()
#endif
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
DrawSprites(state->renderers[i], sprites[i]);
}
}
@@ -382,7 +383,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
@@ -445,7 +446,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
- if (!sprites) {
+ if (sprites == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c
index 0af1536..3ce8125 100644
--- a/Xcode-iOS/Demos/src/accelerometer.c
+++ b/Xcode-iOS/Demos/src/accelerometer.c
@@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)
/* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
- if (!ship) {
+ if (ship == NULL) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
@@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer)
}
/* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
- if (!space) {
+ if (space == NULL) {
fatalError("could not create space texture");
}
SDL_FreeSurface(bmp_surface);
diff --git a/Xcode-iOS/Demos/src/fireworks.c b/Xcode-iOS/Demos/src/fireworks.c
index 600d20b..eb3bb4c 100644
--- a/Xcode-iOS/Demos/src/fireworks.c
+++ b/Xcode-iOS/Demos/src/fireworks.c
@@ -84,14 +84,16 @@ stepParticles(double deltaTime)
/* is the particle actually active, or is it marked for deletion? */
if (curr->isActive) {
/* is the particle off the screen? */
- if (curr->y > screen_h)
+ if (curr->y > screen_h) {
curr->isActive = 0;
- else if (curr->y < 0)
+ } else if (curr->y < 0) {
curr->isActive = 0;
- if (curr->x > screen_w)
+ }
+ if (curr->x > screen_w) {
curr->isActive = 0;
- else if (curr->x < 0)
+ } else if (curr->x < 0) {
curr->isActive = 0;
+ }
/* step velocity, then step position */
curr->yvel += ACCEL * deltaMilliseconds;
@@ -133,15 +135,17 @@ stepParticles(double deltaTime)
}
/* if we're a dust particle, shrink our size */
- if (curr->type == dust)
+ if (curr->type == dust) {
curr->size -= deltaMilliseconds * 0.010f;
+ }
}
/* if we're still active, pack ourselves in the array next
to the last active guy (pack the array tightly) */
- if (curr->isActive)
+ if (curr->isActive) {
*(slot++) = *curr;
+ }
} /* endif (curr->isActive) */
curr++;
}
@@ -188,8 +192,9 @@ explodeEmitter(struct particle *emitter)
int i;
for (i = 0; i < 200; i++) {
- if (num_active_particles >= MAX_PARTICLES)
+ if (num_active_particles >= MAX_PARTICLES) {
return;
+ }
/* come up with a random angle and speed for new particle */
float theta = randomFloat(0, 2.0f * 3.141592);
@@ -226,8 +231,9 @@ void
spawnTrailFromEmitter(struct particle *emitter)
{
- if (num_active_particles >= MAX_PARTICLES)
+ if (num_active_particles >= MAX_PARTICLES) {
return;
+ }
/* select the particle at the slot at the end of our array */
struct particle *p = &particles[num_active_particles];
@@ -262,8 +268,9 @@ void
spawnEmitterParticle(GLfloat x, GLfloat y)
{
- if (num_active_particles >= MAX_PARTICLES)
+ if (num_active_particles >= MAX_PARTICLES) {
return;
+ }
/* find particle at endpoint of array */
struct particle *p = &particles[num_active_particles];
diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c
index 73d4d4f..4256200 100644
--- a/Xcode-iOS/Demos/src/happy.c
+++ b/Xcode-iOS/Demos/src/happy.c
@@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)
/* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
- if (!texture) {
+ if (texture == NULL) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c
index 4d630ba..6ab1db2 100644
--- a/Xcode-iOS/Demos/src/keyboard.c
+++ b/Xcode-iOS/Demos/src/keyboard.c
@@ -165,7 +165,7 @@ loadFont(void)
{
SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");
- if (!surface) {
+ if (surface == NULL) {
printf("Error loading bitmap: %s\n", SDL_GetError());
return 0;
} else {
@@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);
- if (!texture) {
+ if (texture == NULL) {
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */
diff --git a/Xcode-iOS/Demos/src/mixer.c b/Xcode-iOS/Demos/src/mixer.c
index 18e33f1..4c4ffba 100644
--- a/Xcode-iOS/Demos/src/mixer.c
+++ b/Xcode-iOS/Demos/src/mixer.c
@@ -207,9 +207,9 @@ playSound(struct sound *s)
break;
}
/* if this channel's sound is older than the oldest so far, set it to oldest */
- if (mixer.channels[i].timestamp <
- mixer.channels[oldest_channel].timestamp)
+ if (mixer.channels[i].timestamp < mixer.channels[oldest_channel].timestamp) {
oldest_channel = i;
+ }
}
/* no empty channels, take the oldest one */
diff --git a/Xcode-iOS/Demos/src/rectangles.c b/Xcode-iOS/Demos/src/rectangles.c
index a08f997..9102cf2 100644
--- a/Xcode-iOS/Demos/src/rectangles.c
+++ b/Xcode-iOS/Demos/src/rectangles.c
@@ -58,11 +58,11 @@ main(int argc, char *argv[])
/* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
- if (!window) {
+ if (window == NULL) {
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
fatalError("Could not create renderer");
}
diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c
index 6c18463..22a251b 100644
--- a/Xcode-iOS/Demos/src/touch.c
+++ b/Xcode-iOS/Demos/src/touch.c
@@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
brush =
SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_FreeSurface(bmp_surface);
- if (!brush) {
+ if (brush == NULL) {
fatalError("could not create brush texture");
}
/* additive blending -- laying strokes on top of eachother makes them brighter */
diff --git a/src/SDL.c b/src/SDL.c
index cde3434..463cb2b 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -231,7 +231,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the timer subsystem */
- if ((flags & SDL_INIT_TIMER)){
+ if ((flags & SDL_INIT_TIMER)) {
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
if (SDL_TimerInit() < 0) {
@@ -247,7 +247,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the video subsystem */
- if ((flags & SDL_INIT_VIDEO)){
+ if ((flags & SDL_INIT_VIDEO)) {
#if !SDL_VIDEO_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
if (SDL_VideoInit(NULL) < 0) {
@@ -263,7 +263,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the audio subsystem */
- if ((flags & SDL_INIT_AUDIO)){
+ if ((flags & SDL_INIT_AUDIO)) {
#if !SDL_AUDIO_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
if (SDL_AudioInit(NULL) < 0) {
@@ -279,7 +279,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the joystick subsystem */
- if ((flags & SDL_INIT_JOYSTICK)){
+ if ((flags & SDL_INIT_JOYSTICK)) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
if (SDL_JoystickInit() < 0) {
@@ -294,7 +294,7 @@ SDL_InitSubSystem(Uint32 flags)
#endif
}
- if ((flags & SDL_INIT_GAMECONTROLLER)){
+ if ((flags & SDL_INIT_GAMECONTROLLER)) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
if (SDL_GameControllerInit() < 0) {
@@ -310,7 +310,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the haptic subsystem */
- if ((flags & SDL_INIT_HAPTIC)){
+ if ((flags & SDL_INIT_HAPTIC)) {
#if !SDL_HAPTIC_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
if (SDL_HapticInit() < 0) {
@@ -326,7 +326,7 @@ SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the sensor subsystem */
- if ((flags & SDL_INIT_SENSOR)){
+ if ((flags & SDL_INIT_SENSOR)) {
#if !SDL_SENSOR_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
if (SDL_SensorInit() < 0) {
@@ -343,11 +343,11 @@ SDL_InitSubSystem(Uint32 flags)
(void) flags_initialized; /* make static analysis happy, since this only gets used in error cases. */
- return (0);
+ return 0;
quit_and_error:
SDL_QuitSubSystem(flags_initialized);
- return (-1);
+ return -1;
}
int
@@ -522,8 +522,7 @@ SDL_GetVersion(SDL_version * ver)
static SDL_bool check_hint = SDL_TRUE;
static SDL_bool legacy_version = SDL_FALSE;
- if (!ver) {
- return;
+ if (ver == NULL) { return;
}
SDL_VERSION(ver);
diff --git a/src/SDL_assert.c b/src/SDL_assert.c
index aa8d235..e60f7a9 100644
--- a/src/SDL_assert.c
+++ b/src/SDL_assert.c
@@ -252,10 +252,7 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
} else {
state = (SDL_assert_state)selected;
}
- }
-
- else
- {
+ } else {
#if defined(__EMSCRIPTEN__)
/* This is nasty, but we can't block on a custom UI. */
for ( ; ; ) {
diff --git a/src/SDL_dataqueue.c b/src/SDL_dataqueue.c
index e63fc6d..6a44621 100644
--- a/src/SDL_dataqueue.c
+++ b/src/SDL_dataqueue.c
@@ -58,7 +58,7 @@ SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
{
SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue));
- if (!queue) {
+ if (queue == NULL) {
SDL_OutOfMemory();
return NULL;
} else {
@@ -102,7 +102,7 @@ SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack)
SDL_DataQueuePacket *prev = NULL;
size_t i;
- if (!queue) {
+ if (queue == NULL) {
return;
}
@@ -181,7 +181,7 @@ SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len)
size_t origlen;
size_t datalen;
- if (!queue) {
+ if (queue == NULL) {
return SDL_InvalidParamError("queue");
}
@@ -191,13 +191,13 @@ SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len)
while (len > 0) {
SDL_DataQueuePacket *packet = queue->tail;
- SDL_assert(!packet || (packet->datalen <= packet_size));
- if (!packet || (packet->datalen >= packet_size)) {
+ SDL_assert(packet == NULL || (packet->datalen <= packet_size));
+ if (packet == NULL || (packet->datalen >= packet_size)) {
/* tail packet missing or completely full; we need a new packet. */
packet = AllocateDataQueuePacket(queue);
- if (!packet) {
+ if (packet == NULL) {
/* uhoh, reset so we've queued nothing new, free what we can. */
- if (!origtail) {
+ if (origtail == NULL) {
packet = queue->head; /* whole queue. */
} else {
packet = origtail->next; /* what we added to existing queue. */
@@ -232,7 +232,7 @@ SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
Uint8 *ptr = buf;
SDL_DataQueuePacket *packet;
- if (!queue) {
+ if (queue == NULL) {
return 0;
}
@@ -257,7 +257,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
Uint8 *ptr = buf;
SDL_DataQueuePacket *packet;
- if (!queue) {
+ if (queue == NULL) {
return 0;
}
@@ -300,7 +300,7 @@ SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
{
SDL_DataQueuePacket *packet;
- if (!queue) {
+ if (queue == NULL) {
SDL_InvalidParamError("queue");
return NULL;
} else if (len == 0) {
@@ -324,7 +324,7 @@ SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
/* Need a fresh packet. */
packet = AllocateDataQueuePacket(queue);
- if (!packet) {
+ if (packet == NULL) {
SDL_OutOfMemory();
return NULL;
}
diff --git a/src/SDL_guid.c b/src/SDL_guid.c
index d3529b7..f75ab0a 100644
--- a/src/SDL_guid.c
+++ b/src/SDL_guid.c
@@ -52,15 +52,15 @@ void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
static unsigned char nibble(unsigned char c)
{
if ((c >= '0') && (c <= '9')) {
- return (c - '0');
+ return c - '0';
}
if ((c >= 'A') && (c <= 'F')) {
- return (c - 'A' + 0x0a);
+ return c - 'A' + 0x0a;
}
if ((c >= 'a') && (c <= 'f')) {
- return (c - 'a' + 0x0a);
+ return c - 'a' + 0x0a;
}
/* received an invalid character, and no real way to return an error */
diff --git a/src/SDL_hints.c b/src/SDL_hints.c
index 4341f8d..5e310ca 100644
--- a/src/SDL_hints.c
+++ b/src/SDL_hints.c
@@ -52,7 +52,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
SDL_Hint *hint;
SDL_HintWatch *entry;
- if (!name) {
+ if (name == NULL) {
return SDL_FALSE;
}
@@ -67,7 +67,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
return SDL_FALSE;
}
if (hint->value != value &&
- (!value || !hint->value || SDL_strcmp(hint->value, value) != 0)) {
+ (value == NULL || !hint->value || SDL_strcmp(hint->value, value) != 0)) {
for (entry = hint->callbacks; entry; ) {
/* Save the next entry in case this one is deleted */
SDL_HintWatch *next = entry->next;
@@ -84,7 +84,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
/* Couldn't find the hint, add a new one */
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
- if (!hint) {
+ if (hint == NULL) {
return SDL_FALSE;
}
hint->name = SDL_strdup(name);
@@ -103,7 +103,7 @@ SDL_ResetHint(const char *name)
SDL_Hint *hint;
SDL_HintWatch *entry;
- if (!name) {
+ if (name == NULL) {
return SDL_FALSE;
}
@@ -181,7 +181,7 @@ SDL_GetHint(const char *name)
SDL_bool
SDL_GetStringBoolean(const char *value, SDL_bool default_value)
{
- if (!value || !*value) {
+ if (value == NULL || !*value) {
return default_value;
}
if (*value == '0' || SDL_strcasecmp(value, "false") == 0) {
@@ -204,7 +204,7 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
SDL_HintWatch *entry;
const char *value;
- if (!name || !*name) {
+ if (name == NULL || !*name) {
SDL_InvalidParamError("name");
return;
}
@@ -216,7 +216,7 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
SDL_DelHintCallback(name, callback, userdata);
entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry));
- if (!entry) {
+ if (entry == NULL) {
SDL_OutOfMemory();
return;
}
@@ -228,10 +228,10 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
break;
}
}
- if (!hint) {
+ if (hint == NULL) {
/* Need to add a hint entry for this watcher */
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
- if (!hint) {
+ if (hint == NULL) {
SDL_OutOfMemory();
SDL_free(entry);
return;
diff --git a/src/SDL_log.c b/src/SDL_log.c
index c01e31d..63743da 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -108,7 +108,7 @@ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
void
SDL_LogInit(void)
{
- if (!log_function_mutex) {
+ if (log_function_mutex == NULL) {
/* if this fails we'll try to continue without it. */
log_function_mutex = SDL_CreateMutex();
}
@@ -316,7 +316,7 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
return;
}
- if (!log_function_mutex) {
+ if (log_function_mutex == NULL) {
/* this mutex creation can race if you log from two threads at startup. You should have called SDL_Init first! */
log_function_mutex = SDL_CreateMutex();
}
@@ -326,15 +326,17 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
len = SDL_vsnprintf(stack_buf, sizeof(stack_buf), fmt, aq);
va_end(aq);
- if (len < 0)
+ if (len < 0) {
return;
+ }
/* If message truncated, allocate and re-render */
if (len >= sizeof(stack_buf) && SDL_size_add_overflow(len, 1, &len_plus_term) == 0) {
/* Allocate exactly what we need, including the zero-terminator */
message = (char *)SDL_malloc(len_plus_term);
- if (!message)
+ if (message == NULL) {
return;
+ }
va_copy(aq, ap);
len = SDL_vsnprintf(message, len_plus_term, fmt, aq);
va_end(aq);
diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c
index a89134e..deea13d 100644
--- a/src/atomic/SDL_atomic.c
+++ b/src/atomic/SDL_atomic.c
@@ -129,15 +129,15 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
{
#ifdef HAVE_MSC_ATOMICS
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value));
- return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval);
+ return _InterlockedCompareExchange((long *)&a->value, (long)newval, (long)oldval) == (long)oldval;
#elif defined(HAVE_WATCOM_ATOMICS)
- return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval);
+ return (SDL_bool)_SDL_cmpxchg_watcom(&a->value, newval, oldval);
#elif defined(HAVE_GCC_ATOMICS)
return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
#elif defined(__SOLARIS__)
- return (SDL_bool) ((int) atomic_cas_uint((volatile uint_t*)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
+ return (SDL_bool)((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
#elif EMULATE_CAS
SDL_bool retval = SDL_FALSE;
@@ -158,9 +158,9 @@ SDL_bool
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
{
#if defined(HAVE_MSC_ATOMICS)
- return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval);
+ return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval;
#elif defined(HAVE_WATCOM_ATOMICS)
- return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
+ return (SDL_bool)_SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_bool_compare_and_swap(a, oldval, newval);
#elif defined(__MACOSX__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
@@ -168,7 +168,7 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
#elif defined(__MACOSX__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
#elif defined(__SOLARIS__)
- return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval);
+ return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval);
#elif EMULATE_CAS
SDL_bool retval = SDL_FALSE;
@@ -190,13 +190,13 @@ SDL_AtomicSet(SDL_atomic_t *a, int v)
{
#ifdef HAVE_MSC_ATOMICS
SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value));
- return _InterlockedExchange((long*)&a->value, v);
+ return _InterlockedExchange((long *)&a->value, v);
#elif defined(HAVE_WATCOM_ATOMICS)
return _SDL_xchg_watcom(&a->value, v);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_lock_test_and_set(&a->value, v);
#elif defined(__SOLARIS__)
- return (int) atomic_swap_uint((volatile uint_t*)&a->value, v);
+ return (int)atomic_swap_uint((volatile uint_t *)&a->value, v);
#else
int value;
do {
@@ -212,7 +212,7 @@ SDL_AtomicSetPtr(void **a, void *v)
#if defined(HAVE_MSC_ATOMICS)
return _InterlockedExchangePointer(a, v);
#elif defined(HAVE_WATCOM_ATOMICS)
- return (void *) _SDL_xchg_watcom((int *)a, (long)v);
+ return (void *)_SDL_xchg_watcom((int *)a, (long)v);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_lock_test_and_set(a, v);
#elif defined(__SOLARIS__)
@@ -231,7 +231,7 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
{
#ifdef HAVE_MSC_ATOMICS
SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(long) == sizeof(a->value));
- return _InterlockedExchangeAdd((long*)&a->value, v);
+ return _InterlockedExchangeAdd((long *)&a->value, v);
#elif defined(HAVE_WATCOM_ATOMICS)
return _SDL_xadd_watcom(&a->value, v);
#elif defined(HAVE_GCC_ATOMICS)
diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index 965c021..58f5cf6 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -66,7 +66,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
/* Terrible terrible damage */
static SDL_mutex *_spinlock_mutex;
- if (!_spinlock_mutex) {
+ if (_spinlock_mutex == NULL) {
/* Race condition on first lock... */
_spinlock_mutex = SDL_CreateMutex();
}
@@ -81,14 +81,14 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
}
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
- return (__sync_lock_test_and_set(lock, 1) == 0);
+ return __sync_lock_test_and_set(lock, 1) == 0;
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
- return (_InterlockedExchange_acq(lock, 1) == 0);
+ return _InterlockedExchange_acq(lock, 1) == 0;
#elif defined(_MSC_VER)
SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
- return (InterlockedExchange((long*)lock, 1) == 0);
+ return InterlockedExchange((long *)lock, 1) == 0;
#elif defined(__WATCOMC__) && defined(__386__)
return _SDL_xchg_watcom(lock, 1) == 0;
@@ -105,28 +105,28 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
__asm__ __volatile__ (
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
- return (result == 0);
+ return result == 0;
}
#endif
__asm__ __volatile__ (
"swp %0, %1, [%2]\n"
: "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory");
- return (result == 0);
+ return result == 0;
#elif defined(__GNUC__) && defined(__arm__)
int result;
__asm__ __volatile__ (
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
- return (result == 0);
+ return result == 0;
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
int result;
__asm__ __volatile__(
"lock ; xchgl %0, (%1)\n"
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
- return (result == 0);
+ return result == 0;
#elif defined(__MACOSX__) || defined(__IPHONEOS__)
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
@@ -134,11 +134,11 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
#elif defined(__SOLARIS__) && defined(_LP64)
/* Used for Solaris with non-gcc compilers. */
- return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)lock, 0, 1) == 0);
+ return (SDL_bool)((int)atomic_cas_64((volatile uint64_t *)lock, 0, 1) == 0);
#elif defined(__SOLARIS__) && !defined(_LP64)
/* Used for Solaris with non-gcc compilers. */
- return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)lock, 0, 1) == 0);
+ return (SDL_bool)((int)atomic_cas_32((volatile uint32_t *)lock, 0, 1) == 0);
#elif defined(PS2)
uint32_t oldintr;
SDL_bool res = SDL_FALSE;
@@ -150,7 +150,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
res = SDL_TRUE;
}
// enable interuption
- if(oldintr) { EIntr(); }
+ if (oldintr) { EIntr(); }
return res;
#else
#error Please implement for your platform.
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 0888878..91d0133 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -541,11 +541,9 @@ SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle)
} else {
mark_device_removed(handle, current_audio.outputDevices, ¤t_audio.outputDevicesRemoved);
}
- for (device_index = 0; device_index < SDL_arraysize(open_devices); device_index++)
- {
+ for (device_index = 0; device_index < SDL_arraysize(open_devices); device_index++) {
device = open_devices[device_index];
- if (device != NULL && device->handle == handle)
- {
+ if (device != NULL && device->handle == handle) {
device_was_opened = SDL_TRUE;
SDL_OpenedAudioDeviceDisconnected(device);
break;
@@ -1009,7 +1007,7 @@ SDL_AudioInit(const char *driver_name)
}
} else {
for (i = 0; (!initialized) && (bootstrap[i]); ++i) {
- if(bootstrap[i]->demand_only) {
+ if (bootstrap[i]->demand_only) {
continue;
}
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 69427c5..398bdba 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -184,7 +184,7 @@ ResamplerPadding(const int inrate, const int outrate)
return 0;
}
if (inrate > outrate) {
- return (int) SDL_ceilf(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate)));
+ return (int)SDL_ceilf(((float)(RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float)outrate)));
}
return RESAMPLER_SAMPLES_PER_ZERO_CROSSING;
}
@@ -249,7 +249,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
outtime = ((ResampleFloatType) i) / ((ResampleFloatType) outrate);
}
- return outframes * chans * sizeof (float);
+ return outframes * chans * sizeof(float);
}
int
@@ -488,7 +488,7 @@ SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format
/* we keep no streaming state here, so pad with silence on both ends. */
padding = (float *) SDL_calloc(paddingsamples ? paddingsamples : 1, sizeof (float));
- if (!padding) {
+ if (padding == NULL) {
SDL_OutOfMemory();
return;
}
@@ -586,7 +586,7 @@ SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels,
!!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates,
!!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */
if (cvt->filter_index >= (SDL_AUDIOCVT_MAX_FILTERS-2)) {
- return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS-2);
+ return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS - 2);
}
cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1] = (SDL_AudioFilter) (uintptr_t) src_rate;
cvt->filters[SDL_AUDIOCVT_MAX_FILTERS] = (SDL_AudioFilter) (uintptr_t) dst_rate;
@@ -788,7 +788,7 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
}
cvt->needed = (cvt->filter_index != 0);
- return (cvt->needed);
+ return cvt->needed;
}
typedef int (*SDL_ResampleAudioStreamFunc)(SDL_AudioStream *stream, const void *inbuf, const int inbuflen, void *outbuf, const int outbuflen);
@@ -835,7 +835,7 @@ EnsureStreamBufferSize(SDL_AudioStream *stream, const int newlen)
ptr = stream->work_buffer_base;
} else {
ptr = (Uint8 *) SDL_realloc(stream->work_buffer_base, newlen + 32);
- if (!ptr) {
+ if (ptr == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -911,12 +911,12 @@ SetupLibSampleRateResampling(SDL_AudioStream *stream)
if (SRC_available) {
state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result);
- if (!state) {
+ if (state == NULL) {
SDL_SetError("src_new() failed: %s", SRC_src_strerror(result));
}
}
- if (!state) {
+ if (state == NULL) {
SDL_CleanupAudioStreamResampler_SRC(stream);
return SDL_FALSE;
}
@@ -983,7 +983,7 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format,
SDL_AudioStream *retval;
retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream));
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1126,7 +1126,7 @@ SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, in
#endif
workbuf = EnsureStreamBufferSize(stream, workbuflen);
- if (!workbuf) {
+ if (workbuf == NULL) {
return -1; /* probably out of memory. */
}
@@ -1193,8 +1193,9 @@ SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, in
if (maxputbytes) {
const int maxbytes = *maxputbytes;
- if (buflen > maxbytes)
+ if (buflen > maxbytes) {
buflen = maxbytes;
+ }
*maxputbytes -= buflen;
}
@@ -1217,10 +1218,10 @@ SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len)
SDL_Log("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen);
#endif
- if (!stream) {
+ if (stream == NULL) {
return SDL_InvalidParamError("stream");
}
- if (!buf) {
+ if (buf == NULL) {
return SDL_InvalidParamError("buf");
}
if (len == 0) {
@@ -1272,7 +1273,7 @@ SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len)
int SDL_AudioStreamFlush(SDL_AudioStream *stream)
{
- if (!stream) {
+ if (stream == NULL) {
return SDL_InvalidParamError("stream");
}
@@ -1290,8 +1291,9 @@ int SDL_AudioStreamFlush(SDL_AudioStream *stream)
const SDL_bool first_run = stream->first_run;
const int filled = stream->staging_buffer_filled;
int actual_input_frames = filled / stream->src_sample_frame_size;
- if (!first_run)
+ if (!first_run) {
actual_input_frames += stream->resampler_padding_samples / stream->pre_resample_channels;
+ }
if (actual_input_frames > 0) { /* don't bother if nothing to flush. */
/* This is how many bytes we're expecting without silence appended. */
@@ -1330,10 +1332,10 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len)
SDL_Log("AUDIOSTREAM: want to get %d converted bytes\n", len);
#endif
- if (!stream) {
+ if (stream == NULL) {
return SDL_InvalidParamError("stream");
}
- if (!buf) {
+ if (buf == NULL) {
return SDL_InvalidParamError("buf");
}
if (len <= 0) {
@@ -1343,20 +1345,20 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len)
return SDL_SetError("Can't request partial sample frames");
}
- return (int) SDL_ReadFromDataQueue(stream->queue, buf, len);
+ return (int)SDL_ReadFromDataQueue(stream->queue, buf, len);
}
/* number of converted/resampled bytes available */
int
SDL_AudioStreamAvailable(SDL_AudioStream *stream)
{
- return stream ? (int) SDL_CountDataQueue(stream->queue) : 0;
+ return stream ? (int)SDL_CountDataQueue(stream->queue) : 0;
}
void
SDL_AudioStreamClear(SDL_AudioStream *stream)
{
- if (!stream) {
+ if (stream == NULL) {
SDL_InvalidParamError("stream");
} else {
SDL_ClearDataQueue(stream->queue, stream->packetlen * 2);
diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c
index 0d06f65..ee674d7 100644
--- a/src/audio/SDL_audiodev.c
+++ b/src/audio/SDL_audiodev.c
@@ -84,8 +84,9 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (*
const char *audiodev;
char audiopath[1024];
- if (test == NULL)
+ if (test == NULL) {
test = test_stub;
+ }
/* Figure out what our audio device is */
if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) &&
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index e49b550..9a0b9cc 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -820,7 +820,7 @@ IMA_ADPCM_Init(WaveFile *file, size_t datalength)
/* There's no specification for this, but it's basically the same
* format because the extensible header has wSampePerBlocks too.
*/
- } else {
+ } else {
/* The Standards Update says there 'should' be 2 bytes for wSamplesPerBlock. */
if (chunk->size >= 20 && format->extsize >= 2) {
format->samplesperblock = chunk->data[18] | ((Uint16)chunk->data[19] << 8);
@@ -901,14 +901,18 @@ IMA_ADPCM_ProcessNibble(Sint8 *cindex, Sint16 lastsample, Uint8 nybble)
* (nybble & 0x8 ? -1 : 1) * ((nybble & 0x7) * step / 4 + step / 8)
*/
delta = step >> 3;
- if (nybble & 0x04)
+ if (nybble & 0x04) {
delta += step;
- if (nybble & 0x02)
+ }
+ if (nybble & 0x02) {
delta += step >> 1;
- if (nybble & 0x01)
+ }
+ if (nybble & 0x01) {
delta += step >> 2;
- if (nybble & 0x08)
+ }
+ if (nybble & 0x08) {
delta = -delta;
+ }
sample = lastsample + delta;
diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c
index 5f31866..2fac336 100644
--- a/src/audio/aaudio/SDL_aaudio.c
+++ b/src/audio/aaudio/SDL_aaudio.c
@@ -441,7 +441,7 @@ SDL_bool aaudio_DetectBrokenPlayState( void )
int64_t framePosition, timeNanoseconds;
aaudio_result_t res;
- if ( !audioDevice || !audioDevice->hidden ) {
+ if (audioDevice == NULL || !audioDevice->hidden ) {
return SDL_FALSE;
}
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 59de607..7e35efd 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -233,7 +233,7 @@ get_audio_device(void *handle, const int channels)
const char *device;
if (handle != NULL) {
- return (const char *) handle;
+ return (const char *)handle;
}
/* !!! FIXME: we also check "SDL_AUDIO_DEVICE_NAME" at the higher level. */
@@ -401,8 +401,7 @@ ALSA_PlayDevice(_THIS)
return;
}
continue;
- }
- else if (status == 0) {
+ } else if (status == 0) {
/* No frames were written (no available space in pcm device).
Allow other threads to catch up. */
Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq;
@@ -417,7 +416,7 @@ ALSA_PlayDevice(_THIS)
static Uint8 *
ALSA_GetDeviceBuf(_THIS)
{
- return (this->hidden->mixbuf);
+ return this->hidden->mixbuf;
}
static int
@@ -441,8 +440,7 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
if (status == -EAGAIN) {
ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time);
status = 0;
- }
- else if (status < 0) {
+ } else if (status < 0) {
/*printf("ALSA: capture error %d\n", status);*/
status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
if (status < 0) {
@@ -503,7 +501,7 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
status = ALSA_snd_pcm_hw_params_set_period_size_near(
this->hidden->pcm_handle, hwparams, &persize, NULL);
if ( status < 0 ) {
- return(-1);
+ return -1;
}
/* Need to at least double buffer */
@@ -511,19 +509,19 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
status = ALSA_snd_pcm_hw_params_set_periods_min(
this->hidden->pcm_handle, hwparams, &periods, NULL);
if ( status < 0 ) {
- return(-1);
+ return -1;
}
status = ALSA_snd_pcm_hw_params_set_periods_first(
this->hidden->pcm_handle, hwparams, &periods, NULL);
if ( status < 0 ) {
- return(-1);
+ return -1;
}
/* "set" the hardware with the desired parameters */
status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams);
if ( status < 0 ) {
- return(-1);
+ return -1;
}
this->spec.samples = persize;
@@ -539,7 +537,7 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
persize, periods, bufsize);
}
- return(0);
+ return 0;
}
static int
@@ -575,8 +573,7 @@ ALSA_OpenDevice(_THIS, const char *devname)
SND_PCM_NONBLOCK);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't open audio device: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't open audio device: %s", ALSA_snd_strerror(status));
}
this->hidden->pcm_handle = pcm_handle;
@@ -585,16 +582,14 @@ ALSA_OpenDevice(_THIS, const char *devname)
snd_pcm_hw_params_alloca(&hwparams);
status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't get hardware config: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't get hardware config: %s", ALSA_snd_strerror(status));
}
/* SDL only uses interleaved sample output */
status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't set interleaved access: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't set interleaved access: %s", ALSA_snd_strerror(status));
}
/* Try for a closest match on audio format */
@@ -676,8 +671,7 @@ ALSA_OpenDevice(_THIS, const char *devname)
status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
&rate, NULL);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't set audio frequency: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't set audio frequency: %s", ALSA_snd_strerror(status));
}
this->spec.freq = rate;
@@ -691,24 +685,20 @@ ALSA_OpenDevice(_THIS, const char *devname)
snd_pcm_sw_params_alloca(&swparams);
status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't get software config: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't get software config: %s", ALSA_snd_strerror(status));
}
status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
if (status < 0) {
- return SDL_SetError("Couldn't set minimum available samples: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("Couldn't set minimum available samples: %s", ALSA_snd_strerror(status));
}
status =
ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
if (status < 0) {
- return SDL_SetError("ALSA: Couldn't set start threshold: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("ALSA: Couldn't set start threshold: %s", ALSA_snd_strerror(status));
}
status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
if (status < 0) {
- return SDL_SetError("Couldn't set software audio parameters: %s",
- ALSA_snd_strerror(status));
+ return SDL_SetError("Couldn't set software audio parameters: %s", ALSA_snd_strerror(status));
}
/* Calculate the final parameters for this audio specification */
@@ -749,7 +739,7 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee
char *handle = NULL;
char *ptr;
- if (!dev) {
+ if (dev == NULL) {
return;
}
@@ -759,7 +749,7 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee
Make sure not to free the storage associated with desc in this case */
if (hint) {
desc = ALSA_snd_device_name_get_hint(hint, "DESC");
- if (!desc) {
+ if (desc == NULL) {
SDL_free(dev);
return;
}
@@ -779,7 +769,7 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee
/*printf("ALSA: adding %s device '%s' (%s)\n", iscapture ? "capture" : "output", name, desc);*/
handle = SDL_strdup(name);
- if (!handle) {
+ if (handle == NULL) {
if (hint) {
free(desc);
}
@@ -792,8 +782,9 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee
* enumeration time
*/
SDL_AddAudioDevice(iscapture, desc, NULL, handle);
- if (hint)
+ if (hint) {
free(desc);
+ }
dev->name = handle;
dev->iscapture = iscapture;
dev->next = *pSeen;
@@ -832,7 +823,7 @@ ALSA_HotplugIteration(void)
if we can find a preferred prefix for the system. */
for (i = 0; hints[i]; i++) {
char *name = ALSA_snd_device_name_get_hint(hints[i], "NAME");
- if (!name) {
+ if (name == NULL) {
continue;
}
@@ -861,17 +852,17 @@ ALSA_HotplugIteration(void)
char *name;
/* if we didn't find a device name prefix we like at all... */
- if ((!match) && (defaultdev != i)) {
+ if ((match == NULL) && (defaultdev != i)) {
continue; /* ...skip anything that isn't the default device. */
}
name = ALSA_snd_device_name_get_hint(hints[i], "NAME");
- if (!name) {
+ if (name == NULL) {
continue;
}
/* only want physical hardware interfaces */
- if (!match || (SDL_strncmp(name, match, match_len) == 0)) {
+ if (match == NULL || (SDL_strncmp(name, match, match_len) == 0)) {
char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID");
const SDL_bool isoutput = (ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0);
const SDL_bool isinput = (ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0);
@@ -896,8 +887,12 @@ ALSA_HotplugIteration(void)
}
dev->next = seen;
seen = dev;
- if (isinput) have_input = SDL_TRUE;
- if (isoutput) have_output = SDL_TRUE;
+ if (isinput) {
+ have_input = SDL_TRUE;
+ }
+ if (isoutput) {
+ have_output = SDL_TRUE;
+ }
} else {
prev = dev;
}
diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index aa0d442..7db3cbc 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -147,26 +147,24 @@ void ANDROIDAUDIO_PauseDevices(void)
{
/* TODO: Handle multiple devices? */
struct SDL_PrivateAudioData *private;
- if(audioDevice != NULL && audioDevice->hidden != NULL) {
+ if (audioDevice != NULL && audioDevice->hidden != NULL) {
private = (struct SDL_PrivateAudioData *) audioDevice->hidden;
if (SDL_AtomicGet(&audioDevice->paused)) {
/* The device is already paused, leave it alone */
private->resume = SDL_FALSE;
- }
- else {
+ } else {
SDL_LockMutex(audioDevice->mixer_lock);
SDL_AtomicSet(&audioDevice->paused, 1);
private->resume = SDL_TRUE;
}
}
- if(captureDevice != NULL && captureDevice->hidden != NULL) {
+ if (captureDevice != NULL && captureDevice->hidden != NULL) {
private = (struct SDL_PrivateAudioData *) captureDevice->hidden;
if (SDL_AtomicGet(&captureDevice->paused)) {
/* The device is already paused, leave it alone */
private->resume = SDL_FALSE;
- }
- else {
+ } else {
SDL_LockMutex(captureDevice->mixer_lock);
SDL_AtomicSet(&captureDevice->paused, 1);
private->resume = SDL_TRUE;
@@ -179,7 +177,7 @@ void ANDROIDAUDIO_ResumeDevices(void)
{
/* TODO: Handle multiple devices? */
struct SDL_PrivateAudioData *private;
- if(audioDevice != NULL && audioDevice->hidden != NULL) {
+ if (audioDevice != NULL && audioDevice->hidden != NULL) {
private = (struct SDL_PrivateAudioData *) audioDevice->hidden;
if (private->resume) {
SDL_AtomicSet(&audioDevice->paused, 0);
@@ -188,7 +186,7 @@ void ANDROIDAUDIO_ResumeDevices(void)
}
}
- if(captureDevice != NULL && captureDevice->hidden != NULL) {
+ if (captureDevice != NULL && captureDevice->hidden != NULL) {
private = (struct SDL_PrivateAudioData *) captureDevice->hidden;
if (private->resume) {
SDL_AtomicSet(&captureDevice->paused, 0);
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index 885b5f0..e000cf7 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -296,7 +296,7 @@ DSOUND_GetDeviceBuf(_THIS)
}
if (result != DS_OK) {
SetDSerror("DirectSound GetCurrentPosition", result);
- return (NULL);
+ return NULL;
}
cursor /= this->spec.size;
#ifdef DEBUG_SOUND
@@ -331,9 +331,9 @@ DSOUND_GetDeviceBuf(_THIS)
}
if (result != DS_OK) {
SetDSerror("DirectSound Lock", result);
- return (NULL);
+ return NULL;
}
- return (this->hidden->locked_buf);
+ return this->hidden->locked_buf;
}
static int
diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c
index 0a7a395..1a7f08b 100644
--- a/src/audio/disk/SDL_diskaudio.c
+++ b/src/audio/disk/SDL_diskaudio.c
@@ -68,7 +68,7 @@ DISKAUDIO_PlayDevice(_THIS)
static Uint8 *
DISKAUDIO_GetDeviceBuf(_THIS)
{
- return (_this->hidden->mixbuf);
+ return _this->hidden->mixbuf;
}
static int
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index 8734f79..de67bf0 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -82,12 +82,13 @@ DSP_OpenDevice(_THIS, const char *devname)
/* Make sure fragment size stays a power of 2, or OSS fails. */
/* I don't know which of these are actually legal values, though... */
- if (this->spec.channels > 8)
+ if (this->spec.channels > 8) {
this->spec.channels = 8;
- else if (this->spec.channels > 4)
+ } else if (this->spec.channels > 4) {
this->spec.channels = 4;
- else if (this->spec.channels > 2)
+ } else if (this->spec.channels > 2) {
this->spec.channels = 2;
+ }
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
@@ -260,13 +261,13 @@ DSP_PlayDevice(_THIS)
static Uint8 *
DSP_GetDeviceBuf(_THIS)
{
- return (this->hidden->mixbuf);
+ return this->hidden->mixbuf;
}
static int
DSP_CaptureFromDevice(_THIS, void *buffer, int buflen)
{
- return (int) read(this->hidden->audio_fd, buffer, buflen);
+ return (int)read(this->hidden->audio_fd, buffer, buflen);
}
static void
diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c
index f6e7e0c..3302c34 100644
--- a/src/audio/jack/SDL_jackaudio.c
+++ b/src/audio/jack/SDL_jackaudio.c
@@ -313,7 +313,7 @@ JACK_OpenDevice(_THIS, const char *devname)
}
devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags);
- if (!devports || !devports[0]) {
+ if (devports == NULL || !devports[0]) {
return SDL_SetError("No physical JACK ports available");
}
diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c
index 5f021ea..9a223fb 100644
--- a/src/audio/netbsd/SDL_netbsdaudio.c
+++ b/src/audio/netbsd/SDL_netbsdaudio.c
@@ -146,7 +146,7 @@ NETBSDAUDIO_PlayDevice(_THIS)
static Uint8 *
NETBSDAUDIO_GetDeviceBuf(_THIS)
{
- return (this->hidden->mixbuf);
+ return this->hidden->mixbuf;
}
diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c
index 474de3b..814a75a 100644
--- a/src/audio/openslES/SDL_openslES.c
+++ b/src/audio/openslES/SDL_openslES.c
@@ -424,7 +424,7 @@ openslES_CreatePCMPlayer(_THIS)
it can be done as described here:
https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
*/
- if(SDL_GetAndroidSDKVersion() >= 21) {
+ if (SDL_GetAndroidSDKVersion() >= 21) {
SDL_AudioFormat test_format;
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
if (SDL_AUDIO_ISSIGNED(test_format)) {
@@ -499,7 +499,7 @@ openslES_CreatePCMPlayer(_THIS)
break;
}
- if(SDL_AUDIO_ISFLOAT(this->spec.format)) {
+ if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
/* Copy all setup into PCM EX structure */
format_pcm_ex.formatType = SL_ANDROID_DATAFORMAT_PCM_EX;
format_pcm_ex.endianness = format_pcm.endianness;
diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c
index 2e173ef..f707a2d 100644
--- a/src/audio/pipewire/SDL_pipewire.c
+++ b/src/audio/pipewire/SDL_pipewire.c
@@ -1065,7 +1065,7 @@ input_callback(void *data)
}
pw_buf = PIPEWIRE_pw_stream_dequeue_buffer(stream);
- if (!pw_buf) {
+ if (pw_buf == NULL) {
return;
}
@@ -1189,15 +1189,15 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname)
/* Get the hints for the application name, stream name and role */
app_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME);
- if (!app_name || *app_name == '\0') {
+ if (app_name == NULL || *app_name == '\0') {
app_name = SDL_GetHint(SDL_HINT_APP_NAME);
- if (!app_name || *app_name == '\0') {
+ if (app_name == NULL || *app_name == '\0') {
app_name = "SDL Application";
}
}
stream_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME);
- if (!stream_name || *stream_name == '\0') {
+ if (stream_name == NULL || *stream_name == '\0') {
stream_name = "Audio Stream";
}
@@ -1206,7 +1206,7 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname)
* but 'Game' seems more appropriate for the majority of SDL applications.
*/
stream_role = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_ROLE);
- if (!stream_role || *stream_role == '\0') {
+ if (stream_role == NULL || *stream_role == '\0') {
stream_role = "Game";
}
diff --git a/src/audio/ps2/SDL_ps2audio.c b/src/audio/ps2/SDL_ps2audio.c
index b050984..fa85f04 100644
--- a/src/audio/ps2/SDL_ps2audio.c
+++ b/src/audio/ps2/SDL_ps2audio.c
@@ -156,8 +156,9 @@ static void PS2AUDIO_Deinitialize(void)
static SDL_bool PS2AUDIO_Init(SDL_AudioDriverImpl * impl)
{
- if(init_audio_driver() < 0)
+ if (init_audio_driver() < 0) {
return SDL_FALSE;
+ }
/* Set the function pointers */
impl->OpenDevice = PS2AUDIO_OpenDevice;
diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c
index d908170..077b001 100644
--- a/src/audio/psp/SDL_pspaudio.c
+++ b/src/audio/psp/SDL_pspaudio.c
@@ -105,7 +105,7 @@ PSPAUDIO_OpenDevice(_THIS, const char *devname)
static void PSPAUDIO_PlayDevice(_THIS)
{
- if (this->spec.freq != 44100){
+ if (this->spec.freq != 44100) {
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
SDL_assert(this->spec.channels == 2);
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX, mixbuf);
@@ -131,7 +131,7 @@ static Uint8 *PSPAUDIO_GetDeviceBuf(_THIS)
static void PSPAUDIO_CloseDevice(_THIS)
{
if (this->hidden->channel >= 0) {
- if (this->spec.freq != 44100){
+ if (this->spec.freq != 44100) {
sceAudioSRCChRelease();
} else {
sceAudioChRelease(this->hidden->channel);
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 288c3d9..a6360da 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -53,17 +53,11 @@ static SDL_bool include_monitors = SDL_FALSE;
#if (PA_API_VERSION < 12)
/** Return non-zero if the passed state is one of the connected states */
static SDL_INLINE int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
- return
- x == PA_CONTEXT_CONNECTING ||
- x == PA_CONTEXT_AUTHORIZING ||
- x == PA_CONTEXT_SETTING_NAME ||
- x == PA_CONTEXT_READY;
+ return x == PA_CONTEXT_CONNECTING || x == PA_CONTEXT_AUTHORIZING || x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY;
}
/** Return non-zero if the passed state is one of the connected states */
static SDL_INLINE int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
- return
- x == PA_STREAM_CREATING ||
- x == PA_STREAM_READY;
+ return x == PA_STREAM_CREATING || x == PA_STREAM_READY;
}
#endif /* pulseaudio <= 0.9.10 */
@@ -312,7 +306,7 @@ ConnectToPulseServer_Internal(pa_mainloop **_mainloop, pa_context **_context)
SDL_assert(mainloop_api); /* this never fails, right? */
context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
- if (!context) {
+ if (context == NULL) {
PULSEAUDIO_pa_mainloop_free(mainloop);
return SDL_SetError("pa_context_new() failed");
}
@@ -545,7 +539,7 @@ FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *h
SinkDeviceNameCallback, &h->device_name));
}
- return (h->device_name != NULL);
+ return h->device_name != NULL;
}
static int
diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c
index 88f4a32..41a785b 100644
--- a/src/audio/vita/SDL_vitaaudio.c
+++ b/src/audio/vita/SDL_vitaaudio.c
@@ -81,7 +81,7 @@ VITAAUD_OpenDevice(_THIS, const char *devname)
}
}
- if(!test_format) {
+ if (!test_format) {
return SDL_SetError("Unsupported audio format");
}
@@ -111,7 +111,7 @@ VITAAUD_OpenDevice(_THIS, const char *devname)
format = SCE_AUDIO_OUT_MODE_STEREO;
}
- if(this->spec.freq < 48000) {
+ if (this->spec.freq < 48000) {
port = SCE_AUDIO_OUT_PORT_TYPE_BGM;
}
diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp
index 235ae7d..40dd002 100644
--- a/src/audio/wasapi/SDL_wasapi_winrt.cpp
+++ b/src/audio/wasapi/SDL_wasapi_winrt.cpp
@@ -389,8 +389,7 @@ WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid)
if (SDL_wcscmp(i->str, devid) == 0) {
if (prev) {
prev->next = next;
- }
- else {
+ } else {
deviceid_list = next;
}
SDL_RemoveAudioDevice(iscapture, i->str);
@@ -421,7 +420,7 @@ WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENS
}
devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist));
- if (!devidlist) {
+ if (devidlist == NULL) {
return; /* oh well. */
}
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index ebdd104..ea1eb51 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -734,7 +734,7 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls,
library_file = (*env)->GetStringUTFChars(env, library, NULL);
library_handle = dlopen(library_file, RTLD_GLOBAL);
- if (!library_handle) {
+ if (library_handle == NULL) {
/* When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem.
In this case we should use lib name without path. https://bugzilla.libsdl.org/show_bug.cgi?id=4739 */
const char *library_name = SDL_strrchr(library_file, '/');
@@ -777,7 +777,7 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls,
}
(*env)->DeleteLocalRef(env, string);
}
- if (!arg) {
+ if (arg == NULL) {
arg = SDL_strdup("");
}
argv[argc++] = arg;
@@ -874,8 +874,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
{
SDL_LockMutex(Android_ActivityMutex);
- if (Android_Window)
- {
+ if (Android_Window) {
Android_SendResize(Android_Window);
}
@@ -890,8 +889,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
displayOrientation = (SDL_DisplayOrientation)orientation;
- if (Android_Window)
- {
+ if (Android_Window) {
SDL_VideoDisplay *display = SDL_GetDisplay(0);
SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation);
}
@@ -1000,8 +998,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, j
{
SDL_LockMutex(Android_ActivityMutex);
- if (Android_Window)
- {
+ if (Android_Window) {
SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
data->native_window = Android_JNI_GetNativeWindow();
@@ -1019,8 +1016,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
SDL_LockMutex(Android_ActivityMutex);
#if SDL_VIDEO_OPENGL_EGL
- if (Android_Window)
- {
+ if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
@@ -1045,8 +1041,7 @@ retry:
SDL_LockMutex(Android_ActivityMutex);
- if (Android_Window)
- {
+ if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
@@ -1880,7 +1875,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer,
if (result > 0) {
/* Number of chuncks */
- return (result / size);
+ return result / size;
} else {
/* Error or EOF */
return result;
@@ -2265,7 +2260,7 @@ void *SDL_AndroidGetActivity(void)
/* See SDL_system.h for caveats on using this function. */
JNIEnv *env = Android_JNI_GetEnv();
- if (!env) {
+ if (env == NULL) {
return NULL;
}
@@ -2319,7 +2314,7 @@ const char * SDL_AndroidGetInternalStoragePath(void)
{
static char *s_AndroidInternalFilesPath = NULL;
- if (!s_AndroidInternalFilesPath) {
+ if (s_AndroidInternalFilesPath == NULL) {
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
jmethodID mid;
jobject context;
@@ -2412,7 +2407,7 @@ const char * SDL_AndroidGetExternalStoragePath(void)
{
static char *s_AndroidExternalFilesPath = NULL;
- if (!s_AndroidExternalFilesPath) {
+ if (s_AndroidExternalFilesPath == NULL) {
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
jmethodID mid;
jobject context;
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index c242053..b44656f 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -68,7 +68,7 @@ struct SDL_EVDEV_keyboard_state
static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd)
{
- return (ioctl(kbd->keyboard_fd, GIO_KEYMAP, kbd->key_map) >= 0);
+ return ioctl(kbd->keyboard_fd, GIO_KEYMAP, kbd->key_map) >= 0;
}
static SDL_EVDEV_keyboard_state * kbd_cleanup_state = NULL;
@@ -96,7 +96,9 @@ static void kbd_cleanup(void)
SDL_zero(mData);
mData.operation = MOUSE_SHOW;
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
- if (kbd->keyboard_fd != kbd->console_fd) close(kbd->keyboard_fd);
+ if (kbd->keyboard_fd != kbd->console_fd) {
+ close(kbd->keyboard_fd);
+ }
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
ioctl(kbd->console_fd, CONS_MOUSECTL, &mData);
}
@@ -152,13 +154,14 @@ static void kbd_unregister_emerg_cleanup()
old_action_p = &(old_sigaction[signum]);
/* Examine current signal action */
- if (sigaction(signum, NULL, &cur_action))
+ if (sigaction(signum, NULL, &cur_action)) {
continue;
+ }
/* Check if action installed and not modifed */
- if (!(cur_action.sa_flags & SA_SIGINFO)
- || cur_action.sa_sigaction != &kbd_cleanup_signal_action)
+ if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) {
continue;
+ }
/* Restore original action */
sigaction(signum, old_action_p, NULL);
@@ -202,16 +205,16 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd)
struct sigaction new_action;
signum = fatal_signals[tabidx];
old_action_p = &(old_sigaction[signum]);
- if (sigaction(signum, NULL, old_action_p))
+ if (sigaction(signum, NULL, old_action_p)) {
continue;
+ }
/* Skip SIGHUP and SIGPIPE if handler is already installed
* - assume the handler will do the cleanup
*/
- if ((signum == SIGHUP || signum == SIGPIPE)
- && (old_action_p->sa_handler != SIG_DFL
- || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL))
+ if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void(*)(int))old_action_p->sa_sigaction != SIG_DFL)) {
continue;
+ }
new_action = *old_action_p;
new_action.sa_flags |= SA_SIGINFO;
@@ -231,7 +234,7 @@ SDL_EVDEV_kbd_init(void)
SDL_zero(mData);
mData.operation = MOUSE_HIDE;
kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(SDL_EVDEV_keyboard_state));
- if (!kbd) {
+ if (kbd == NULL) {
return NULL;
}
@@ -253,8 +256,7 @@ SDL_EVDEV_kbd_init(void)
kbd->ledflagstate = flag_state;
}
- if (ioctl(kbd->console_fd, GIO_DEADKEYMAP, kbd->accents) < 0)
- {
+ if (ioctl(kbd->console_fd, GIO_DEADKEYMAP, kbd->accents) < 0) {
SDL_free(kbd->accents);
kbd->accents = &accentmap_default_us_acc;
}
@@ -262,8 +264,7 @@ SDL_EVDEV_kbd_init(void)
if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) {
/* Set the keyboard in XLATE mode and load the keymaps */
ioctl(kbd->console_fd, KDSKBMODE, (unsigned long)(K_XLATE));
- if(!SDL_EVDEV_kbd_load_keymaps(kbd))
- {
+ if (!SDL_EVDEV_kbd_load_keymaps(kbd)) {
SDL_free(kbd->key_map);
kbd->key_map = &keymap_default_us_acc;
}
@@ -275,8 +276,7 @@ SDL_EVDEV_kbd_init(void)
ioctl(kbd->console_fd, CONS_RELKBD, 1ul);
SDL_asprintf(&devicePath, "/dev/kbd%d", kbd->kbInfo->kb_index);
kbd->keyboard_fd = open(devicePath, O_WRONLY | O_CLOEXEC);
- if (kbd->keyboard_fd == -1)
- {
+ if (kbd->keyboard_fd == -1) {
// Give keyboard back.
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
kbd->keyboard_fd = kbd->console_fd;
@@ -289,8 +289,7 @@ SDL_EVDEV_kbd_init(void)
kbd_register_emerg_cleanup(kbd);
}
SDL_free(devicePath);
- }
- else kbd->keyboard_fd = kbd->console_fd;
+ } else kbd->keyboard_fd = kbd->console_fd;
}
return kbd;
@@ -301,7 +300,7 @@ SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
{
struct mouse_info mData;
- if (!kbd) {
+ if (kbd == NULL) {
return;
}
SDL_zero(mData);
@@ -315,8 +314,7 @@ SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
close(kbd->keyboard_fd);
- if (kbd->console_fd != kbd->keyboard_fd && kbd->console_fd >= 0)
- {
+ if (kbd->console_fd != kbd->keyboard_fd && kbd->console_fd >= 0) {
// Give back keyboard.
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
}
@@ -347,10 +345,12 @@ static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c)
put_queue(kbd, 0xc0 | (c >> 6));
put_queue(kbd, 0x80 | (c & 0x3f));
} else if (c < 0x10000) {
- if (c >= 0xD800 && c < 0xE000)
+ if (c >= 0xD800 && c < 0xE000) {
return;
- if (c == 0xFFFF)
+ }
+ if (c == 0xFFFF) {
return;
+ }
/* 1110**** 10****** 10****** */
put_queue(kbd, 0xe0 | (c >> 12));
put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
@@ -379,13 +379,14 @@ static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
kbd->diacr = 0;
for (i = 0; i < kbd->accents->n_accs; i++) {
- if (kbd->accents->acc[i].accchar == d)
- {
+ if (kbd->accents->acc[i].accchar == d) {
for (j = 0; j < NUM_ACCENTCHARS; ++j) {
- if (kbd->accents->acc[i].map[j][0] == 0) /* end of table */
+ if (kbd->accents->acc[i].map[j][0] == 0) { /* end of table */
break;
- if (kbd->accents->acc[i].map[j][0] == ch)
+ }
+ if (kbd->accents->acc[i].map[j][0] == ch) {
return kbd->accents->acc[i].map[j][1];
+ }
}
}
}
@@ -416,11 +417,13 @@ static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag)
{
- if (up_flag)
- return; /* no action, if this is a key release */
+ if (up_flag) {
+ return; /* no action, if this is a key release */
+ }
- if (kbd->diacr)
+ if (kbd->diacr) {
value = handle_diacr(kbd, value);
+ }
if (kbd->dead_key_next) {
kbd->dead_key_next = SDL_FALSE;
@@ -450,8 +453,9 @@ static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_
* handle the case that two shift or control
* keys are depressed simultaneously
*/
- if (kbd->shift_down[value])
+ if (kbd->shift_down[value]) {
kbd->shift_down[value]--;
+ }
} else
kbd->shift_down[value]++;
@@ -477,7 +481,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
key_map = *kbd->key_map;
- if (!kbd) {
+ if (kbd == NULL) {
return;
}
@@ -488,10 +492,10 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
/* These constitute unprintable language-related keys, so ignore them. */
return;
}
- if (keycode > 95)
+ if (keycode > 95) {
keycode -= 7;
- if (vc_kbd_led(kbd, ALKED) || (kbd->shift_state & 0x8))
- {
+ }
+ if (vc_kbd_led(kbd, ALKED) || (kbd->shift_state & 0x8)) {
keycode += ALTGR_OFFSET;
}
keysym = key_map.key[keycode];
@@ -500,18 +504,21 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
}
final_key_state = kbd->shift_state & 0x7;
- if ((keysym.flgs & FLAG_LOCK_C) && vc_kbd_led(kbd, LED_CAP))
+ if ((keysym.flgs & FLAG_LOCK_C) && vc_kbd_led(kbd, LED_CAP)) {
final_key_state ^= 0x1;
- if ((keysym.flgs & FLAG_LOCK_N) && vc_kbd_led(kbd, LED_NUM))
+ }
+ if ((keysym.flgs & FLAG_LOCK_N) && vc_kbd_led(kbd, LED_NUM)) {
final_key_state ^= 0x1;
+ }
map_from_key_sym = keysym.map[final_key_state];
if ((keysym.spcl & (0x80 >> final_key_state)) || (map_from_key_sym & SPCLKEY)) {
/* Special function.*/
if (map_from_key_sym == 0)
return; /* Nothing to do. */
- if (map_from_key_sym & SPCLKEY)
+ if (map_from_key_sym & SPCLKEY) {
map_from_key_sym &= ~SPCLKEY;
+ }
if (map_from_key_sym >= F_ACC && map_from_key_sym <= L_ACC) {
/* Accent function.*/
unsigned int accent_index = map_from_key_sym - F_ACC;
@@ -525,36 +532,50 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
break;
case LSHA: /* left shift + alt lock */
case RSHA: /* right shift + alt lock */
- if (down == 0) chg_vc_kbd_led(kbd, ALKED);
+ if (down == 0) {
+ chg_vc_kbd_led(kbd, ALKED);
+ }
case LSH: /* left shift */
case RSH: /* right shift */
k_shift(kbd, 0, down == 0);
break;
case LCTRA: /* left ctrl + alt lock */
case RCTRA: /* right ctrl + alt lock */
- if (down == 0) chg_vc_kbd_led(kbd, ALKED);
+ if (down == 0) {
+ chg_vc_kbd_led(kbd, ALKED);
+ }
case LCTR: /* left ctrl */
case RCTR: /* right ctrl */
k_shift(kbd, 1, down == 0);
break;
case LALTA: /* left alt + alt lock */
case RALTA: /* right alt + alt lock */
- if (down == 0) chg_vc_kbd_led(kbd, ALKED);
+ if (down == 0) {
+ chg_vc_kbd_led(kbd, ALKED);
+ }
case LALT: /* left alt */
case RALT: /* right alt */
k_shift(kbd, 2, down == 0);
break;
case ALK: /* alt lock */
- if (down == 1) chg_vc_kbd_led(kbd, ALKED);
+ if (down == 1) {
+ chg_vc_kbd_led(kbd, ALKED);
+ }
break;
case CLK: /* caps lock*/
- if (down == 1) chg_vc_kbd_led(kbd, CLKED);
+ if (down == 1) {
+ chg_vc_kbd_led(kbd, CLKED);
+ }
break;
case NLK: /* num lock */
- if (down == 1) chg_vc_kbd_led(kbd, NLKED);
+ if (down == 1) {
+ chg_vc_kbd_led(kbd, NLKED);
+ }
break;
case SLK: /* scroll lock */
- if (down == 1) chg_vc_kbd_led(kbd, SLKED);
+ if (down == 1) {
+ chg_vc_kbd_led(kbd, SLKED);
+ }
break;
default:
return;
diff --git a/src/core/gdk/SDL_gdk.cpp b/src/core/gdk/SDL_gdk.cpp
index a9ccc1c..11033ff 100644
--- a/src/core/gdk/SDL_gdk.cpp
+++ b/src/core/gdk/SDL_gdk.cpp
@@ -109,13 +109,13 @@ SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved)
/* Parse it into argv and argc */
argv = (char **) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv));
- if (!argv) {
+ if (argv == NULL) {
return OutOfMemory();
}
for (i = 0; i < argc; ++i) {
DWORD len;
char *arg = WIN_StringToUTF8W(argvw[i]);
- if (!arg) {
+ if (arg == NULL) {
return OutOfMemory();
}
len = (DWORD) SDL_strlen(arg);
diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c
index 9153e50..a35dc4a 100644
--- a/src/core/linux/SDL_dbus.c
+++ b/src/core/linux/SDL_dbus.c
@@ -201,7 +201,7 @@ SDL_DBus_Quit(void)
SDL_DBusContext *
SDL_DBus_GetContext(void)
{
- if (!dbus_handle || !dbus.session_conn) {
+ if (dbus_handle == NULL || !dbus.session_conn) {
SDL_DBus_Init();
}
@@ -379,20 +379,25 @@ SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const char *key, cons
{
DBusMessageIter iterDict, iterEntry, iterValue;
- if (!dbus.message_iter_open_container(iterInit, DBUS_TYPE_ARRAY, "{sv}", &iterDict))
+ if (!dbus.message_iter_open_container(iterInit, DBUS_TYPE_ARRAY, "{sv}", &iterDict)) {
goto failed;
+ }
- if (!dbus.message_iter_open_container(&iterDict, DBUS_TYPE_DICT_ENTRY, NULL, &iterEntry))
+ if (!dbus.message_iter_open_container(&iterDict, DBUS_TYPE_DICT_ENTRY, NULL, &iterEntry)) {
goto failed;
+ }
- if (!dbus.message_iter_append_basic(&iterEntry, DBUS_TYPE_STRING, &key))
+ if (!dbus.message_iter_append_basic(&iterEntry, DBUS_TYPE_STRING, &key)) {
goto failed;
+ }
- if (!dbus.message_iter_open_container(&iterEntry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &iterValue))
+ if (!dbus.message_iter_open_container(&iterEntry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &iterValue)) {
goto failed;
+ }
- if (!dbus.message_iter_append_basic(&iterValue, DBUS_TYPE_STRING, &value))
+ if (!dbus.message_iter_append_basic(&iterValue, DBUS_TYPE_STRING, &value)) {
goto failed;
+ }
if (!dbus.message_iter_close_container(&iterEntry, &iterValue)
|| !dbus.message_iter_close_container(&iterDict, &iterEntry)
@@ -439,12 +444,12 @@ SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
const char *key = "reason";
const char *reply = NULL;
const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME);
- if (!reason || !reason[0]) {
+ if (reason == NULL || !reason[0]) {
reason = default_inhibit_reason;
}
msg = dbus.message_new_method_call(bus_name, path, interface, "Inhibit");
- if (!msg) {
+ if (msg == NULL) {
return SDL_FALSE;
}
@@ -481,10 +486,10 @@ SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
if (inhibit) {
const char *app = SDL_GetHint(SDL_HINT_APP_NAME);
const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME);
- if (!app || !app[0]) {
+ if (app == NULL || !app[0]) {
app = "My SDL application";
}
- if (!reason || !reason[0]) {
+ if (reason == NULL || !reason[0]) {
reason = default_inhibit_reason;
}
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index f5ab062..d24b16e 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -188,14 +188,14 @@ SDL_EVDEV_Init(void)
ROM. */
char* rest = (char*) devices;
char* spec;
- while ((spec = strtok_r(rest, ",", &rest))) {
+ while ((spec = SDL_strtokr(rest, ",", &rest))) {
char* endofcls = 0;
- long cls = strtol(spec, &endofcls, 0);
- if (endofcls)
+ long cls = SDL_strtol(spec, &endofcls, 0);
+ if (endofcls) {
SDL_EVDEV_device_added(endofcls + 1, cls);
+ }
}
- }
- else {
+ } else {
/* TODO: Scan the devices manually, like a caveman */
}
}
@@ -229,7 +229,7 @@ SDL_EVDEV_Quit(void)
SDL_EVDEV_kbd_quit(_this->kbd);
/* Remove existing devices */
- while(_this->first != NULL) {
+ while (_this->first != NULL) {
SDL_EVDEV_device_removed(_this->first->path);
}
@@ -252,11 +252,13 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl
switch(udev_event) {
case SDL_UDEV_DEVICEADDED:
- if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)))
+ if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD))) {
return;
+ }
- if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK))
+ if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
return;
+ }
SDL_EVDEV_device_added(dev_path, udev_class);
break;
@@ -341,13 +343,15 @@ SDL_EVDEV_Poll(void)
case EV_ABS:
switch(events[i].code) {
case ABS_MT_SLOT:
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
item->touchscreen_data->current_slot = events[i].value;
break;
case ABS_MT_TRACKING_ID:
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
if (events[i].value >= 0) {
item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value;
item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN;
@@ -356,24 +360,27 @@ SDL_EVDEV_Poll(void)
}
break;
case ABS_MT_POSITION_X:
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value;
if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
}
break;
case ABS_MT_POSITION_Y:
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value;
if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
}
break;
case ABS_MT_PRESSURE:
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value;
if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
@@ -381,8 +388,9 @@ SDL_EVDEV_Poll(void)
break;
case ABS_X:
if (item->is_touchscreen) {
- if (item->touchscreen_data->max_slots != 1)
+ if (item->touchscreen_data->max_slots != 1) {
break;
+ }
item->touchscreen_data->slots[0].x = events[i].value;
} else if (!item->relative_mouse) {
/* FIXME: Normalize to input device's reported input range (EVIOCGABS) */
@@ -391,8 +399,9 @@ SDL_EVDEV_Poll(void)
break;
case ABS_Y:
if (item->is_touchscreen) {
- if (item->touchscreen_data->max_slots != 1)
+ if (item->touchscreen_data->max_slots != 1) {
break;
+ }
item->touchscreen_data->slots[0].y = events[i].value;
} else if (!item->relative_mouse) {
/* FIXME: Normalize to input device's reported input range (EVIOCGABS) */
@@ -406,24 +415,28 @@ SDL_EVDEV_Poll(void)
case EV_REL:
switch(events[i].code) {
case REL_X:
- if (item->relative_mouse)
+ if (item->relative_mouse) {
item->mouse_x += events[i].value;
+ }
break;
case REL_Y:
- if (item->relative_mouse)
+ if (item->relative_mouse) {
item->mouse_y += events[i].value;
+ }
break;
case REL_WHEEL:
- if (!item->high_res_wheel)
+ if (!item->high_res_wheel) {
item->mouse_wheel += events[i].value;
+ }
break;
case REL_WHEEL_HI_RES:
SDL_assert(item->high_res_wheel);
item->mouse_wheel += events[i].value;
break;
case REL_HWHEEL:
- if (!item->high_res_hwheel)
+ if (!item->high_res_hwheel) {
item->mouse_hwheel += events[i].value;
+ }
break;
case REL_HWHEEL_HI_RES:
SDL_assert(item->high_res_hwheel);
@@ -449,10 +462,11 @@ SDL_EVDEV_Poll(void)
item->mouse_wheel = item->mouse_hwheel = 0;
}
- if (!item->is_touchscreen) /* FIXME: temp hack */
+ if (!item->is_touchscreen) { /* FIXME: temp hack */
break;
+ }
- for(j = 0; j < item->touchscreen_data->max_slots; j++) {
+ for (j = 0; j < item->touchscreen_data->max_slots; j++) {
norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) /
(float)item->touchscreen_data->range_x;
norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) /
@@ -488,12 +502,14 @@ SDL_EVDEV_Poll(void)
}
}
- if (item->out_of_sync)
+ if (item->out_of_sync) {
item->out_of_sync = SDL_FALSE;
+ }
break;
case SYN_DROPPED:
- if (item->is_touchscreen)
+ if (item->is_touchscreen) {
item->out_of_sync = SDL_TRUE;
+ }
SDL_EVDEV_sync_device(item);
break;
default:
@@ -536,12 +552,14 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item, int udev_class)
char name[64];
struct input_absinfo abs_info;
- if (!item->is_touchscreen)
+ if (!item->is_touchscreen) {
return 0;
+ }
item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data));
- if (item->touchscreen_data == NULL)
+ if (item->touchscreen_data == NULL) {
return SDL_OutOfMemory();
+ }
ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
if (ret < 0) {
@@ -611,7 +629,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item, int udev_class)
return SDL_OutOfMemory();
}
- for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ for (i = 0; i < item->touchscreen_data->max_slots; i++) {
item->touchscreen_data->slots[i].tracking_id = -1;
}
@@ -630,8 +648,9 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item, int udev_class)
static void
SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) {
- if (!item->is_touchscreen)
+ if (!item->is_touchscreen) {
return;
+ }
SDL_DelTouch(item->fd);
SDL_free(item->touchscreen_data->slots);
@@ -658,8 +677,9 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
size_t mt_req_size;
/* TODO: sync devices other than touchscreen */
- if (!item->is_touchscreen)
+ if (!item->is_touchscreen) {
return;
+ }
mt_req_size = sizeof(*mt_req_code) +
sizeof(*mt_req_values) * item->touchscreen_data->max_slots;
@@ -677,7 +697,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
SDL_free(mt_req_code);
return;
}
- for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ for (i = 0; i < item->touchscreen_data->max_slots; i++) {
/*
* This doesn't account for the very edge case of the user removing their
* finger and replacing it on the screen during the time we're out of sync,
@@ -704,7 +724,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
SDL_free(mt_req_code);
return;
}
- for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ for (i = 0; i < item->touchscreen_data->max_slots; i++) {
if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
item->touchscreen_data->slots[i].x != mt_req_values[i]) {
item->touchscreen_data->slots[i].x = mt_req_values[i];
@@ -722,7 +742,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
SDL_free(mt_req_code);
return;
}
- for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ for (i = 0; i < item->touchscreen_data->max_slots; i++) {
if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
item->touchscreen_data->slots[i].y != mt_req_values[i]) {
item->touchscreen_data->slots[i].y = mt_req_values[i];
@@ -740,7 +760,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
SDL_free(mt_req_code);
return;
}
- for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ for (i = 0; i < item->touchscreen_data->max_slots; i++) {
if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
item->touchscreen_data->slots[i].pressure != mt_req_values[i]) {
item->touchscreen_data->slots[i].pressure = mt_req_values[i];
diff --git a/src/core/linux/SDL_evdev_capabilities.c b/src/core/linux/SDL_evdev_capabilities.c
index e23d499..cf5530f 100644
--- a/src/core/linux/SDL_evdev_capabilities.c
+++ b/src/core/linux/SDL_evdev_capabilities.c
@@ -138,8 +138,9 @@ SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)],
/* the first 32 bits are ESC, numbers, and Q to D; if we have any of
* those, consider it a keyboard device; do not test KEY_RESERVED, though */
keyboard_mask = 0xFFFFFFFE;
- if ((bitmask_key[0] & keyboard_mask) != 0)
+ if ((bitmask_key[0] & keyboard_mask) != 0) {
devclass |= SDL_UDEV_DEVICE_KEYBOARD; /* ID_INPUT_KEYBOARD */
+ }
return devclass;
}
diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c
index f090bff..f7f01de 100644
--- a/src/core/linux/SDL_evdev_kbd.c
+++ b/src/core/linux/SDL_evdev_kbd.c
@@ -270,13 +270,14 @@ static void kbd_unregister_emerg_cleanup()
old_action_p = &(old_sigaction[signum]);
/* Examine current signal action */
- if (sigaction(signum, NULL, &cur_action))
+ if (sigaction(signum, NULL, &cur_action)) {
continue;
+ }
/* Check if action installed and not modifed */
- if (!(cur_action.sa_flags & SA_SIGINFO)
- || cur_action.sa_sigaction != &kbd_cleanup_signal_action)
+ if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) {
continue;
+ }
/* Restore original action */
sigaction(signum, old_action_p, NULL);
@@ -320,16 +321,16 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd)
struct sigaction new_action;
signum = fatal_signals[tabidx];
old_action_p = &(old_sigaction[signum]);
- if (sigaction(signum, NULL, old_action_p))
+ if (sigaction(signum, NULL, old_action_p)) {
continue;
+ }
/* Skip SIGHUP and SIGPIPE if handler is already installed
* - assume the handler will do the cleanup
*/
- if ((signum == SIGHUP || signum == SIGPIPE)
- && (old_action_p->sa_handler != SIG_DFL
- || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL))
+ if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void(*)(int))old_action_p->sa_sigaction != SIG_DFL)) {
continue;
+ }
new_action = *old_action_p;
new_action.sa_flags |= SA_SIGINFO;
@@ -347,7 +348,7 @@ SDL_EVDEV_kbd_init(void)
char shift_state[ sizeof (long) ] = {TIOCL_GETSHIFTSTATE, 0};
kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd));
- if (!kbd) {
+ if (kbd == NULL) {
return NULL;
}
@@ -413,7 +414,7 @@ SDL_EVDEV_kbd_init(void)
void
SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
{
- if (!kbd) {
+ if (kbd == NULL) {
return;
}
@@ -461,10 +462,12 @@ static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c)
put_queue(kbd, 0xc0 | (c >> 6));
put_queue(kbd, 0x80 | (c & 0x3f));
} else if (c < 0x10000) {
- if (c >= 0xD800 && c < 0xE000)
+ if (c >= 0xD800 && c < 0xE000) {
return;
- if (c == 0xFFFF)
+ }
+ if (c == 0xFFFF) {
return;
+ }
/* 1110**** 10****** 10****** */
put_queue(kbd, 0xe0 | (c >> 12));
put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
@@ -499,8 +502,9 @@ static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
}
}
- if (ch == ' ' || ch == d)
+ if (ch == ' ' || ch == d) {
return d;
+ }
put_utf8(kbd, d);
@@ -554,24 +558,27 @@ static void fn_enter(SDL_EVDEV_keyboard_state *kbd)
static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd)
{
- if (kbd->rep)
+ if (kbd->rep) {
return;
+ }
chg_vc_kbd_led(kbd, K_CAPSLOCK);
}
static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd)
{
- if (kbd->rep)
+ if (kbd->rep) {
return;
+ }
set_vc_kbd_led(kbd, K_CAPSLOCK);
}
static void fn_num(SDL_EVDEV_keyboard_state *kbd)
{
- if (!kbd->rep)
+ if (!kbd->rep) {
chg_vc_kbd_led(kbd, K_NUMLOCK);
+ }
}
static void fn_compose(SDL_EVDEV_keyboard_state *kbd)
@@ -589,12 +596,15 @@ static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up
static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
{
- if (up_flag)
+ if (up_flag) {
return;
- if (value >= SDL_arraysize(fn_handler))
+ }
+ if (value >= SDL_arraysize(fn_handler)) {
return;
- if (fn_handler[value])
+ }
+ if (fn_handler[value]) {
fn_handler[value](kbd);
+ }
}
static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
@@ -603,11 +613,13 @@ static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char
static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
{
- if (up_flag)
- return; /* no action, if this is a key release */
+ if (up_flag) {
+ return; /* no action, if this is a key release */
+ }
- if (kbd->diacr)
+ if (kbd->diacr) {
value = handle_diacr(kbd, value);
+ }
if (kbd->dead_key_next) {
kbd->dead_key_next = SDL_FALSE;
@@ -676,8 +688,9 @@ static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_
*/
if (value == KVAL(K_CAPSSHIFT)) {
value = KVAL(K_SHIFT);
- if (!up_flag)
+ if (!up_flag) {
clr_vc_kbd_led(kbd, K_CAPSLOCK);
+ }
}
if (up_flag) {
@@ -685,8 +698,9 @@ static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_
* handle the case that two shift or control
* keys are depressed simultaneously
*/
- if (kbd->shift_down[value])
+ if (kbd->shift_down[value]) {
kbd->shift_down[value]--;
+ }
} else
kbd->shift_down[value]++;
@@ -762,7 +776,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
unsigned short *key_map;
unsigned short keysym;
- if (!kbd) {
+ if (kbd == NULL) {
return;
}
@@ -770,7 +784,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate;
key_map = kbd->key_maps[shift_final];
- if (!key_map) {
+ if (key_map == NULL) {
/* Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state */
kbd->shift_state = 0;
kbd->slockstate = 0;
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index f653279..5e5e8f0 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -347,14 +347,30 @@ Fcitx_ModState(void)
Uint32 fcitx_mods = 0;
SDL_Keymod sdl_mods = SDL_GetModState();
- if (sdl_mods & KMOD_SHIFT) fcitx_mods |= (1 << 0);
- if (sdl_mods & KMOD_CAPS) fcitx_mods |= (1 << 1);
- if (sdl_mods & KMOD_CTRL) fcitx_mods |= (1 << 2);
- if (sdl_mods & KMOD_ALT) fcitx_mods |= (1 << 3);
- if (sdl_mods & KMOD_NUM) fcitx_mods |= (1 << 4);
- if (sdl_mods & KMOD_MODE) fcitx_mods |= (1 << 7);
- if (sdl_mods & KMOD_LGUI) fcitx_mods |= (1 << 6);
- if (sdl_mods & KMOD_RGUI) fcitx_mods |= (1 << 28);
+ if (sdl_mods & KMOD_SHIFT) {
+ fcitx_mods |= (1 << 0);
+ }
+ if (sdl_mods & KMOD_CAPS) {
+ fcitx_mods |= (1 << 1);
+ }
+ if (sdl_mods & KMOD_CTRL) {
+ fcitx_mods |= (1 << 2);
+ }
+ if (sdl_mods & KMOD_ALT) {
+ fcitx_mods |= (1 << 3);
+ }
+ if (sdl_mods & KMOD_NUM) {
+ fcitx_mods |= (1 << 4);
+ }
+ if (sdl_mods & KMOD_MODE) {
+ fcitx_mods |= (1 << 7);
+ }
+ if (sdl_mods & KMOD_LGUI) {
+ fcitx_mods |= (1 << 6);
+ }
+ if (sdl_mods & KMOD_RGUI) {
+ fcitx_mods |= (1 << 28);
+ }
return fcitx_mods;
}
@@ -436,7 +452,7 @@ SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
}
focused_win = SDL_GetKeyboardFocus();
- if (!focused_win) {
+ if (focused_win == NULL) {
return ;
}
diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index 94f7aa6..d56c5d5 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -65,14 +65,30 @@ IBus_ModState(void)
SDL_Keymod sdl_mods = SDL_GetModState();
/* Not sure about MOD3, MOD4 and HYPER mappings */
- if (sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK;
- if (sdl_mods & KMOD_CAPS) ibus_mods |= IBUS_LOCK_MASK;
- if (sdl_mods & KMOD_LCTRL) ibus_mods |= IBUS_CONTROL_MASK;
- if (sdl_mods & KMOD_LALT) ibus_mods |= IBUS_MOD1_MASK;
- if (sdl_mods & KMOD_NUM) ibus_mods |= IBUS_MOD2_MASK;
- if (sdl_mods & KMOD_MODE) ibus_mods |= IBUS_MOD5_MASK;
- if (sdl_mods & KMOD_LGUI) ibus_mods |= IBUS_SUPER_MASK;
- if (sdl_mods & KMOD_RGUI) ibus_mods |= IBUS_META_MASK;
+ if (sdl_mods & KMOD_LSHIFT) {
+ ibus_mods |= IBUS_SHIFT_MASK;
+ }
+ if (sdl_mods & KMOD_CAPS) {
+ ibus_mods |= IBUS_LOCK_MASK;
+ }
+ if (sdl_mods & KMOD_LCTRL) {
+ ibus_mods |= IBUS_CONTROL_MASK;
+ }
+ if (sdl_mods & KMOD_LALT) {
+ ibus_mods |= IBUS_MOD1_MASK;
+ }
+ if (sdl_mods & KMOD_NUM) {
+ ibus_mods |= IBUS_MOD2_MASK;
+ }
+ if (sdl_mods & KMOD_MODE) {
+ ibus_mods |= IBUS_MOD5_MASK;
+ }
+ if (sdl_mods & KMOD_LGUI) {
+ ibus_mods |= IBUS_SUPER_MASK;
+ }
+ if (sdl_mods & KMOD_RGUI) {
+ ibus_mods |= IBUS_META_MASK;
+ }
return ibus_mods;
}
@@ -99,7 +115,7 @@ IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *
}
dbus->message_iter_get_basic(inside, &struct_id);
- if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) {
+ if (struct_id == NULL || SDL_strncmp(struct_id, struct_id, id_size) != 0) {
return SDL_FALSE;
}
return SDL_TRUE;
@@ -249,13 +265,12 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data)
dbus->message_iter_init(msg, &iter);
has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos);
- if (!has_dec_pos)
- {
+ if (!has_dec_pos) {
dbus->message_iter_init(msg, &iter);
has_pos = IBus_GetVariantCursorPos(conn, &iter, dbus, &pos);
}
- if(has_dec_pos) {
+ if (has_dec_pos) {
SDL_SendEditingText(text, start_pos, end_pos - start_pos);
} else if (has_pos) {
SDL_SendEditingText(text, pos, -1);
@@ -299,15 +314,19 @@ IBus_ReadAddressFromFile(const char *file_path)
FILE *addr_file;
addr_file = fopen(file_path, "r");
- if (!addr_file) {
+ if (addr_file == NULL) {
return NULL;
}
while (fgets(addr_buf, sizeof(addr_buf), addr_file)) {
if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) {
size_t sz = SDL_strlen(addr_buf);
- if (addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0;
- if (addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0;
+ if (addr_buf[sz - 1] == '\n') {
+ addr_buf[sz - 1] = 0;
+ }
+ if (addr_buf[sz - 2] == '\r') {
+ addr_buf[sz - 2] = 0;
+ }
success = SDL_TRUE;
break;
}
@@ -341,7 +360,7 @@ IBus_GetDBusAddressFilename(void)
}
dbus = SDL_DBus_GetContext();
- if (!dbus) {
+ if (dbus == NULL) {
return NULL;
}
@@ -355,7 +374,7 @@ IBus_GetDBusAddressFilename(void)
and look up the address from a filepath using all those bits, eek. */
disp_env = SDL_getenv("DISPLAY");
- if (!disp_env || !*disp_env) {
+ if (disp_env == NULL || !*disp_env) {
display = SDL_strdup(":0.0");
} else {
display = SDL_strdup(disp_env);
@@ -365,7 +384,7 @@ IBus_GetDBusAddressFilename(void)
disp_num = SDL_strrchr(display, ':');
screen_num = SDL_strrchr(display, '.');
- if (!disp_num) {
+ if (disp_num == NULL) {
SDL_free(display);
return NULL;
}
@@ -393,7 +412,7 @@ IBus_GetDBusAddressFilename(void)
SDL_strlcpy(config_dir, conf_env, sizeof(config_dir));
} else {
const char *home_env = SDL_getenv("HOME");
- if (!home_env || !*home_env) {
+ if (home_env == NULL || !*home_env) {
SDL_free(display);
return NULL;
}
@@ -461,7 +480,7 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
ibus_input_interface = IBUS_INPUT_INTERFACE;
ibus_conn = dbus->connection_open_private(addr, NULL);
- if (!ibus_conn) {
+ if (ibus_conn == NULL) {
return SDL_FALSE; /* oh well. */
}
@@ -499,7 +518,9 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
static SDL_bool
IBus_CheckConnection(SDL_DBusContext *dbus)
{
- if (!dbus) return SDL_FALSE;
+ if (dbus == NULL) {
+ return SDL_FALSE;
+ }
if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) {
return SDL_TRUE;
@@ -517,7 +538,9 @@ IBus_CheckConnection(SDL_DBusContext *dbus)
struct inotify_event *event = (struct inotify_event*) p;
if (event->len > 0) {
char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/');
- if (!addr_file_no_path) return SDL_FALSE;
+ if (addr_file_no_path == NULL) {
+ return SDL_FALSE;
+ }
if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) {
file_updated = SDL_TRUE;
@@ -553,7 +576,7 @@ SDL_IBus_Init(void)
char *addr;
char *addr_file_dir;
- if (!addr_file) {
+ if (addr_file == NULL) {
return SDL_FALSE;
}
@@ -561,7 +584,7 @@ SDL_IBus_Init(void)
ibus_addr_file = SDL_strdup(addr_file);
addr = IBus_ReadAddressFromFile(addr_file);
- if (!addr) {
+ if (addr == NULL) {
SDL_free(addr_file);
return SDL_FALSE;
}
@@ -700,7 +723,7 @@ SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
}
focused_win = SDL_GetKeyboardFocus();
- if (!focused_win) {
+ if (focused_win == NULL) {
return;
}
diff --git a/src/core/linux/SDL_ime.c b/src/core/linux/SDL_ime.c
index 3ad4dbf..e43fe86 100644
--- a/src/core/linux/SDL_ime.c
+++ b/src/core/linux/SDL_ime.c
@@ -49,16 +49,17 @@ InitIME()
const char *xmodifiers = SDL_getenv("XMODIFIERS");
#endif
- if (inited == SDL_TRUE)
+ if (inited == SDL_TRUE) {
return;
+ }
inited = SDL_TRUE;
/* See if fcitx IME support is being requested */
#ifdef HAVE_FCITX
- if (!SDL_IME_Init_Real &&
+ if (SDL_IME_Init_Real == NULL &&
((im_module && SDL_strcmp(im_module, "fcitx") == 0) ||
- (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
+ (im_module == NULL && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
SDL_IME_Init_Real = SDL_Fcitx_Init;
SDL_IME_Quit_Real = SDL_Fcitx_Quit;
SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus;
@@ -71,7 +72,7 @@ InitIME()
/* default to IBus */
#ifdef HAVE_IBUS_IBUS_H
- if (!SDL_IME_Init_Real) {
+ if (SDL_IME_Init_Real == NULL) {
SDL_IME_Init_Real = SDL_IBus_Init;
SDL_IME_Quit_Real = SDL_IBus_Quit;
SDL_IME_SetFocus_Real = SDL_IBus_SetFocus;
@@ -109,29 +110,33 @@ SDL_IME_Init(void)
void
SDL_IME_Quit(void)
{
- if (SDL_IME_Quit_Real)
+ if (SDL_IME_Quit_Real) {
SDL_IME_Quit_Real();
+ }
}
void
SDL_IME_SetFocus(SDL_bool focused)
{
- if (SDL_IME_SetFocus_Real)
+ if (SDL_IME_SetFocus_Real) {
SDL_IME_SetFocus_Real(focused);
+ }
}
void
SDL_IME_Reset(void)
{
- if (SDL_IME_Reset_Real)
+ if (SDL_IME_Reset_Real) {
SDL_IME_Reset_Real();
+ }
}
SDL_bool
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{
- if (SDL_IME_ProcessKeyEvent_Real)
+ if (SDL_IME_ProcessKeyEvent_Real) {
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);
+ }
return SDL_FALSE;
}
@@ -139,15 +144,17 @@ SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
void
SDL_IME_UpdateTextRect(const SDL_Rect *rect)
{
- if (SDL_IME_UpdateTextRect_Real)
+ if (SDL_IME_UpdateTextRect_Real) {
SDL_IME_UpdateTextRect_Real(rect);
+ }
}
void
SDL_IME_PumpEvents()
{
- if (SDL_IME_PumpEvents_Real)
+ if (SDL_IME_PumpEvents_Real) {
SDL_IME_PumpEvents_Real();
+ }
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c
index 865b89c..1648317 100644
--- a/src/core/linux/SDL_threadprio.c
+++ b/src/core/linux/SDL_threadprio.c
@@ -120,20 +120,20 @@ rtkit_initialize()
dbus_conn = get_rtkit_dbus_connection();
/* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */
- if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel",
- DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
+ if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel",
+ DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
rtkit_min_nice_level = -20;
}
/* Try getting maximum realtime priority: this can be less than the POSIX default (99). */
- if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority",
- DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) {
+ if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority",
+ DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) {
rtkit_max_realtime_priority = 99;
}
/* Try getting maximum rttime allowed by rtkit: exceeding this value will result in SIGKILL */
- if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax",
- DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) {
+ if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax",
+ DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) {
rtkit_max_rttime_usec = 200000;
}
}
@@ -172,8 +172,7 @@ rtkit_initialize_realtime_thread()
// Requirement #1: Set RLIMIT_RTTIME
err = getrlimit(nLimit, &rlimit);
- if (err)
- {
+ if (err) {
return SDL_FALSE;
}
@@ -181,21 +180,18 @@ rtkit_initialize_realtime_thread()
rlimit.rlim_max = rtkit_max_rttime_usec;
rlimit.rlim_cur = rlimit.rlim_max / 2;
err = setrlimit(nLimit, &rlimit);
- if (err)
- {
+ if (err) {
return SDL_FALSE;
}
// Requirement #2: Add SCHED_RESET_ON_FORK to the scheduler policy
err = sched_getparam(nPid, &schedParam);
- if (err)
- {
+ if (err) {
return SDL_FALSE;
}
err = sched_setscheduler(nPid, nSchedPolicy, &schedParam);
- if (err)
- {
+ if (err) {
return SDL_FALSE;
}
@@ -213,13 +209,14 @@ rtkit_setpriority_nice(pid_t thread, int nice_level)
pthread_once(&rtkit_initialize_once, rtkit_initialize);
dbus_conn = get_rtkit_dbus_connection();
- if (nice < rtkit_min_nice_level)
+ if (nice < rtkit_min_nice_level) {
nice = rtkit_min_nice_level;
+ }
- if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn,
- rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID",
- DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID,
- DBUS_TYPE_INVALID)) {
+ if (dbus_conn == NULL || !SDL_DBus_CallMethodOnConnection(dbus_conn,
+ rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID",
+ DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID,
+ DBUS_TYPE_INVALID)) {
return SDL_FALSE;
}
return SDL_TRUE;
@@ -236,8 +233,9 @@ rtkit_setpriority_realtime(pid_t thread, int rt_priority)
pthread_once(&rtkit_initialize_once, rtkit_initialize);
dbus_conn = get_rtkit_dbus_connection();
- if (priority > rtkit_max_realtime_priority)
+ if (priority > rtkit_max_realtime_priority) {
priority = rtkit_max_realtime_priority;
+ }
// We always perform the thread state changes necessary for rtkit.
// This wastes some system calls if the state is already set but
@@ -247,10 +245,10 @@ rtkit_setpriority_realtime(pid_t thread, int rt_priority)
// go through to determine whether it really needs to fail or not.
rtkit_initialize_realtime_thread();
- if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn,
- rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID",
- DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID,
- DBUS_TYPE_INVALID)) {
+ if (dbus_conn == NULL || !SDL_DBus_CallMethodOnConnection(dbus_conn,
+ rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID",
+ DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID,
+ DBUS_TYPE_INVALID)) {
return SDL_FALSE;
}
return SDL_TRUE;
diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c
index 85cde89..ce6c059 100644
--- a/src/core/linux/SDL_udev.c
+++ b/src/core/linux/SDL_udev.c
@@ -119,7 +119,7 @@ SDL_UDEV_Init(void)
if (_this == NULL) {
_this = (SDL_UDEV_PrivateData *) SDL_calloc(1, sizeof(*_this));
- if(_this == NULL) {
+ if (_this == NULL) {
return SDL_OutOfMemory();
}
@@ -327,14 +327,13 @@ SDL_UDEV_LoadLibrary(void)
#endif
if (_this->udev_handle == NULL) {
- for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
+ for ( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
_this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]);
if (_this->udev_handle != NULL) {
retval = SDL_UDEV_load_syms();
if (retval < 0) {
SDL_UDEV_UnloadLibrary();
- }
- else {
+ } else {
break;
}
}
@@ -359,7 +358,7 @@ static void get_caps(struct udev_device *dev, struct udev_device *pdev, const ch
SDL_memset(bitmask, 0, bitmask_len*sizeof(*bitmask));
value = _this->syms.udev_device_get_sysattr_value(pdev, attr);
- if (!value) {
+ if (value == NULL) {
return;
}
@@ -394,7 +393,7 @@ guess_device_class(struct udev_device *dev)
while (pdev && !_this->syms.udev_device_get_sysattr_value(pdev, "capabilities/ev")) {
pdev = _this->syms.udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL);
}
- if (!pdev) {
+ if (pdev == NULL) {
return 0;
}
diff --git a/src/core/openbsd/SDL_wscons_kbd.c b/src/core/openbsd/SDL_wscons_kbd.c
index 121867d..f17b400 100644
--- a/src/core/openbsd/SDL_wscons_kbd.c
+++ b/src/core/openbsd/SDL_wscons_kbd.c
@@ -233,14 +233,15 @@ static struct SDL_wscons_compose_tab_s {
static keysym_t ksym_upcase(keysym_t ksym)
{
- if (ksym >= KS_f1 && ksym <= KS_f20)
- return(KS_F1 - KS_f1 + ksym);
+ if (ksym >= KS_f1 && ksym <= KS_f20) {
+ return KS_F1 - KS_f1 + ksym;
+ }
- if (KS_GROUP(ksym) == KS_GROUP_Ascii && ksym <= 0xff &&
- latin1_to_upper[ksym] != 0x00)
- return(latin1_to_upper[ksym]);
+ if (KS_GROUP(ksym) == KS_GROUP_Ascii && ksym <= 0xff && latin1_to_upper[ksym] != 0x00) {
+ return latin1_to_upper[ksym];
+ }
- return(ksym);
+ return ksym;
}
static struct wscons_keycode_to_SDL {
keysym_t sourcekey;
@@ -414,7 +415,7 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev)
#endif
SDL_WSCONS_input_data* input = (SDL_WSCONS_input_data*)SDL_calloc(1, sizeof(SDL_WSCONS_input_data));
- if (!input) {
+ if (input == NULL) {
return input;
}
input->fd = open(dev,O_RDWR | O_NONBLOCK | O_CLOEXEC);
@@ -491,10 +492,12 @@ static void put_utf8(SDL_WSCONS_input_data* input, uint c)
put_queue(input, 0xc0 | (c >> 6));
put_queue(input, 0x80 | (c & 0x3f));
} else if (c < 0x10000) {
- if (c >= 0xD800 && c <= 0xF500)
+ if (c >= 0xD800 && c <= 0xF500) {
return;
- if (c == 0xFFFF)
+ }
+ if (c == 0xFFFF) {
return;
+ }
/* 1110**** 10****** 10****** */
put_queue(input, 0xe0 | (c >> 12));
put_queue(input, 0x80 | ((c >> 6) & 0x3f));
@@ -511,7 +514,9 @@ static void put_utf8(SDL_WSCONS_input_data* input, uint c)
static void Translate_to_text(SDL_WSCONS_input_data* input, keysym_t ksym)
{
if (KS_GROUP(ksym) == KS_GROUP_Keypad) {
- if (SDL_isprint(ksym & 0xFF)) ksym &= 0xFF;
+ if (SDL_isprint(ksym & 0xFF)) {
+ ksym &= 0xFF;
+ }
}
switch(ksym) {
case KS_Escape:
@@ -569,7 +574,9 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
keysym_t *group;
keysym_t ksym, result;
- if (!input) return;
+ if (input == NULL) {
+ return;
+ }
if ((n = read(input->fd, events, sizeof(events))) > 0) {
n /= sizeof(struct wscons_event);
for (i = 0; i < n; i++) {
@@ -578,21 +585,27 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
case WSCONS_EVENT_KEY_DOWN: {
switch (input->keymap.map[events[i].value].group1[0]) {
case KS_Hold_Screen: {
- if (input->lockheldstate[0] >= 1) break;
+ if (input->lockheldstate[0] >= 1) {
+ break;
+ }
input->ledstate ^= LED_SCR;
ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate);
input->lockheldstate[0] = 1;
break;
}
case KS_Num_Lock: {
- if (input->lockheldstate[1] >= 1) break;
+ if (input->lockheldstate[1] >= 1) {
+ break;
+ }
input->ledstate ^= LED_NUM;
ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate);
input->lockheldstate[1] = 1;
break;
}
case KS_Caps_Lock: {
- if (input->lockheldstate[2] >= 1) break;
+ if (input->lockheldstate[2] >= 1) {
+ break;
+ }
input->ledstate ^= LED_CAP;
ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate);
input->lockheldstate[2] = 1;
@@ -600,7 +613,9 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
}
#ifndef __NetBSD__
case KS_Mode_Lock: {
- if (input->lockheldstate[3] >= 1) break;
+ if (input->lockheldstate[3] >= 1) {
+ break;
+ }
input->ledstate ^= 1 << 4;
ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate);
input->lockheldstate[3] = 1;
@@ -608,50 +623,66 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
}
#endif
case KS_Shift_Lock: {
- if (input->lockheldstate[4] >= 1) break;
+ if (input->lockheldstate[4] >= 1) {
+ break;
+ }
input->ledstate ^= 1 << 5;
ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate);
input->lockheldstate[4] = 1;
break;
}
case KS_Shift_L: {
- if (input->shiftheldstate[0]) break;
+ if (input->shiftheldstate[0]) {
+ break;
+ }
input->shiftstate[0]++;
input->shiftheldstate[0] = 1;
break;
}
case KS_Shift_R: {
- if (input->shiftheldstate[1]) break;
+ if (input->shiftheldstate[1]) {
+ break;
+ }
input->shiftstate[0]++;
input->shiftheldstate[1] = 1;
break;
}
case KS_Alt_L: {
- if (input->shiftheldstate[2]) break;
+ if (input->shiftheldstate[2]) {
+ break;
+ }
input->shiftstate[1]++;
input->shiftheldstate[2] = 1;
break;
}
case KS_Alt_R: {
- if (input->shiftheldstate[3]) break;
+ if (input->shiftheldstate[3]) {
+ break;
+ }
input->shiftstate[1]++;
input->shiftheldstate[3] = 1;
break;
}
case KS_Control_L: {
- if (input->shiftheldstate[4]) break;
+ if (input->shiftheldstate[4]) {
+ break;
+ }
input->shiftstate[2]++;
input->shiftheldstate[4] = 1;
break;
}
case KS_Control_R: {
- if (input->shiftheldstate[5]) break;
+ if (input->shiftheldstate[5]) {
+ break;
+ }
input->shiftstate[2]++;
input->shiftheldstate[5] = 1;
break;
}
case KS_Mode_switch: {
- if (input->shiftheldstate[6]) break;
+ if (input->shiftheldstate[6]) {
+ break;
+ }
input->shiftstate[3]++;
input->shiftheldstate[6] = 1;
break;
@@ -662,60 +693,84 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
case WSCONS_EVENT_KEY_UP: {
switch(input->keymap.map[events[i].value].group1[0]) {
case KS_Hold_Screen: {
- if (input->lockheldstate[0]) input->lockheldstate[0] = 0;
+ if (input->lockheldstate[0]) {
+ input->lockheldstate[0] = 0;
+ }
}
break;
case KS_Num_Lock: {
- if (input->lockheldstate[1]) input->lockheldstate[1] = 0;
+ if (input->lockheldstate[1]) {
+ input->lockheldstate[1] = 0;
+ }
}
break;
case KS_Caps_Lock: {
- if (input->lockheldstate[2]) input->lockheldstate[2] = 0;
+ if (input->lockheldstate[2]) {
+ input->lockheldstate[2] = 0;
+ }
}
break;
#ifndef __NetBSD__
case KS_Mode_Lock: {
- if (input->lockheldstate[3]) input->lockheldstate[3] = 0;
+ if (input->lockheldstate[3]) {
+ input->lockheldstate[3] = 0;
+ }
}
break;
#endif
case KS_Shift_Lock: {
- if (input->lockheldstate[4]) input->lockheldstate[4] = 0;
+ if (input->lockheldstate[4]) {
+ input->lockheldstate[4] = 0;
+ }
}
break;
case KS_Shift_L: {
input->shiftheldstate[0] = 0;
- if (input->shiftstate[0]) input->shiftstate[0]--;
+ if (input->shiftstate[0]) {
+ input->shiftstate[0]--;
+ }
break;
}
case KS_Shift_R: {
input->shiftheldstate[1] = 0;
- if (input->shiftstate[0]) input->shiftstate[0]--;
+ if (input->shiftstate[0]) {
+ input->shiftstate[0]--;
+ }
break;
}
case KS_Alt_L: {
input->shiftheldstate[2] = 0;
- if (input->shiftstate[1]) input->shiftstate[1]--;
+ if (input->shiftstate[1]) {
+ input->shiftstate[1]--;
+ }
break;
}
case KS_Alt_R: {
input->shiftheldstate[3] = 0;
- if (input->shiftstate[1]) input->shiftstate[1]--;
+ if (input->shiftstate[1]) {
+ input->shiftstate[1]--;
+ }
break;
}
case KS_Control_L: {
input->shiftheldstate[4] = 0;
- if (input->shiftstate[2]) input->shiftstate[2]--;
+ if (input->shiftstate[2]) {
+ input->shiftstate[2]--;
+ }
break;
}
case KS_Control_R: {
input->shiftheldstate[5] = 0;
- if (input->shiftstate[2]) input->shiftstate[2]--;
+ if (input->shiftstate[2]) {
+ input->shiftstate[2]--;
+ }
break;
}
case KS_Mode_switch: {
input->shiftheldstate[6] = 0;
- if (input->shiftstate[3]) input->shiftstate[3]--;
+ if (input->shiftstate[3]) {
+ input->shiftstate[3]--;
+ }
break;
}
}
@@ -733,7 +788,9 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
else
Translate_to_keycode(input, type, events[i].value);
- if (type == WSCONS_EVENT_KEY_UP) continue;
+ if (type == WSCONS_EVENT_KEY_UP) {
+ continue;
+ }
if (IS_ALTGR_MODE && !IS_CONTROL_HELD)
group = &input->keymap.map[events[i].value].group2[0];
@@ -778,7 +835,9 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
} else result = ksym;
break;
}
- if (result == KS_voidSymbol) continue;
+ if (result == KS_voidSymbol) {
+ continue;
+ }
if (input->composelen > 0) {
if (input->composelen == 2 && group == &input->keymap.map[events[i].value].group2[0]) {
@@ -809,21 +868,24 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
if (KS_GROUP(result) == KS_GROUP_Ascii) {
if (IS_CONTROL_HELD) {
- if ((result >= KS_at && result <= KS_z) || result == KS_space)
+ if ((result >= KS_at && result <= KS_z) || result == KS_space) {
result = result & 0x1f;
- else if (result == KS_2)
+ } else if (result == KS_2) {
result = 0x00;
- else if (result >= KS_3 && result <= KS_7)
+ } else if (result >= KS_3 && result <= KS_7) {
result = KS_Escape + (result - KS_3);
- else if (result == KS_8)
- result = KS_Delete;
+ } else if (result == KS_8) {
+ result = KS_Delete;
+ }
}
if (IS_ALT_HELD) {
if (input->encoding & KB_METAESC) {
Translate_to_keycode(input, WSCONS_EVENT_KEY_DOWN, KS_Escape);
Translate_to_text(input, result);
continue;
- } else result |= 0x80;
+ } else {
+ result |= 0x80;
+ }
}
}
Translate_to_text(input,result);
@@ -835,7 +897,10 @@ static void updateKeyboard(SDL_WSCONS_input_data* input)
void SDL_WSCONS_PumpEvents()
{
int i = 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
updateKeyboard(inputs[i]);
- if (mouseInputData != NULL) updateMouse(mouseInputData);
+ }
+ if (mouseInputData != NULL) {
+ updateMouse(mouseInputData);
+ }
}
diff --git a/src/core/openbsd/SDL_wscons_mouse.c b/src/core/openbsd/SDL_wscons_mouse.c
index 42c83ce..683acae 100644
--- a/src/core/openbsd/SDL_wscons_mouse.c
+++ b/src/core/openbsd/SDL_wscons_mouse.c
@@ -42,7 +42,9 @@ SDL_WSCONS_mouse_input_data* SDL_WSCONS_Init_Mouse()
#endif
SDL_WSCONS_mouse_input_data* mouseInputData = SDL_calloc(1, sizeof(SDL_WSCONS_mouse_input_data));
- if (!mouseInputData) return NULL;
+ if (mouseInputData == NULL) {
+ return NULL;
+ }
mouseInputData->fd = open("/dev/wsmouse",O_RDWR | O_NONBLOCK | O_CLOEXEC);
if (mouseInputData->fd == -1) {free(mouseInputData); return NULL; }
#ifdef WSMOUSEIO_SETMODE
@@ -61,11 +63,9 @@ void updateMouse(SDL_WSCONS_mouse_input_data* inputData)
int n,i;
SDL_Mouse* mouse = SDL_GetMouse();
- if ((n = read(inputData->fd, events, sizeof(events))) > 0)
- {
+ if ((n = read(inputData->fd, events, sizeof(events))) > 0) {
n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++)
- {
+ for (i = 0; i < n; i++) {
type = events[i].type;
switch(type)
{
@@ -128,7 +128,9 @@ void updateMouse(SDL_WSCONS_mouse_input_data* inputData)
void SDL_WSCONS_Quit_Mouse(SDL_WSCONS_mouse_input_data* inputData)
{
- if (!inputData) return;
+ if (inputData == NULL) {
+ return;
+ }
close(inputData->fd);
free(inputData);
}
diff --git a/src/core/windows/SDL_hid.c b/src/core/windows/SDL_hid.c
index d9dd04f..225fe70 100644
--- a/src/core/windows/SDL_hid.c
+++ b/src/core/windows/SDL_hid.c
@@ -61,9 +61,9 @@ WIN_LoadHIDDLL(void)
SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps");
SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength");
SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData");
- if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString ||
- !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps ||
- !SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) {
+ if (SDL_HidD_GetManufacturerString == NULL || SDL_HidD_GetProductString == NULL ||
+ SDL_HidP_GetCaps == NULL || SDL_HidP_GetButtonCaps == NULL ||
+ SDL_HidP_GetValueCaps == NULL || SDL_HidP_MaxDataListLength == NULL || SDL_HidP_GetData == NULL) {
WIN_UnloadHIDDLL();
return -1;
}
diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c
index 335596d..f55a31b 100644
--- a/src/core/windows/SDL_immdevice.c
+++ b/src/core/windows/SDL_immdevice.c
@@ -136,7 +136,7 @@ SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTEN
}
devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist));
- if (!devidlist) {
+ if (devidlist == NULL) {
return; /* oh well. */
}
@@ -442,7 +442,7 @@ EnumerateEndpointsForFlow(const SDL_bool iscapture)
}
items = (EndpointItem *)SDL_calloc(total, sizeof(EndpointItem));
- if (!items) {
+ if (items == NULL) {
return; /* oh well. */
}
diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index 4ec9dbb..f64d554 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -291,7 +291,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
}
strw = (WCHAR *) SDL_malloc(len + sizeof (WCHAR));
- if (!strw) {
+ if (strw == NULL) {
RegCloseKey(hkey);
return WIN_StringToUTF8(name); /* oh well. */
}
@@ -314,13 +314,13 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
BOOL
WIN_IsEqualGUID(const GUID * a, const GUID * b)
{
- return (SDL_memcmp(a, b, sizeof (*a)) == 0);
+ return SDL_memcmp(a, b, sizeof(*a)) == 0;
}
BOOL
WIN_IsEqualIID(REFIID a, REFIID b)
{
- return (SDL_memcmp(a, b, sizeof (*a)) == 0);
+ return SDL_memcmp(a, b, sizeof(*a)) == 0;
}
void
diff --git a/src/core/windows/SDL_xinput.c b/src/core/windows/SDL_xinput.c
index 8b9c26e..675ed60 100644
--- a/src/core/windows/SDL_xinput.c
+++ b/src/core/windows/SDL_xinput.c
@@ -110,13 +110,13 @@ WIN_LoadXInputDLL(void)
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
- if (!SDL_XInputGetState) {
+ if (SDL_XInputGetState == NULL) {
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
}
SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
- if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
+ if (SDL_XInputGetState == NULL || SDL_XInputSetState == NULL || SDL_XInputGetCapabilities == NULL) {
WIN_UnloadXInputDLL();
return -1;
}
diff --git a/src/core/winrt/SDL_winrtapp_common.cpp b/src/core/winrt/SDL_winrtapp_common.cpp
index 6e98a78..e5ada4c 100644
--- a/src/core/winrt/SDL_winrtapp_common.cpp
+++ b/src/core/winrt/SDL_winrtapp_common.cpp
@@ -49,16 +49,11 @@ SDL_WinRTGetDeviceFamily()
#if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */
Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
- if (deviceFamily->Equals("Windows.Desktop"))
- {
+ if (deviceFamily->Equals("Windows.Desktop")) {
return SDL_WINRT_DEVICEFAMILY_DESKTOP;
- }
- else if (deviceFamily->Equals("Windows.Mobile"))
- {
+ } else if (deviceFamily->Equals("Windows.Mobile")) {
return SDL_WINRT_DEVICEFAMILY_MOBILE;
- }
- else if (deviceFamily->Equals("Windows.Xbox"))
- {
+ } else if (deviceFamily->Equals("Windows.Xbox")) {
return SDL_WINRT_DEVICEFAMILY_XBOX;
}
#endif
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 1f0962f..db27e72 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -104,8 +104,7 @@ IFrameworkView^ SDLApplicationSource::CreateView()
// SDL_WinRTGlobalApp more than once.
SDL_assert(!SDL_WinRTGlobalApp);
SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
- if (!SDL_WinRTGlobalApp)
- {
+ if (!SDL_WinRTGlobalApp) {
SDL_WinRTGlobalApp = app;
}
return app;
@@ -353,13 +352,12 @@ void SDL_WinRTApp::Load(Platform::String^ entryPoint)
void SDL_WinRTApp::Run()
{
SDL_SetMainReady();
- if (WINRT_SDLAppEntryPoint)
- {
+ if (WINRT_SDLAppEntryPoint) {
// TODO, WinRT: pass the C-style main() a reasonably realistic
// representation of command line arguments.
int argc = 1;
char **argv = (char **)SDL_malloc(2 * sizeof(*argv));
- if (!argv) {
+ if (argv == NULL) {
return;
}
argv[0] = SDL_strdup("WinRTApp");
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index 540f6a5..a4fa5d6 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/src/cpuinfo/SDL_cpuinfo.c
@@ -336,8 +336,9 @@ CPU_haveAltiVec(void)
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
- if (0 == error)
+ if (0 == error) {
altivec = (hasVectorUnit != 0);
+ }
#elif defined(__FreeBSD__) && defined(__powerpc__)
unsigned long cpufeatures = 0;
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
@@ -378,13 +379,10 @@ CPU_haveARMSIMD(void)
int fd;
fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC);
- if (fd >= 0)
- {
+ if (fd >= 0) {
Elf32_auxv_t aux;
- while (read(fd, &aux, sizeof aux) == sizeof aux)
- {
- if (aux.a_type == AT_PLATFORM)
- {
+ while (read(fd, &aux, sizeof aux) == sizeof aux) {
+ if (aux.a_type == AT_PLATFORM) {
const char *plat = (const char *) aux.a_un.a_val;
if (plat) {
arm_simd = SDL_strncmp(plat, "v6l", 3) == 0 ||
@@ -403,16 +401,19 @@ CPU_haveARMSIMD(void)
{
_kernel_swi_regs regs;
regs.r[0] = 0;
- if (_kernel_swi(OS_PlatformFeatures, ®s, ®s) != NULL)
+ if (_kernel_swi(OS_PlatformFeatures, ®s, ®s) != NULL) {
return 0;
+ }
- if (!(regs.r[0] & (1<<31)))
+ if (!(regs.r[0] & (1 << 31))) {
return 0;
+ }
regs.r[0] = 34;
regs.r[1] = 29;
- if (_kernel_swi(OS_PlatformFeatures, ®s, ®s) != NULL)
+ if (_kernel_swi(OS_PlatformFeatures, ®s, ®s) != NULL) {
return 0;
+ }
return regs.r[0];
}
@@ -434,8 +435,7 @@ readProcAuxvForNeon(void)
int fd;
fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC);
- if (fd >= 0)
- {
+ if (fd >= 0) {
Elf32_auxv_t aux;
while (read(fd, &aux, sizeof (aux)) == sizeof (aux)) {
if (aux.a_type == AT_HWCAP) {
@@ -481,13 +481,14 @@ CPU_haveNEON(void)
return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */
#elif defined(HAVE_ELF_AUX_INFO)
unsigned long hasneon = 0;
- if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0)
+ if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0) {
return 0;
+ }
return ((hasneon & HWCAP_NEON) == HWCAP_NEON);
#elif defined(__QNXNTO__)
return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
- return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
+ return (getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON;
#elif defined(__LINUX__)
return readProcAuxvForNeon();
#elif defined(__ANDROID__)
@@ -556,7 +557,7 @@ CPU_have3DNow(void)
cpuid(0x80000000, a, b, c, d);
if (a >= 0x80000001) {
cpuid(0x80000001, a, b, c, d);
- return (d & 0x80000000);
+ return d & 0x80000000;
}
}
return 0;
@@ -629,7 +630,7 @@ CPU_haveAVX2(void)
int a, b, c, d;
(void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
cpuid(7, a, b, c, d);
- return (b & 0x00000020);
+ return b & 0x00000020;
}
return 0;
}
@@ -649,7 +650,7 @@ CPU_haveAVX512F(void)
int a, b, c, d;
(void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
cpuid(7, a, b, c, d);
- return (b & 0x00010000);
+ return b & 0x00010000;
}
return 0;
}
@@ -839,10 +840,10 @@ SDL_GetCPUCacheLineSize(void)
(void) a; (void) b; (void) c; (void) d;
if (SDL_strcmp(cpuType, "GenuineIntel") == 0 || SDL_strcmp(cpuType, "CentaurHauls") == 0 || SDL_strcmp(cpuType, " Shanghai ") == 0) {
cpuid(0x00000001, a, b, c, d);
- return (((b >> 8) & 0xff) * 8);
+ return ((b >> 8) & 0xff) * 8;
} else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) {
cpuid(0x80000005, a, b, c, d);
- return (c & 0xff);
+ return c & 0xff;
} else {
/* Just make a guess here... */
return SDL_CACHELINE_SIZE;
diff --git a/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c
index a3247dd..de5d013 100644
--- a/src/events/SDL_clipboardevents.c
+++ b/src/events/SDL_clipboardevents.c
@@ -40,7 +40,7 @@ SDL_SendClipboardUpdate(void)
posted = (SDL_PushEvent(&event) > 0);
}
- return (posted);
+ return posted;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/events/SDL_displayevents.c b/src/events/SDL_displayevents.c
index c6a701a..3eabf1a 100644
--- a/src/events/SDL_displayevents.c
+++ b/src/events/SDL_displayevents.c
@@ -31,7 +31,7 @@ SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
{
int posted;
- if (!display) {
+ if (display == NULL) {
return 0;
}
switch (displayevent) {
@@ -54,7 +54,7 @@ SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
posted = (SDL_PushEvent(&event) > 0);
}
- return (posted);
+ return posted;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index 493ae76..1894132 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -556,7 +556,7 @@ SDL_StartEventLoop(void)
}
SDL_LockMutex(SDL_EventQ.lock);
- if (!SDL_event_watchers_lock) {
+ if (SDL_event_watchers_lock == NULL) {
SDL_event_watchers_lock = SDL_CreateMutex();
if (SDL_event_watchers_lock == NULL) {
SDL_UnlockMutex(SDL_EventQ.lock);
@@ -597,7 +597,7 @@ SDL_AddEvent(SDL_Event * event)
if (SDL_EventQ.free == NULL) {
entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry));
- if (!entry) {
+ if (entry == NULL) {
return 0;
}
} else {
@@ -672,7 +672,7 @@ static int
SDL_SendWakeupEvent()
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this || !_this->SendWakeupEvent) {
+ if (_this == NULL || !_this->SendWakeupEvent) {
return 0;
}
if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
@@ -708,7 +708,7 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action
if (action == SDL_GETEVENT) {
SDL_SetError("The event system has been shut down");
}
- return (-1);
+ return -1;
}
if (action == SDL_ADDEVENT) {
for (i = 0; i < numevents; ++i) {
@@ -731,7 +731,7 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action
SDL_EventQ.wmmsg_used = NULL;
}
- for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) {
+ for (entry = SDL_EventQ.head; entry && (events == NULL || used < numevents); entry = next) {
next = entry->next;
type = entry->event.type;
if (minType <= type && type <= maxType) {
@@ -764,7 +764,7 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action
/* Skip it, we don't want to include it */
continue;
}
- if (!events || action != SDL_GETEVENT) {
+ if (events == NULL || action != SDL_GETEVENT) {
++sentinels_expected;
}
if (SDL_AtomicGet(&SDL_sentinel_pending) > sentinels_expected) {
@@ -787,7 +787,7 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action
SDL_SendWakeupEvent();
}
- return (used);
+ return used;
}
int
SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
@@ -799,13 +799,13 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
SDL_bool
SDL_HasEvent(Uint32 type)
{
- return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0);
+ return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0;
}
SDL_bool
SDL_HasEvents(Uint32 minType, Uint32 maxType)
{
- return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0);
+ return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0;
}
void
@@ -1128,7 +1128,7 @@ SDL_PushEvent(SDL_Event * event)
event->common.timestamp = SDL_GetTicks();
if (SDL_EventOK.callback || SDL_event_watchers_count > 0) {
- if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_event_watchers_lock == NULL || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) {
if (SDL_event_watchers_lock) {
SDL_UnlockMutex(SDL_event_watchers_lock);
@@ -1179,7 +1179,7 @@ SDL_PushEvent(SDL_Event * event)
void
SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
{
- if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_event_watchers_lock == NULL || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
/* Set filter and discard pending events */
SDL_EventOK.callback = filter;
SDL_EventOK.userdata = userdata;
@@ -1196,7 +1196,7 @@ SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)
{
SDL_EventWatcher event_ok;
- if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_event_watchers_lock == NULL || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
event_ok = SDL_EventOK;
if (SDL_event_watchers_lock) {
@@ -1218,7 +1218,7 @@ SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)
void
SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
{
- if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_event_watchers_lock == NULL || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
SDL_EventWatcher *event_watchers;
event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers));
@@ -1242,7 +1242,7 @@ SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
void
SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
{
- if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_event_watchers_lock == NULL || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
int i;
for (i = 0; i < SDL_event_watchers_count; ++i) {
@@ -1355,7 +1355,7 @@ SDL_SendAppEvent(SDL_EventType eventType)
event.type = eventType;
posted = (SDL_PushEvent(&event) > 0);
}
- return (posted);
+ return posted;
}
int
@@ -1372,7 +1372,7 @@ SDL_SendSysWMEvent(SDL_SysWMmsg * message)
posted = (SDL_PushEvent(&event) > 0);
}
/* Update internal event state */
- return (posted);
+ return posted;
}
int
diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c
index 2cdb0d5..2433a5b 100644
--- a/src/events/SDL_gesture.c
+++ b/src/events/SDL_gesture.c
@@ -92,15 +92,18 @@ static void PrintPath(SDL_FloatPoint *path)
int SDL_RecordGesture(SDL_TouchID touchId)
{
int i;
- if (touchId < 0) recordAll = SDL_TRUE;
+ if (touchId < 0) {
+ recordAll = SDL_TRUE;
+ }
for (i = 0; i < SDL_numGestureTouches; i++) {
if ((touchId < 0) || (SDL_gestureTouch[i].id == touchId)) {
SDL_gestureTouch[i].recording = SDL_TRUE;
- if (touchId >= 0)
+ if (touchId >= 0) {
return 1;
+ }
}
}
- return (touchId < 0);
+ return touchId < 0;
}
void SDL_GestureQuit()
@@ -195,7 +198,7 @@ static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* p
(SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
(index + 1) *
sizeof(SDL_DollarTemplate));
- if (!dollarTemplate) {
+ if (dollarTemplate == NULL) {
return SDL_OutOfMemory();
}
inTouch->dollarTemplate = dollarTemplate;
@@ -213,12 +216,15 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
int index = -1;
int i = 0;
if (inTouch == NULL) {
- if (SDL_numGestureTouches == 0) return SDL_SetError("no gesture touch devices registered");
+ if (SDL_numGestureTouches == 0) {
+ return SDL_SetError("no gesture touch devices registered");
+ }
for (i = 0; i < SDL_numGestureTouches; i++) {
inTouch = &SDL_gestureTouch[i];
index = SDL_AddDollarGesture_one(inTouch, path);
- if (index < 0)
+ if (index < 0) {
return -1;
+ }
}
/* Use the index of the last one added. */
return index;
@@ -230,7 +236,9 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
{
int i,loaded = 0;
SDL_GestureTouch *touch = NULL;
- if (src == NULL) return 0;
+ if (src == NULL) {
+ return 0;
+ }
if (touchId >= 0) {
for (i = 0; i < SDL_numGestureTouches; i++) {
if (SDL_gestureTouch[i].id == touchId) {
@@ -262,10 +270,10 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
if (touchId >= 0) {
/* printf("Adding loaded gesture to 1 touch\n"); */
- if (SDL_AddDollarGesture(touch, templ.path) >= 0)
+ if (SDL_AddDollarGesture(touch, templ.path) >= 0) {
loaded++;
- }
- else {
+ }
+ } else {
/* printf("Adding to: %i touches\n",SDL_numGestureTouches); */
for (i = 0; i < SDL_numGestureTouches; i++) {
touch = &SDL_gestureTouch[i];
@@ -294,7 +302,7 @@ static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float
dist += (float)(SDL_sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
(p.y-templ[i].y)*(p.y-templ[i].y)));
}
- return dist/DOLLARNPOINTS;
+ return dist / DOLLARNPOINTS;
}
@@ -318,8 +326,7 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
f2 = f1;
x1 = (float)(PHI*ta + (1-PHI)*tb);
f1 = dollarDifference(points,templ,x1);
- }
- else {
+ } else {
ta = x1;
x1 = x2;
f1 = f2;
@@ -333,7 +340,7 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
else if (f1 > f2)
printf("Min angle (x2): %f\n",x2);
*/
- return SDL_min(f1,f2);
+ return SDL_min(f1, f2);
}
/* DollarPath contains raw points, plus (possibly) the calculated length */
@@ -414,10 +421,18 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SD
(py - centroid.y)*SDL_cos(ang) + centroid.y);
- if (points[i].x < xmin) xmin = points[i].x;
- if (points[i].x > xmax) xmax = points[i].x;
- if (points[i].y < ymin) ymin = points[i].y;
- if (points[i].y > ymax) ymax = points[i].y;
+ if (points[i].x < xmin) {
+ xmin = points[i].x;
+ }
+ if (points[i].x > xmax) {
+ xmax = points[i].x;
+ }
+ if (points[i].y < ymin) {
+ ymin = points[i].y;
+ }
+ if (points[i].y > ymax) {
+ ymax = points[i].y;
+ }
}
/* Scale points to DOLLARSIZE, and translate to the origin */
@@ -457,7 +472,7 @@ int SDL_GestureAddTouch(SDL_TouchID touchId)
(SDL_numGestureTouches + 1) *
sizeof(SDL_GestureTouch));
- if (!gestureTouch) {
+ if (gestureTouch == NULL) {
return SDL_OutOfMemory();
}
@@ -498,8 +513,9 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
int i;
for (i = 0; i < SDL_numGestureTouches; i++) {
/* printf("%i ?= %i\n",SDL_gestureTouch[i].id,id); */
- if (SDL_gestureTouch[i].id == id)
+ if (SDL_gestureTouch[i].id == id) {
return &SDL_gestureTouch[i];
+ }
}
return NULL;
}
@@ -571,7 +587,9 @@ void SDL_GestureProcessEvent(SDL_Event* event)
SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
/* Shouldn't be possible */
- if (inTouch == NULL) return;
+ if (inTouch == NULL) {
+ return;
+ }
x = event->tfinger.x;
y = event->tfinger.y;
@@ -591,26 +609,24 @@ void SDL_GestureProcessEvent(SDL_Event* event)
/* PrintPath(path); */
if (recordAll) {
index = SDL_AddDollarGesture(NULL,path);
- for (i = 0; i < SDL_numGestureTouches; i++)
+ for (i = 0; i < SDL_numGestureTouches; i++) {
SDL_gestureTouch[i].recording = SDL_FALSE;
- }
- else {
+ }
+ } else {
index = SDL_AddDollarGesture(inTouch,path);
}
if (index >= 0) {
SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash);
- }
- else {
+ } else {
SDL_SendDollarRecord(inTouch,-1);
}
- }
- else {
+ } else {
int bestTempl;
float error;
error = dollarRecognize(&inTouch->dollarPath,
&bestTempl,inTouch);
- if (bestTempl >= 0){
+ if (bestTempl >= 0) {
/* Send Event */
unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
SDL_SendGestureDollar(inTouch,gestureId,error);
@@ -625,8 +641,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers+1)-
y)/inTouch->numDownFingers;
}
- }
- else if (event->type == SDL_FINGERMOTION) {
+ } else if (event->type == SDL_FINGERMOTION) {
float dx = event->tfinger.dx;
float dy = event->tfinger.dy;
#if defined(ENABLE_DOLLAR)
@@ -671,7 +686,12 @@ void SDL_GestureProcessEvent(SDL_Event* event)
dtheta = (float)SDL_atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
dDist = (Dist - lDist);
- if (lDist == 0) {dDist = 0;dtheta = 0;} /* To avoid impossible values */
+ if (lDist == 0) {
+ /* To avoid impossible values */
+ dDist = 0;
+ dtheta = 0;
+ }
+
/* inTouch->gestureLast[j].dDist = dDist;
inTouch->gestureLast[j].dtheta = dtheta;
@@ -684,8 +704,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); */
SDL_SendGestureMulti(inTouch,dtheta,dDist);
- }
- else {
+ } else {
/* inTouch->gestureLast[j].dDist = 0;
inTouch->gestureLast[j].dtheta = 0;
inTouch->gestureLast[j].cv.x = 0;
@@ -695,8 +714,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
inTouch->gestureLast[j].f.p.y = y;
break;
pressure? */
- }
- else if (event->type == SDL_FINGERDOWN) {
+ } else if (event->type == SDL_FINGERDOWN) {
inTouch->numDownFingers++;
inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index 30ec14c..bcfe581 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -754,7 +754,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
- if (keyboard->focus && !window) {
+ if (keyboard->focus && window == NULL) {
/* We won't get anymore keyboard messages, so reset keyboard state */
SDL_ResetKeyboard();
}
@@ -763,7 +763,7 @@ SDL_SetKeyboardFocus(SDL_Window * window)
if (keyboard->focus && keyboard->focus != window) {
/* new window shouldn't think it has mouse captured. */
- SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
+ SDL_assert(window == NULL || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
/* old window must lose an existing mouse capture. */
if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
@@ -939,7 +939,7 @@ SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode, SD
SDL_MinimizeWindow(keyboard->focus);
}
- return (posted);
+ return posted;
}
int
@@ -1045,7 +1045,7 @@ SDL_SendKeyboardText(const char *text)
posted |= (SDL_PushEvent(&event) > 0);
}
}
- return (posted);
+ return posted;
}
int
@@ -1076,7 +1076,7 @@ SDL_SendEditingText(const char *text, int start, int length)
posted = (SDL_PushEvent(&event) > 0);
}
- return (posted);
+ return posted;
}
void
@@ -1100,7 +1100,7 @@ SDL_GetModState(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
- return (SDL_Keymod) keyboard->modstate;
+ return (SDL_Keymod)keyboard->modstate;
}
void
@@ -1183,7 +1183,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name)
{
int i;
- if (!name || !*name) {
+ if (name == NULL || !*name) {
SDL_InvalidParamError("name");
return SDL_SCANCODE_UNKNOWN;
}
@@ -1208,8 +1208,7 @@ SDL_GetKeyName(SDL_Keycode key)
char *end;
if (key & SDLK_SCANCODE_MASK) {
- return
- SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
+ return SDL_GetScancodeName((SDL_Scancode)(key & ~SDLK_SCANCODE_MASK));
}
switch (key) {
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 994b6a6..9cc692d 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -225,7 +225,7 @@ SDL_MouseInit(void)
mouse->cursor_shown = SDL_TRUE;
- return (0);
+ return 0;
}
void
@@ -462,7 +462,7 @@ SDL_SetMouseSystemScale(int num_values, const float *values)
}
v = (float *)SDL_realloc(mouse->system_scale_values, num_values * sizeof(*values));
- if (!v) {
+ if (v == NULL) {
return SDL_OutOfMemory();
}
SDL_memcpy(v, values, num_values * sizeof(*values));
@@ -685,7 +685,7 @@ static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button)
if (button >= mouse->num_clickstates) {
int i, count = button + 1;
SDL_MouseClickState *clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate));
- if (!clickstate) {
+ if (clickstate == NULL) {
return NULL;
}
mouse->clickstate = clickstate;
@@ -708,7 +708,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
SDL_MouseInputSource *source;
source = GetMouseInputSource(mouse, mouseID);
- if (!source) {
+ if (source == NULL) {
return 0;
}
buttonstate = source->buttonstate;
@@ -1005,10 +1005,10 @@ SDL_GetGlobalMouseState(int *x, int *y)
int tmpx, tmpy;
/* make sure these are never NULL for the backend implementations... */
- if (!x) {
+ if (x == NULL) {
x = &tmpx;
}
- if (!y) {
+ if (y == NULL) {
y = &tmpy;
}
@@ -1268,7 +1268,7 @@ SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
0x0000FF00,
0x000000FF,
0xFF000000);
- if (!surface) {
+ if (surface == NULL) {
return NULL;
}
for (y = 0; y < h; ++y) {
@@ -1302,7 +1302,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_Surface *temp = NULL;
SDL_Cursor *cursor;
- if (!surface) {
+ if (surface == NULL) {
SDL_InvalidParamError("surface");
return NULL;
}
@@ -1321,7 +1321,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) {
temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
- if (!temp) {
+ if (temp == NULL) {
return NULL;
}
surface = temp;
@@ -1377,7 +1377,7 @@ SDL_SetCursor(SDL_Cursor * cursor)
break;
}
}
- if (!found) {
+ if (found == NULL) {
SDL_SetError("Cursor not associated with the current mouse");
return;
}
@@ -1407,7 +1407,7 @@ SDL_GetCursor(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
- if (!mouse) {
+ if (mouse == NULL) {
return NULL;
}
return mouse->cur_cursor;
@@ -1418,7 +1418,7 @@ SDL_GetDefaultCursor(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
- if (!mouse) {
+ if (mouse == NULL) {
return NULL;
}
return mouse->def_cursor;
@@ -1430,7 +1430,7 @@ SDL_FreeCursor(SDL_Cursor * cursor)
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Cursor *curr, *prev;
- if (!cursor) {
+ if (cursor == NULL) {
return;
}
@@ -1464,7 +1464,7 @@ SDL_ShowCursor(int toggle)
SDL_Mouse *mouse = SDL_GetMouse();
SDL_bool shown;
- if (!mouse) {
+ if (mouse == NULL) {
return 0;
}
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index bc77b73..3a72479 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -44,7 +44,7 @@ static SDL_TouchID track_touchid;
int
SDL_TouchInit(void)
{
- return (0);
+ return 0;
}
int
@@ -150,7 +150,7 @@ SDL_Finger *
SDL_GetTouchFinger(SDL_TouchID touchID, int index)
{
SDL_Touch *touch = SDL_GetTouch(touchID);
- if (!touch) {
+ if (touch == NULL) {
return NULL;
}
if (index < 0 || index >= touch->num_fingers) {
@@ -174,7 +174,7 @@ SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name)
/* Add the touch to the list of touch */
touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices,
(SDL_num_touch + 1) * sizeof(*touchDevices));
- if (!touchDevices) {
+ if (touchDevices == NULL) {
return SDL_OutOfMemory();
}
@@ -212,7 +212,7 @@ SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float p
if (touch->num_fingers == touch->max_fingers) {
SDL_Finger **new_fingers;
new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers));
- if (!new_fingers) {
+ if (new_fingers == NULL) {
return SDL_OutOfMemory();
}
touch->fingers = new_fingers;
@@ -257,7 +257,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
SDL_Mouse *mouse;
SDL_Touch* touch = SDL_GetTouch(id);
- if (!touch) {
+ if (touch == NULL) {
return -1;
}
@@ -279,10 +279,18 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
if (finger_touching == SDL_FALSE) {
int pos_x = (int)(x * (float)window->w);
int pos_y = (int)(y * (float)window->h);
- if (pos_x < 0) pos_x = 0;
- if (pos_x > window->w - 1) pos_x = window->w - 1;
- if (pos_y < 0) pos_y = 0;
- if (pos_y > window->h - 1) pos_y = window->h - 1;
+ if (pos_x < 0) {
+ pos_x = 0;
+ }
+ if (pos_x > window->w - 1) {
+ pos_x = window->w - 1;
+ }
+ if (pos_y < 0) {
+ pos_y = 0;
+ }
+ if (pos_y > window->h - 1) {
+ pos_y = window->h - 1;
+ }
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
}
@@ -342,7 +350,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
posted = (SDL_PushEvent(&event) > 0);
}
} else {
- if (!finger) {
+ if (finger == NULL) {
/* This finger is already up */
return 0;
}
@@ -379,7 +387,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
float xrel, yrel, prel;
touch = SDL_GetTouch(id);
- if (!touch) {
+ if (touch == NULL) {
return -1;
}
@@ -394,10 +402,18 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
int pos_x = (int)(x * (float)window->w);
int pos_y = (int)(y * (float)window->h);
- if (pos_x < 0) pos_x = 0;
- if (pos_x > window->w - 1) pos_x = window->w - 1;
- if (pos_y < 0) pos_y = 0;
- if (pos_y > window->h - 1) pos_y = window->h - 1;
+ if (pos_x < 0) {
+ pos_x = 0;
+ }
+ if (pos_x > window->w - 1) {
+ pos_x = window->w - 1;
+ }
+ if (pos_y < 0) {
+ pos_y = 0;
+ }
+ if (pos_y > window->h - 1) {
+ pos_y = window->h - 1;
+ }
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
}
}
@@ -414,7 +430,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
}
finger = SDL_GetFinger(touch,fingerid);
- if (!finger) {
+ if (finger == NULL) {
return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure);
}
@@ -466,7 +482,7 @@ SDL_DelTouch(SDL_TouchID id)
index = SDL_GetTouchIndex(id);
touch = SDL_GetTouch(id);
- if (!touch) {
+ if (touch == NULL) {
return;
}
diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c
index 209295a..e87f758 100644
--- a/src/events/SDL_windowevents.c
+++ b/src/events/SDL_windowevents.c
@@ -88,7 +88,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
{
int posted;
- if (!window) {
+ if (window == NULL) {
return 0;
}
switch (windowevent) {
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index ead504c..7c4d683 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -87,8 +87,9 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
DWORD must_exist, truncate;
int a_mode;
- if (!context)
- return -1; /* failed (invalid call) */
+ if (context == NULL) {
+ return -1; /* failed (invalid call) */
+ }
context->hidden.windowsio.h = INVALID_HANDLE_VALUE; /* mark this as unusable */
context->hidden.windowsio.buffer.data = NULL;
@@ -110,8 +111,10 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
w_right = (a_mode || SDL_strchr(mode, '+')
|| truncate) ? GENERIC_WRITE : 0;
- if (!r_right && !w_right) /* inconsistent mode */
- return -1; /* failed (invalid call) */
+ if (!r_right && !w_right) {
+ return -1; /* inconsistent mode */
+ }
+ /* failed (invalid call) */
context->hidden.windowsio.buffer.data =
(char *) SDL_malloc(READAHEAD_BUFFER_SIZE);
@@ -155,7 +158,7 @@ windows_file_size(SDL_RWops * context)
{
LARGE_INTEGER size;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
+ if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
return SDL_SetError("windows_file_size: invalid context/file not opened");
}
@@ -172,7 +175,7 @@ windows_file_seek(SDL_RWops * context, Sint64 offset, int whence)
DWORD windowswhence;
LARGE_INTEGER windowsoffset;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
+ if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
return SDL_SetError("windows_file_seek: invalid context/file not opened");
}
@@ -213,7 +216,7 @@ windows_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
total_need = size * maxnum;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) {
+ if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) {
return 0;
}
@@ -254,7 +257,7 @@ windows_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
}
total_read += byte_read;
}
- return (total_read / size);
+ return total_read / size;
}
static size_t SDLCALL
@@ -268,7 +271,7 @@ windows_file_write(SDL_RWops * context, const void *ptr, size_t size,
total_bytes = size * num;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !size || !total_bytes) {
+ if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !size || !total_bytes) {
return 0;
}
@@ -501,7 +504,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
SDL_memcpy(ptr, context->hidden.mem.here, total_bytes);
context->hidden.mem.here += total_bytes;
- return (total_bytes / size);
+ return total_bytes / size;
}
static size_t SDLCALL
@@ -538,7 +541,7 @@ SDL_RWops *
SDL_RWFromFile(const char *file, const char *mode)
{
SDL_RWops *rwops = NULL;
- if (!file || !*file || !mode || !*mode) {
+ if (file == NULL || !*file || mode == NULL || !*mode) {
SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
return NULL;
}
@@ -571,8 +574,10 @@ SDL_RWFromFile(const char *file, const char *mode)
/* Try to open the file from the asset system */
rwops = SDL_AllocRW();
- if (!rwops)
- return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ if (rwops == NULL) {
+ return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ }
+
if (Android_JNI_FileOpen(rwops, file, mode) < 0) {
SDL_FreeRW(rwops);
return NULL;
@@ -586,8 +591,10 @@ SDL_RWFromFile(const char *file, const char *mode)
#elif defined(__WIN32__) || defined(__GDK__)
rwops = SDL_AllocRW();
- if (!rwops)
- return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ if (rwops == NULL) {
+ return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ }
+
if (windows_file_open(rwops, file, mode) < 0) {
SDL_FreeRW(rwops);
return NULL;
@@ -655,7 +662,7 @@ SDL_RWops *
SDL_RWFromMem(void *mem, int size)
{
SDL_RWops *rwops = NULL;
- if (!mem) {
+ if (mem == NULL) {
SDL_InvalidParamError("mem");
return rwops;
}
@@ -683,7 +690,7 @@ SDL_RWops *
SDL_RWFromConstMem(const void *mem, int size)
{
SDL_RWops *rwops = NULL;
- if (!mem) {
+ if (mem == NULL) {
SDL_InvalidParamError("mem");
return rwops;
}
@@ -736,7 +743,7 @@ SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc)
size_t size_read, size_total;
void *data = NULL, *newdata;
- if (!src) {
+ if (src == NULL) {
SDL_InvalidParamError("src");
return NULL;
}
@@ -752,7 +759,7 @@ SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc)
if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) {
size = (size_total + FILE_CHUNK_SIZE);
newdata = SDL_realloc(data, (size_t)(size + 1));
- if (!newdata) {
+ if (newdata == NULL) {
SDL_free(data);
data = NULL;
SDL_OutOfMemory();
@@ -890,49 +897,49 @@ SDL_ReadBE64(SDL_RWops * src)
size_t
SDL_WriteU8(SDL_RWops * dst, Uint8 value)
{
- return SDL_RWwrite(dst, &value, sizeof (value), 1);
+ return SDL_RWwrite(dst, &value, sizeof(value), 1);
}
size_t
SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
{
const Uint16 swapped = SDL_SwapLE16(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
size_t
SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
{
const Uint16 swapped = SDL_SwapBE16(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
size_t
SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
{
const Uint32 swapped = SDL_SwapLE32(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
size_t
SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
{
const Uint32 swapped = SDL_SwapBE32(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
size_t
SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
{
const Uint64 swapped = SDL_SwapLE64(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
size_t
SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
{
const Uint64 swapped = SDL_SwapBE64(value);
- return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+ return SDL_RWwrite(dst, &swapped, sizeof(swapped), 1);
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/filesystem/android/SDL_sysfilesystem.c b/src/filesystem/android/SDL_sysfilesystem.c
index 0ffe96b..3214b68 100644
--- a/src/filesystem/android/SDL_sysfilesystem.c
+++ b/src/filesystem/android/SDL_sysfilesystem.c
@@ -47,7 +47,7 @@ SDL_GetPrefPath(const char *org, const char *app)
if (path) {
size_t pathlen = SDL_strlen(path)+2;
char *fullpath = (char *)SDL_malloc(pathlen);
- if (!fullpath) {
+ if (fullpath == NULL) {
SDL_OutOfMemory();
return NULL;
}
diff --git a/src/filesystem/emscripten/SDL_sysfilesystem.c b/src/filesystem/emscripten/SDL_sysfilesystem.c
index f007af6..955e8bf 100644
--- a/src/filesystem/emscripten/SDL_sysfilesystem.c
+++ b/src/filesystem/emscripten/SDL_sysfilesystem.c
@@ -47,17 +47,17 @@ SDL_GetPrefPath(const char *org, const char *app)
char *ptr = NULL;
size_t len = 0;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -71,8 +71,9 @@ SDL_GetPrefPath(const char *org, const char *app)
for (ptr = retval+1; *ptr; ptr++) {
if (*ptr == '/') {
*ptr = '\0';
- if (mkdir(retval, 0700) != 0 && errno != EEXIST)
+ if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
goto error;
+ }
*ptr = '/';
}
}
diff --git a/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc
index f359f36..e25a6e0 100644
--- a/src/filesystem/haiku/SDL_sysfilesystem.cc
+++ b/src/filesystem/haiku/SDL_sysfilesystem.cc
@@ -57,7 +57,7 @@ SDL_GetBasePath(void)
const size_t len = SDL_strlen(str);
char *retval = (char *) SDL_malloc(len + 2);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -77,11 +77,11 @@ SDL_GetPrefPath(const char *org, const char *app)
const char *append = "/config/settings/";
size_t len = SDL_strlen(home);
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
@@ -90,7 +90,7 @@ SDL_GetPrefPath(const char *org, const char *app)
}
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
char *retval = (char *) SDL_malloc(len);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
} else {
if (*org) {
diff --git a/src/filesystem/ps2/SDL_sysfilesystem.c b/src/filesystem/ps2/SDL_sysfilesystem.c
index 21c24b6..f2272c0 100644
--- a/src/filesystem/ps2/SDL_sysfilesystem.c
+++ b/src/filesystem/ps2/SDL_sysfilesystem.c
@@ -41,8 +41,9 @@ SDL_GetBasePath(void)
getcwd(cwd, sizeof(cwd));
len = SDL_strlen(cwd) + 1;
retval = (char *) SDL_malloc(len);
- if (retval)
+ if (retval) {
SDL_memcpy(retval, cwd, len);
+ }
return retval;
}
@@ -56,15 +57,17 @@ static void recursive_mkdir(const char *dir) {
snprintf(tmp, sizeof(tmp),"%s",dir);
len = strlen(tmp);
- if (tmp[len - 1] == '/')
+ if (tmp[len - 1] == '/') {
tmp[len - 1] = 0;
+ }
for (p = tmp + 1; *p; p++) {
if (*p == '/') {
*p = 0;
// Just creating subfolders from current path
- if (strstr(tmp, base) != NULL)
+ if (strstr(tmp, base) != NULL) {
mkdir(tmp, S_IRWXU);
+ }
*p = '/';
}
@@ -80,11 +83,11 @@ SDL_GetPrefPath(const char *org, const char *app)
char *retval = NULL;
size_t len;
char *base = SDL_GetBasePath();
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if(!org) {
+ if (org == NULL) {
org = "";
}
diff --git a/src/filesystem/psp/SDL_sysfilesystem.c b/src/filesystem/psp/SDL_sysfilesystem.c
index 4abb90a..cbce1a4 100644
--- a/src/filesystem/psp/SDL_sysfilesystem.c
+++ b/src/filesystem/psp/SDL_sysfilesystem.c
@@ -52,11 +52,11 @@ SDL_GetPrefPath(const char *org, const char *app)
char *retval = NULL;
size_t len;
char *base = SDL_GetBasePath();
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if(!org) {
+ if (org == NULL) {
org = "";
}
diff --git a/src/filesystem/riscos/SDL_sysfilesystem.c b/src/filesystem/riscos/SDL_sysfilesystem.c
index 58ff9f1..8998a7d 100644
--- a/src/filesystem/riscos/SDL_sysfilesystem.c
+++ b/src/filesystem/riscos/SDL_sysfilesystem.c
@@ -39,22 +39,23 @@ SDL_unixify_std(const char *ro_path, char *buffer, size_t buf_len, int filetype)
{
const char *const in_buf = buffer; /* = NULL if we allocate the buffer. */
- if (!buffer) {
+ if (buffer == NULL) {
/* This matches the logic in __unixify, with an additional byte for the
* extra path separator.
*/
buf_len = SDL_strlen(ro_path) + 14 + 1;
buffer = SDL_malloc(buf_len);
- if (!buffer) {
+ if (buffer == NULL) {
SDL_OutOfMemory();
return NULL;
}
}
if (!__unixify_std(ro_path, buffer, buf_len, filetype)) {
- if (!in_buf)
+ if (in_buf == NULL) {
SDL_free(buffer);
+ }
SDL_SetError("Could not convert '%s' to a Unix-style path", ro_path);
return NULL;
@@ -93,7 +94,7 @@ canonicalisePath(const char *path, const char *pathVar)
regs.r[5] = 1 - regs.r[5];
buf = SDL_malloc(regs.r[5]);
- if (!buf) {
+ if (buf == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -123,8 +124,9 @@ createDirectoryRecursive(char *path)
*ptr = '\0';
error = _kernel_swi(OS_File, ®s, ®s);
*ptr = '.';
- if (error != NULL)
+ if (error != NULL) {
return error;
+ }
}
}
return _kernel_swi(OS_File, ®s, ®s);
@@ -143,14 +145,15 @@ SDL_GetBasePath(void)
}
canon = canonicalisePath((const char *)regs.r[0], "Run$Path");
- if (!canon) {
+ if (canon == NULL) {
return NULL;
}
/* chop off filename. */
ptr = SDL_strrchr(canon, '.');
- if (ptr != NULL)
+ if (ptr != NULL) {
*ptr = '\0';
+ }
retval = SDL_unixify_std(canon, NULL, 0, __RISCOSIFY_FILETYPE_NOTSPECIFIED);
SDL_free(canon);
@@ -164,22 +167,22 @@ SDL_GetPrefPath(const char *org, const char *app)
size_t len;
_kernel_oserror *error;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
canon = canonicalisePath("<Choices$Write>", "Run$Path");
- if (!canon) {
+ if (canon == NULL) {
return NULL;
}
len = SDL_strlen(canon) + SDL_strlen(org) + SDL_strlen(app) + 4;
dir = (char *) SDL_malloc(len);
- if (!dir) {
+ if (dir == NULL) {
SDL_OutOfMemory();
SDL_free(canon);
return NULL;
diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c
index 00cbd18..bd11fda 100644
--- a/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/src/filesystem/unix/SDL_sysfilesystem.c
@@ -52,8 +52,7 @@ readSymLink(const char *path)
ssize_t len = 64;
ssize_t rc = -1;
- while (1)
- {
+ while (1) {
char *ptr = (char *) SDL_realloc(retval, (size_t) len);
if (ptr == NULL) {
SDL_OutOfMemory();
@@ -88,13 +87,13 @@ static char *search_path_for_binary(const char *bin)
char *start = envr;
char *ptr;
- if (!envr) {
+ if (envr == NULL) {
SDL_SetError("No $PATH set");
return NULL;
}
envr = SDL_strdup(envr);
- if (!envr) {
+ if (envr == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -143,7 +142,7 @@ SDL_GetBasePath(void)
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) {
retval = SDL_strdup(fullpath);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -157,13 +156,13 @@ SDL_GetBasePath(void)
if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) {
char *exe, *pwddst;
char *realpathbuf = (char *) SDL_malloc(PATH_MAX + 1);
- if (!realpathbuf) {
+ if (realpathbuf == NULL) {
SDL_OutOfMemory();
return NULL;
}
cmdline = SDL_malloc(len);
- if (!cmdline) {
+ if (cmdline == NULL) {
SDL_free(realpathbuf);
SDL_OutOfMemory();
return NULL;
@@ -201,7 +200,7 @@ SDL_GetBasePath(void)
}
}
- if (!retval) {
+ if (retval == NULL) {
SDL_free(realpathbuf);
}
@@ -210,7 +209,7 @@ SDL_GetBasePath(void)
#endif
/* is a Linux-style /proc filesystem available? */
- if (!retval && (access("/proc", F_OK) == 0)) {
+ if (retval == NULL && (access("/proc", F_OK) == 0)) {
/* !!! FIXME: after 2.0.6 ships, let's delete this code and just
use the /proc/%llu version. There's no reason to have
two copies of this plus all the #ifdefs. --ryan. */
@@ -265,8 +264,9 @@ SDL_GetBasePath(void)
if (retval != NULL) {
/* try to shrink buffer... */
char *ptr = (char *) SDL_realloc(retval, SDL_strlen(retval) + 1);
- if (ptr != NULL)
- retval = ptr; /* oh well if it failed. */
+ if (ptr != NULL) {
+ retval = ptr; /* oh well if it failed. */
+ }
}
return retval;
@@ -288,18 +288,18 @@ SDL_GetPrefPath(const char *org, const char *app)
char *ptr = NULL;
size_t len = 0;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
- if (!envr) {
+ if (envr == NULL) {
/* You end up with "$HOME/.local/share/Game Name 2" */
envr = SDL_getenv("HOME");
- if (!envr) {
+ if (envr == NULL) {
/* we could take heroic measures with /etc/passwd, but oh well. */
SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
return NULL;
@@ -310,12 +310,13 @@ SDL_GetPrefPath(const char *org, const char *app)
}
len = SDL_strlen(envr);
- if (envr[len - 1] == '/')
+ if (envr[len - 1] == '/') {
append += 1;
+ }
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -329,8 +330,9 @@ SDL_GetPrefPath(const char *org, const char *app)
for (ptr = retval+1; *ptr; ptr++) {
if (*ptr == '/') {
*ptr = '\0';
- if (mkdir(retval, 0700) != 0 && errno != EEXIST)
+ if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
goto error;
+ }
*ptr = '/';
}
}
diff --git a/src/filesystem/vita/SDL_sysfilesystem.c b/src/filesystem/vita/SDL_sysfilesystem.c
index 1952cad..89304ba 100644
--- a/src/filesystem/vita/SDL_sysfilesystem.c
+++ b/src/filesystem/vita/SDL_sysfilesystem.c
@@ -55,11 +55,11 @@ SDL_GetPrefPath(const char *org, const char *app)
char *ptr = NULL;
size_t len = 0;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
@@ -67,7 +67,7 @@ SDL_GetPrefPath(const char *org, const char *app)
len += SDL_strlen(org) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
diff --git a/src/filesystem/windows/SDL_sysfilesystem.c b/src/filesystem/windows/SDL_sysfilesystem.c
index 5d3099b..b537311 100644
--- a/src/filesystem/windows/SDL_sysfilesystem.c
+++ b/src/filesystem/windows/SDL_sysfilesystem.c
@@ -43,7 +43,7 @@ SDL_GetBasePath(void)
while (SDL_TRUE) {
void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR));
- if (!ptr) {
+ if (ptr == NULL) {
SDL_free(path);
SDL_OutOfMemory();
return NULL;
@@ -101,11 +101,11 @@ SDL_GetPrefPath(const char *org, const char *app)
size_t new_wpath_len = 0;
BOOL api_result = FALSE;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
diff --git a/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/filesystem/winrt/SDL_sysfilesystem.cpp
index 115b45b..8603b26 100644
--- a/src/filesystem/winrt/SDL_sysfilesystem.cpp
+++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp
@@ -111,7 +111,7 @@ SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
}
const wchar_t * ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType);
- if (!ucs2Path) {
+ if (ucs2Path == NULL) {
return NULL;
}
@@ -128,14 +128,14 @@ SDL_GetBasePath(void)
size_t destPathLen;
char * destPath = NULL;
- if (!srcPath) {
+ if (srcPath == NULL) {
SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
return NULL;
}
destPathLen = SDL_strlen(srcPath) + 2;
destPath = (char *) SDL_malloc(destPathLen);
- if (!destPath) {
+ if (destPath == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -161,16 +161,16 @@ SDL_GetPrefPath(const char *org, const char *app)
size_t new_wpath_len = 0;
BOOL api_result = FALSE;
- if (!app) {
+ if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
- if (!org) {
+ if (org == NULL) {
org = "";
}
srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER);
- if ( ! srcPath) {
+ if (srcPath == NULL) {
SDL_SetError("Unable to find a source path");
return NULL;
}
diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c
index 3f87143..3c02ae6 100644
--- a/src/haptic/SDL_haptic.c
+++ b/src/haptic/SDL_haptic.c
@@ -60,8 +60,7 @@ ValidHaptic(SDL_Haptic * haptic)
valid = 0;
if (haptic != NULL) {
hapticlist = SDL_haptics;
- while ( hapticlist )
- {
+ while ( hapticlist ) {
if (hapticlist == haptic) {
valid = 1;
break;
@@ -123,8 +122,7 @@ SDL_HapticOpen(int device_index)
/* If the haptic is already open, return it
* TODO: Should we create haptic instance IDs like the Joystick API?
*/
- while ( hapticlist )
- {
+ while ( hapticlist ) {
if (device_index == hapticlist->index) {
haptic = hapticlist;
++haptic->ref_count;
@@ -156,10 +154,12 @@ SDL_HapticOpen(int device_index)
SDL_haptics = haptic;
/* Disable autocenter and set gain to max. */
- if (haptic->supported & SDL_HAPTIC_GAIN)
+ if (haptic->supported & SDL_HAPTIC_GAIN) {
SDL_HapticSetGain(haptic, 100);
- if (haptic->supported & SDL_HAPTIC_AUTOCENTER)
+ }
+ if (haptic->supported & SDL_HAPTIC_AUTOCENTER) {
SDL_HapticSetAutocenter(haptic, 0);
+ }
return haptic;
}
@@ -184,8 +184,7 @@ SDL_HapticOpened(int device_index)
opened = 0;
hapticlist = SDL_haptics;
/* TODO Should this use an instance ID? */
- while ( hapticlist )
- {
+ while ( hapticlist ) {
if (hapticlist->index == (Uint8) device_index) {
opened = 1;
break;
@@ -216,8 +215,9 @@ SDL_HapticIndex(SDL_Haptic * haptic)
int
SDL_MouseIsHaptic(void)
{
- if (SDL_SYS_HapticMouse() < 0)
+ if (SDL_SYS_HapticMouse() < 0) {
return SDL_FALSE;
+ }
return SDL_TRUE;
}
@@ -295,8 +295,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
hapticlist = SDL_haptics;
/* Check to see if joystick's haptic is already open */
- while ( hapticlist )
- {
+ while ( hapticlist ) {
if (SDL_SYS_JoystickSameHaptic(hapticlist, joystick)) {
haptic = hapticlist;
++haptic->ref_count;
@@ -362,17 +361,12 @@ SDL_HapticClose(SDL_Haptic * haptic)
/* Remove from the list */
hapticlist = SDL_haptics;
hapticlistprev = NULL;
- while ( hapticlist )
- {
- if (haptic == hapticlist)
- {
- if ( hapticlistprev )
- {
+ while ( hapticlist ) {
+ if (haptic == hapticlist) {
+ if ( hapticlistprev ) {
/* unlink this entry */
hapticlistprev->next = hapticlist->next;
- }
- else
- {
+ } else {
SDL_haptics = haptic->next;
}
@@ -464,8 +458,9 @@ SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect)
return -1;
}
- if ((haptic->supported & effect->type) != 0)
+ if ((haptic->supported & effect->type) != 0) {
return SDL_TRUE;
+ }
return SDL_FALSE;
}
@@ -646,10 +641,11 @@ SDL_HapticSetGain(SDL_Haptic * haptic, int gain)
max_gain = SDL_atoi(env);
/* Check for sanity. */
- if (max_gain < 0)
+ if (max_gain < 0) {
max_gain = 0;
- else if (max_gain > 100)
+ } else if (max_gain > 100) {
max_gain = 100;
+ }
/* We'll scale it linearly with SDL_HAPTIC_GAIN_MAX */
real_gain = (gain * max_gain) / 100;
@@ -747,7 +743,7 @@ SDL_HapticRumbleSupported(SDL_Haptic * haptic)
}
/* Most things can use SINE, but XInput only has LEFTRIGHT. */
- return ((haptic->supported & (SDL_HAPTIC_SINE|SDL_HAPTIC_LEFTRIGHT)) != 0);
+ return (haptic->supported & (SDL_HAPTIC_SINE | SDL_HAPTIC_LEFTRIGHT)) != 0;
}
/*
diff --git a/src/haptic/android/SDL_syshaptic.c b/src/haptic/android/SDL_syshaptic.c
index dda5733..dd9ee1e 100644
--- a/src/haptic/android/SDL_syshaptic.c
+++ b/src/haptic/android/SDL_syshaptic.c
@@ -57,13 +57,13 @@ SDL_SYS_HapticInit(void)
timeout = SDL_GetTicks() + 3000;
Android_JNI_PollHapticDevices();
}
- return (numhaptics);
+ return numhaptics;
}
int
SDL_SYS_NumHaptics(void)
{
- return (numhaptics);
+ return numhaptics;
}
static SDL_hapticlist_item *
@@ -136,19 +136,19 @@ OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item)
static SDL_hapticlist_item *
OpenHapticByOrder(SDL_Haptic *haptic, int index)
{
- return OpenHaptic (haptic, HapticByOrder(index));
+ return OpenHaptic(haptic, HapticByOrder(index));
}
static SDL_hapticlist_item *
OpenHapticByDevId(SDL_Haptic *haptic, int device_id)
{
- return OpenHaptic (haptic, HapticByDevId(device_id));
+ return OpenHaptic(haptic, HapticByDevId(device_id));
}
int
SDL_SYS_HapticOpen(SDL_Haptic *haptic)
{
- return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0);
+ return OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0;
}
@@ -171,14 +171,14 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
- return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0);
+ return OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0;
}
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
- return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0);
+ return ((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0;
}
diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index 50905e1..3c0ebb4 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -229,8 +229,7 @@ MacHaptic_MaybeAddDevice( io_object_t device )
}
/* Make sure we don't already have it */
- for (item = SDL_hapticlist; item ; item = item->next)
- {
+ for (item = SDL_hapticlist; item ; item = item->next) {
if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
/* Already added */
return -1;
diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c
index a9be7e0..7ae9c3d 100644
--- a/src/haptic/linux/SDL_syshaptic.c
+++ b/src/haptic/linux/SDL_syshaptic.c
@@ -85,8 +85,10 @@ static SDL_hapticlist_item *SDL_hapticlist = NULL;
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
static int numhaptics = 0;
-#define EV_TEST(ev,f) \
- if (test_bit((ev), features)) ret |= (f);
+#define EV_TEST(ev,f) \
+ if (test_bit((ev), features)) { \
+ ret |= (f); \
+ }
/*
* Test whether a device has haptic properties.
* Returns available properties or 0 if there are none.
@@ -760,8 +762,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_CONSTANT;
- if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1)
+ if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1) {
return -1;
+ }
/* Replay */
dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ?
@@ -795,8 +798,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_PERIODIC;
- if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1)
+ if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1) {
return -1;
+ }
/* Replay */
dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ?
@@ -808,17 +812,18 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
dest->trigger.interval = CLAMP(periodic->interval);
/* Periodic */
- if (periodic->type == SDL_HAPTIC_SINE)
+ if (periodic->type == SDL_HAPTIC_SINE) {
dest->u.periodic.waveform = FF_SINE;
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* else if (periodic->type == SDL_HAPTIC_SQUARE)
dest->u.periodic.waveform = FF_SQUARE; */
- else if (periodic->type == SDL_HAPTIC_TRIANGLE)
+ } else if (periodic->type == SDL_HAPTIC_TRIANGLE) {
dest->u.periodic.waveform = FF_TRIANGLE;
- else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP)
+ } else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP) {
dest->u.periodic.waveform = FF_SAW_UP;
- else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN)
+ } else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN) {
dest->u.periodic.waveform = FF_SAW_DOWN;
+ }
dest->u.periodic.period = CLAMP(periodic->period);
dest->u.periodic.magnitude = periodic->magnitude;
dest->u.periodic.offset = periodic->offset;
@@ -842,14 +847,16 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
condition = &src->condition;
/* Header */
- if (condition->type == SDL_HAPTIC_SPRING)
+ if (condition->type == SDL_HAPTIC_SPRING) {
dest->type = FF_SPRING;
- else if (condition->type == SDL_HAPTIC_DAMPER)
+ } else if (condition->type == SDL_HAPTIC_DAMPER) {
dest->type = FF_DAMPER;
- else if (condition->type == SDL_HAPTIC_INERTIA)
+ } else if (condition->type == SDL_HAPTIC_INERTIA) {
dest->type = FF_INERTIA;
- else if (condition->type == SDL_HAPTIC_FRICTION)
+ } else if (condition->type == SDL_HAPTIC_FRICTION) {
dest->type = FF_FRICTION;
+ }
+
dest->direction = 0; /* Handled by the condition-specifics. */
/* Replay */
@@ -888,8 +895,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Header */
dest->type = FF_RAMP;
- if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1)
+ if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1) {
return -1;
+ }
/* Replay */
dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ?
diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c
index 2229c69..a7900d6 100644
--- a/src/haptic/windows/SDL_dinputhaptic.c
+++ b/src/haptic/windows/SDL_dinputhaptic.c
@@ -575,18 +575,22 @@ SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes)
case SDL_HAPTIC_CARTESIAN:
effect->dwFlags |= DIEFF_CARTESIAN;
rglDir[0] = dir->dir[0];
- if (naxes > 1)
+ if (naxes > 1) {
rglDir[1] = dir->dir[1];
- if (naxes > 2)
+ }
+ if (naxes > 2) {
rglDir[2] = dir->dir[2];
+ }
return 0;
case SDL_HAPTIC_SPHERICAL:
effect->dwFlags |= DIEFF_SPHERICAL;
rglDir[0] = dir->dir[0];
- if (naxes > 1)
+ if (naxes > 1) {
rglDir[1] = dir->dir[1];
- if (naxes > 2)
+ }
+ if (naxes > 2) {
rglDir[2] = dir->dir[2];
+ }
return 0;
case SDL_HAPTIC_STEERING_AXIS:
effect->dwFlags |= DIEFF_CARTESIAN;
@@ -1098,8 +1102,9 @@ SDL_DINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effe
return DI_SetError("Getting effect status", ret);
}
- if (status == 0)
+ if (status == 0) {
return SDL_FALSE;
+ }
return SDL_TRUE;
}
diff --git a/src/haptic/windows/SDL_xinputhaptic.c b/src/haptic/windows/SDL_xinputhaptic.c
index 2622fb7..b70b482 100644
--- a/src/haptic/windows/SDL_xinputhaptic.c
+++ b/src/haptic/windows/SDL_xinputhaptic.c
@@ -233,7 +233,7 @@ SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
int
SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
- return (haptic->hwdata->userid == joystick->hwdata->userid);
+ return haptic->hwdata->userid == joystick->hwdata->userid;
}
int
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 47818d4..1a3c466 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -185,7 +185,9 @@ static int SDL_inotify_init1(void) {
#else
static int SDL_inotify_init1(void) {
int fd = inotify_init();
- if (fd < 0) return -1;
+ if (fd < 0) {
+ return -1;
+ }
fcntl(fd, F_SETFL, O_NONBLOCK);
fcntl(fd, F_SETFD, FD_CLOEXEC);
return fd;
@@ -195,7 +197,7 @@ static int SDL_inotify_init1(void) {
static int
StrHasPrefix(const char *string, const char *prefix)
{
- return (SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0);
+ return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0;
}
static int
@@ -324,8 +326,7 @@ HIDAPI_InitializeDiscovery()
SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_TRUE;
}
}
- }
- else
+ } else
#endif /* SDL_USE_LIBUDEV */
{
#if defined(HAVE_INOTIFY)
@@ -421,15 +422,14 @@ HIDAPI_UpdateDiscovery()
if (pUdevDevice) {
const char *action = NULL;
action = usyms->udev_device_get_action(pUdevDevice);
- if (!action || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) {
+ if (action == NULL || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) {
++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
}
usyms->udev_device_unref(pUdevDevice);
}
}
}
- }
- else
+ } else
#endif /* SDL_USE_LIBUDEV */
{
#if defined(HAVE_INOTIFY)
@@ -481,8 +481,9 @@ HIDAPI_ShutdownDiscovery()
}
#if defined(__WIN32__) || defined(__WINGDK__)
- if (SDL_HIDAPI_discovery.m_hNotify)
+ if (SDL_HIDAPI_discovery.m_hNotify) {
UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify);
+ }
if (SDL_HIDAPI_discovery.m_hwndMsg) {
DestroyWindow(SDL_HIDAPI_discovery.m_hwndMsg);
@@ -509,8 +510,7 @@ HIDAPI_ShutdownDiscovery()
SDL_UDEV_ReleaseUdevSyms();
usyms = NULL;
}
- }
- else
+ } else
#endif /* SDL_USE_LIBUDEV */
{
#if defined(HAVE_INOTIFY)
@@ -808,14 +808,8 @@ SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
uint8_t descriptor_index, uint16_t lang_id,
unsigned char *data, int length)
{
- return libusb_control_transfer(dev,
- LIBUSB_ENDPOINT_IN | 0x0, /* Endpoint 0 IN */
- LIBUSB_REQUEST_GET_DESCRIPTOR,
- (LIBUSB_DT_STRING << 8) | descriptor_index,
- lang_id,
- data,
- (uint16_t) length,
- 1000);
+ return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN | 0x0, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | descriptor_index, lang_id,
+ data, (uint16_t)length, 1000); /* Endpoint 0 IN */
}
#define libusb_get_string_descriptor SDL_libusb_get_string_descriptor
#endif /* __FreeBSD__ */
@@ -1240,7 +1234,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
#endif
for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info));
- if (!new_dev) {
+ if (new_dev == NULL) {
LIBUSB_hid_free_enumeration(usb_devs);
SDL_hid_free_enumeration(devs);
SDL_OutOfMemory();
@@ -1313,7 +1307,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
#endif
if (!bFound) {
new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info));
- if (!new_dev) {
+ if (new_dev == NULL) {
#ifdef HAVE_LIBUSB
if (libusb_ctx.libhandle) {
LIBUSB_hid_free_enumeration(usb_devs);
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 26979a2..46a4658 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -168,7 +168,7 @@ SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list)
spot = (char *)hint;
}
- if (!spot) {
+ if (spot == NULL) {
return;
}
@@ -176,7 +176,7 @@ SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list)
entry = (Uint16)SDL_strtol(spot, &spot, 0);
entry <<= 16;
spot = SDL_strstr(spot, "0x");
- if (!spot) {
+ if (spot == NULL) {
break;
}
entry |= (Uint16)SDL_strtol(spot, &spot, 0);
@@ -222,9 +222,9 @@ static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGam
}
if (a->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
- return (a->output.axis.axis == b->output.axis.axis);
+ return a->output.axis.axis == b->output.axis.axis;
} else {
- return (a->output.button == b->output.button);
+ return a->output.button == b->output.button;
}
}
@@ -266,7 +266,7 @@ static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int
}
}
- if (last_match && (!match || !HasSameOutput(last_match, match))) {
+ if (last_match && (match == NULL || !HasSameOutput(last_match, match))) {
/* Clear the last input that this axis generated */
ResetOutput(gamecontroller, last_match);
}
@@ -549,8 +549,7 @@ static ControllerMapping_t *SDL_CreateMappingForAndroidController(SDL_JoystickGU
SDL_strlcat(mapping_string, "righttrigger:a5,", sizeof(mapping_string));
}
- return SDL_PrivateAddMappingForGUID(guid, mapping_string,
- &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}
#endif /* __ANDROID__ */
@@ -681,8 +680,7 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
}
}
- return SDL_PrivateAddMappingForGUID(guid, mapping_string,
- &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}
/*
@@ -696,8 +694,7 @@ static ControllerMapping_t *SDL_CreateMappingForRAWINPUTController(SDL_JoystickG
SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string));
SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string));
- return SDL_PrivateAddMappingForGUID(guid, mapping_string,
- &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}
/*
@@ -715,8 +712,7 @@ static ControllerMapping_t *SDL_CreateMappingForWGIController(SDL_JoystickGUID g
SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string));
SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:b10,dpdown:b12,dpleft:b13,dpright:b11,leftx:a1,lefty:a0~,rightx:a3,righty:a2~,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string));
- return SDL_PrivateAddMappingForGUID(guid, mapping_string,
- &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}
/*
@@ -808,7 +804,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG
return s_pXInputMapping;
}
#endif
- if (!mapping) {
+ if (mapping == NULL) {
if (SDL_IsJoystickHIDAPI(guid)) {
mapping = SDL_CreateMappingForHIDAPIController(guid);
} else if (SDL_IsJoystickRAWINPUT(guid)) {
@@ -847,13 +843,14 @@ SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString
++pchString;
}
- if (!pchString || !pchString[0]) {
+ if (pchString == NULL || !pchString[0]) {
return SDL_CONTROLLER_AXIS_INVALID;
}
for (entry = 0; map_StringForControllerAxis[entry]; ++entry) {
- if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry]))
- return (SDL_GameControllerAxis) entry;
+ if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry])) {
+ return (SDL_GameControllerAxis)entry;
+ }
}
return SDL_CONTROLLER_AXIS_INVALID;
}
@@ -900,12 +897,14 @@ static const char* map_StringForControllerButton[] = {
SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString)
{
int entry;
- if (!pchString || !pchString[0])
+ if (pchString == NULL || !pchString[0]) {
return SDL_CONTROLLER_BUTTON_INVALID;
+ }
for (entry = 0; map_StringForControllerButton[entry]; ++entry) {
- if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0)
- return (SDL_GameControllerButton) entry;
+ if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0) {
+ return (SDL_GameControllerButton)entry;
+ }
}
return SDL_CONTROLLER_BUTTON_INVALID;
}
@@ -1114,7 +1113,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
const char *pFirstComma = SDL_strchr(pMapping, ',');
if (pFirstComma) {
char *pchGUID = SDL_malloc(pFirstComma - pMapping + 1);
- if (!pchGUID) {
+ if (pchGUID == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1154,15 +1153,17 @@ static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
char *pchName;
pFirstComma = SDL_strchr(pMapping, ',');
- if (!pFirstComma)
+ if (pFirstComma == NULL) {
return NULL;
+ }
pSecondComma = SDL_strchr(pFirstComma + 1, ',');
- if (!pSecondComma)
+ if (pSecondComma == NULL) {
return NULL;
+ }
pchName = SDL_malloc(pSecondComma - pFirstComma);
- if (!pchName) {
+ if (pchName == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1180,12 +1181,14 @@ static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMappi
const char *pFirstComma, *pSecondComma;
pFirstComma = SDL_strchr(pMapping, ',');
- if (!pFirstComma)
+ if (pFirstComma == NULL) {
return NULL;
+ }
pSecondComma = SDL_strchr(pFirstComma + 1, ',');
- if (!pSecondComma)
+ if (pSecondComma == NULL) {
return NULL;
+ }
return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */
}
@@ -1225,13 +1228,13 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
Uint16 crc;
pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString);
- if (!pchName) {
+ if (pchName == NULL) {
SDL_SetError("Couldn't parse name from %s", mappingString);
return NULL;
}
pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString);
- if (!pchMapping) {
+ if (pchMapping == NULL) {
SDL_free(pchName);
SDL_SetError("Couldn't parse %s", mappingString);
return NULL;
@@ -1288,7 +1291,7 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
*existing = SDL_TRUE;
} else {
pControllerMapping = SDL_malloc(sizeof(*pControllerMapping));
- if (!pControllerMapping) {
+ if (pControllerMapping == NULL) {
SDL_free(pchName);
SDL_free(pchMapping);
SDL_OutOfMemory();
@@ -1331,7 +1334,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
mapping = SDL_PrivateGetControllerMappingForGUID(guid);
#ifdef __LINUX__
- if (!mapping && name) {
+ if (mapping == NULL && name) {
if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
/* The Linux driver xpad.c maps the wireless dpad to buttons */
SDL_bool existing;
@@ -1344,7 +1347,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
}
#endif /* __LINUX__ */
- if (!mapping) {
+ if (mapping == NULL) {
mapping = s_pDefaultMapping;
}
return mapping;
@@ -1426,8 +1429,7 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefttrigger", &raw_map->lefttrigger);
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "righttrigger", &raw_map->righttrigger);
- return SDL_PrivateAddMappingForGUID(guid, mapping,
- &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ return SDL_PrivateAddMappingForGUID(guid, mapping, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
}
static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
@@ -1441,13 +1443,13 @@ static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
SDL_UnlockJoysticks();
- return (NULL);
+ return NULL;
}
name = SDL_JoystickNameForIndex(device_index);
guid = SDL_JoystickGetDeviceGUID(device_index);
mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid);
- if (!mapping) {
+ if (mapping == NULL) {
SDL_GamepadMapping raw_map;
SDL_zero(raw_map);
@@ -1544,7 +1546,7 @@ SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMap
SDL_bool existing = SDL_FALSE;
ControllerMapping_t *pControllerMapping;
- if (!mappingString) {
+ if (mappingString == NULL) {
return SDL_InvalidParamError("mappingString");
}
@@ -1611,7 +1613,7 @@ SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMap
#endif
pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString);
- if (!pchGUID) {
+ if (pchGUID == NULL) {
return SDL_SetError("Couldn't parse GUID from %s", mappingString);
}
if (!SDL_strcasecmp(pchGUID, "default")) {
@@ -1623,7 +1625,7 @@ SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMap
SDL_free(pchGUID);
pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority);
- if (!pControllerMapping) {
+ if (pControllerMapping == NULL) {
return -1;
}
@@ -1691,7 +1693,7 @@ CreateMappingString(ControllerMapping_t *mapping, SDL_JoystickGUID guid)
}
pMappingString = SDL_malloc(needed);
- if (!pMappingString) {
+ if (pMappingString == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1778,8 +1780,9 @@ SDL_GameControllerLoadHints()
char *pchNewLine = NULL;
pchNewLine = SDL_strchr(pUserMappings, '\n');
- if (pchNewLine)
+ if (pchNewLine) {
*pchNewLine = '\0';
+ }
SDL_PrivateGameControllerAddMapping(pUserMappings, SDL_CONTROLLER_MAPPING_PRIORITY_USER);
@@ -1841,7 +1844,7 @@ SDL_GameControllerInitMappings(void)
SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT,
SDL_GameControllerIgnoreDevicesExceptChanged, NULL);
- return (0);
+ return 0;
}
int
@@ -1862,7 +1865,7 @@ SDL_GameControllerInit(void)
}
}
- return (0);
+ return 0;
}
@@ -1930,7 +1933,7 @@ SDL_GameControllerMappingForDeviceIndex(int joystick_index)
/* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */
needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
pMappingString = SDL_malloc(needed);
- if (!pMappingString) {
+ if (pMappingString == NULL) {
SDL_OutOfMemory();
SDL_UnlockJoysticks();
return NULL;
@@ -2085,14 +2088,14 @@ SDL_GameControllerOpen(int device_index)
gamecontroller = gamecontrollerlist;
++gamecontroller->ref_count;
SDL_UnlockJoysticks();
- return (gamecontroller);
+ return gamecontroller;
}
gamecontrollerlist = gamecontrollerlist->next;
}
/* Find a controller mapping */
pSupportedController = SDL_PrivateGetControllerMapping(device_index);
- if (!pSupportedController) {
+ if (pSupportedController == NULL) {
SDL_SetError("Couldn't find mapping for device (%d)", device_index);
SDL_UnlockJoysticks();
return NULL;
@@ -2146,7 +2149,7 @@ SDL_GameControllerOpen(int device_index)
SDL_UnlockJoysticks();
- return (gamecontroller);
+ return gamecontroller;
}
/*
@@ -2377,7 +2380,7 @@ int SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_S
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
int i;
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
@@ -2439,7 +2442,7 @@ SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_Sens
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
int i;
- if (!joystick) {
+ if (joystick == NULL) {
return 0.0f;
}
@@ -2471,7 +2474,7 @@ SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller,
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
int i;
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
@@ -2507,7 +2510,7 @@ SDL_GameControllerPath(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return NULL;
}
return SDL_JoystickPath(joystick);
@@ -2518,7 +2521,7 @@ SDL_GameControllerGetType(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return SDL_CONTROLLER_TYPE_UNKNOWN;
}
return SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGetGUID(joystick), SDL_JoystickName(joystick));
@@ -2529,7 +2532,7 @@ SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
return SDL_JoystickGetPlayerIndex(joystick);
@@ -2543,7 +2546,7 @@ SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return;
}
SDL_JoystickSetPlayerIndex(joystick, player_index);
@@ -2554,7 +2557,7 @@ SDL_GameControllerGetVendor(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return 0;
}
return SDL_JoystickGetVendor(joystick);
@@ -2565,7 +2568,7 @@ SDL_GameControllerGetProduct(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return 0;
}
return SDL_JoystickGetProduct(joystick);
@@ -2576,7 +2579,7 @@ SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return 0;
}
return SDL_JoystickGetProductVersion(joystick);
@@ -2587,7 +2590,7 @@ SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return 0;
}
return SDL_JoystickGetFirmwareVersion(joystick);
@@ -2598,7 +2601,7 @@ SDL_GameControllerGetSerial(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return NULL;
}
return SDL_JoystickGetSerial(joystick);
@@ -2674,8 +2677,9 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController
CHECK_GAMECONTROLLER_MAGIC(gamecontroller, bind);
- if (axis == SDL_CONTROLLER_AXIS_INVALID)
+ if (axis == SDL_CONTROLLER_AXIS_INVALID) {
return bind;
+ }
for (i = 0; i < gamecontroller->num_bindings; ++i) {
SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
@@ -2708,8 +2712,9 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameControll
CHECK_GAMECONTROLLER_MAGIC(gamecontroller, bind);
- if (button == SDL_CONTROLLER_BUTTON_INVALID)
+ if (button == SDL_CONTROLLER_BUTTON_INVALID) {
return bind;
+ }
for (i = 0; i < gamecontroller->num_bindings; ++i) {
SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
@@ -2735,7 +2740,7 @@ SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequenc
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
return SDL_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms);
@@ -2746,7 +2751,7 @@ SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
return SDL_JoystickRumbleTriggers(joystick, left_rumble, right_rumble, duration_ms);
@@ -2757,7 +2762,7 @@ SDL_GameControllerHasLED(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return SDL_FALSE;
}
return SDL_JoystickHasLED(joystick);
@@ -2768,7 +2773,7 @@ SDL_GameControllerHasRumble(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return SDL_FALSE;
}
return SDL_JoystickHasRumble(joystick);
@@ -2779,7 +2784,7 @@ SDL_GameControllerHasRumbleTriggers(SDL_GameController *gamecontroller)
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return SDL_FALSE;
}
return SDL_JoystickHasRumbleTriggers(joystick);
@@ -2790,7 +2795,7 @@ SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 gr
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
return SDL_JoystickSetLED(joystick, red, green, blue);
@@ -2801,7 +2806,7 @@ SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *dat
{
SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller);
- if (!joystick) {
+ if (joystick == NULL) {
return -1;
}
return SDL_JoystickSendEffect(joystick, data, size);
@@ -2812,8 +2817,9 @@ SDL_GameControllerClose(SDL_GameController *gamecontroller)
{
SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
- if (!gamecontroller || gamecontroller->magic != &gamecontroller_magic)
+ if (gamecontroller == NULL || gamecontroller->magic != &gamecontroller_magic) {
return;
+ }
SDL_LockJoysticks();
@@ -2917,7 +2923,7 @@ SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL_GameContro
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
- return (posted);
+ return posted;
}
@@ -2946,7 +2952,7 @@ SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameCont
break;
default:
/* Invalid state -- bail */
- return (0);
+ return 0;
}
#endif /* !SDL_EVENTS_DISABLED */
@@ -2957,12 +2963,12 @@ SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameCont
if (gamecontroller->joystick->delayed_guide_button) {
/* Skip duplicate press */
- return (0);
+ return 0;
}
} else {
if (!SDL_TICKS_PASSED(now, gamecontroller->guide_button_down+SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS)) {
gamecontroller->joystick->delayed_guide_button = SDL_TRUE;
- return (0);
+ return 0;
}
gamecontroller->joystick->delayed_guide_button = SDL_FALSE;
}
@@ -2978,7 +2984,7 @@ SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameCont
posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
- return (posted);
+ return posted;
}
/*
@@ -3013,7 +3019,7 @@ SDL_GameControllerEventState(int state)
}
break;
}
- return (state);
+ return state;
#endif /* SDL_EVENTS_DISABLED */
}
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 0339296..009e9a0 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -264,7 +264,7 @@ SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
if (player_index >= SDL_joystick_player_count) {
SDL_JoystickID *new_players = (SDL_JoystickID *)SDL_realloc(SDL_joystick_players, (player_index + 1)*sizeof(*SDL_joystick_players));
- if (!new_players) {
+ if (new_players == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -316,7 +316,7 @@ SDL_JoystickInit(void)
int i, status;
/* Create the joystick list lock */
- if (!SDL_joystick_lock) {
+ if (SDL_joystick_lock == NULL) {
SDL_joystick_lock = SDL_CreateMutex();
}
@@ -410,7 +410,7 @@ SDL_JoystickPathForIndex(int device_index)
SDL_UnlockJoysticks();
/* FIXME: Really we should reference count this path so it doesn't go away after unlock */
- if (!path) {
+ if (path == NULL) {
SDL_Unsupported();
}
return path;
@@ -1389,7 +1389,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type)
}
events = SDL_small_alloc(SDL_Event, num_events, &isstack);
- if (!events) {
+ if (events == NULL) {
return;
}
@@ -1910,10 +1910,10 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c
return SDL_strdup(custom_name);
}
- if (!vendor_name) {
+ if (vendor_name == NULL) {
vendor_name = "";
}
- if (!product_name) {
+ if (product_name == NULL) {
product_name = "";
}
@@ -1965,7 +1965,7 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c
name = SDL_strdup("Controller");
}
- if (!name) {
+ if (name == NULL) {
return NULL;
}
@@ -2030,7 +2030,7 @@ SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version
SDL_zero(guid);
- if (!name) {
+ if (name == NULL) {
name = "";
}
@@ -2220,7 +2220,7 @@ SDL_bool
SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_XBoxOneController);
+ return eType == k_eControllerType_XBoxOneController;
}
SDL_bool
@@ -2294,71 +2294,68 @@ SDL_bool
SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_PS4Controller);
+ return eType == k_eControllerType_PS4Controller;
}
SDL_bool
SDL_IsJoystickPS5(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_PS5Controller);
+ return eType == k_eControllerType_PS5Controller;
}
SDL_bool
SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SwitchProController ||
- eType == k_eControllerType_SwitchInputOnlyController);
+ return eType == k_eControllerType_SwitchProController || eType == k_eControllerType_SwitchInputOnlyController;
}
SDL_bool
SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SwitchInputOnlyController);
+ return eType == k_eControllerType_SwitchInputOnlyController;
}
SDL_bool
SDL_IsJoystickNintendoSwitchJoyCon(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SwitchJoyConLeft ||
- eType == k_eControllerType_SwitchJoyConRight);
+ return eType == k_eControllerType_SwitchJoyConLeft || eType == k_eControllerType_SwitchJoyConRight;
}
SDL_bool
SDL_IsJoystickNintendoSwitchJoyConLeft(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SwitchJoyConLeft);
+ return eType == k_eControllerType_SwitchJoyConLeft;
}
SDL_bool
SDL_IsJoystickNintendoSwitchJoyConRight(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SwitchJoyConRight);
+ return eType == k_eControllerType_SwitchJoyConRight;
}
SDL_bool
SDL_IsJoystickNintendoSwitchJoyConGrip(Uint16 vendor_id, Uint16 product_id)
{
- return (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP);
+ return vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP;
}
SDL_bool
SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 product_id)
{
- return (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR);
+ return vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR;
}
SDL_bool
SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
- return (eType == k_eControllerType_SteamController ||
- eType == k_eControllerType_SteamControllerV2);
+ return eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2;
}
SDL_bool
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c
index a1c8b88..fdf5f16 100644
--- a/src/joystick/android/SDL_sysjoystick.c
+++ b/src/joystick/android/SDL_sysjoystick.c
@@ -620,7 +620,7 @@ ANDROID_JoystickOpen(SDL_Joystick *joystick, int device_index)
joystick->nbuttons = item->nbuttons;
joystick->naxes = item->naxes;
- return (0);
+ return 0;
}
static int
diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c
index 598505e..7049062 100644
--- a/src/joystick/bsd/SDL_bsdjoystick.c
+++ b/src/joystick/bsd/SDL_bsdjoystick.c
@@ -321,8 +321,9 @@ CreateHwData(const char *path)
hw->type = BSDJOY_UHID;
{
int ax;
- for (ax = 0; ax < JOYAXE_count; ax++)
+ for (ax = 0; ax < JOYAXE_count; ax++) {
hw->axis_map[ax] = -1;
+ }
}
hw->repdesc = hid_get_report_desc(fd);
if (hw->repdesc == NULL) {
@@ -356,8 +357,9 @@ CreateHwData(const char *path)
SDL_SetError("%s: Cannot start HID parser", path);
goto usberr;
}
- for (i = 0; i < JOYAXE_count; i++)
+ for (i = 0; i < JOYAXE_count; i++) {
hw->axis_map[i] = -1;
+ }
while (hid_get_item(hdata, &hitem) > 0) {
switch (hitem.kind) {
@@ -395,9 +397,11 @@ CreateHwData(const char *path)
}
}
hid_end_parse(hdata);
- for (i = 0; i < JOYAXE_count; i++)
- if (hw->axis_map[i] > 0)
+ for (i = 0; i < JOYAXE_count; i++) {
+ if (hw->axis_map[i] > 0) {
hw->axis_map[i] = hw->naxes++;
+ }
+ }
if (hw->naxes == 0 && hw->nbuttons == 0 && hw->nhats == 0) {
SDL_SetError("%s: Not a joystick, ignoring", path);
@@ -447,7 +451,7 @@ MaybeAddDevice(const char *path)
}
hw = CreateHwData(path);
- if (!hw) {
+ if (hw == NULL) {
return -1;
}
@@ -477,7 +481,7 @@ MaybeAddDevice(const char *path)
}
#endif /* USB_GET_DEVICEINFO */
}
- if (!name) {
+ if (name == NULL) {
name = SDL_strdup(path);
guid = SDL_CreateJoystickGUIDForName(name);
}
@@ -634,7 +638,7 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
}
hw = CreateHwData(item->path);
- if (!hw) {
+ if (hw == NULL) {
return -1;
}
@@ -739,16 +743,13 @@ BSD_JoystickUpdate(SDL_Joystick *joy)
else if (usage == HUG_DPAD_UP) {
dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- }
- else if (usage == HUG_DPAD_DOWN) {
+ } else if (usage == HUG_DPAD_DOWN) {
dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- }
- else if (usage == HUG_DPAD_RIGHT) {
+ } else if (usage == HUG_DPAD_RIGHT) {
dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
- }
- else if (usage == HUG_DPAD_LEFT) {
+ } else if (usage == HUG_DPAD_LEFT) {
dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
}
diff --git a/src/joystick/darwin/SDL_iokitjoystick.c b/src/joystick/darwin/SDL_iokitjoystick.c
index de43c97..7b7f9c7 100644
--- a/src/joystick/darwin/SDL_iokitjoystick.c
+++ b/src/joystick/darwin/SDL_iokitjoystick.c
@@ -43,7 +43,7 @@ static recDevice *gpDeviceList = NULL;
void FreeRumbleEffectData(FFEFFECT *effect)
{
- if (!effect) {
+ if (effect == NULL) {
return;
}
SDL_free(effect->rgdwAxes);
@@ -59,7 +59,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
/* Create the effect */
effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect));
- if (!effect) {
+ if (effect == NULL) {
return NULL;
}
effect->dwSize = sizeof(*effect);
@@ -83,7 +83,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
effect->dwFlags |= FFEFF_CARTESIAN;
periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic));
- if (!periodic) {
+ if (periodic == NULL) {
FreeRumbleEffectData(effect);
return NULL;
}
@@ -101,8 +101,9 @@ static recDevice *GetDeviceForIndex(int device_index)
recDevice *device = gpDeviceList;
while (device) {
if (!device->removed) {
- if (device_index == 0)
+ if (device_index == 0) {
break;
+ }
--device_index;
}
@@ -208,13 +209,10 @@ GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 m
const float deviceScale = max - min;
const float readScale = pElement->maxReport - pElement->minReport;
int returnValue = SDL_FALSE;
- if (GetHIDElementState(pDevice, pElement, pValue))
- {
+ if (GetHIDElementState(pDevice, pElement, pValue)) {
if (readScale == 0) {
returnValue = SDL_TRUE; /* no scaling at all */
- }
- else
- {
+ } else {
*pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min;
returnValue = SDL_TRUE;
}
@@ -547,7 +545,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
}
device = (recDevice *) SDL_calloc(1, sizeof(recDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
return;
}
@@ -580,7 +578,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
}
/* Add device to the end of the list */
- if ( !gpDeviceList ) {
+ if (gpDeviceList == NULL) {
gpDeviceList = device;
} else {
recDevice *curdevice;
@@ -891,7 +889,7 @@ DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1
/* Scale and average the two rumble strengths */
Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2);
- if (!device) {
+ if (device == NULL) {
return SDL_SetError("Rumble failed, device disconnected");
}
@@ -934,7 +932,7 @@ DARWIN_JoystickGetCapabilities(SDL_Joystick *joystick)
recDevice *device = joystick->hwdata;
Uint32 result = 0;
- if (!device) {
+ if (device == NULL) {
return 0;
}
@@ -971,7 +969,7 @@ DARWIN_JoystickUpdate(SDL_Joystick *joystick)
SInt32 value, range;
int i, goodRead = SDL_FALSE;
- if (!device) {
+ if (device == NULL) {
return;
}
diff --git a/src/joystick/emscripten/SDL_sysjoystick.c b/src/joystick/emscripten/SDL_sysjoystick.c
index c875e99..389f2f4 100644
--- a/src/joystick/emscripten/SDL_sysjoystick.c
+++ b/src/joystick/emscripten/SDL_sysjoystick.c
@@ -77,11 +77,11 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa
item->timestamp = gamepadEvent->timestamp;
- for( i = 0; i < item->naxes; i++) {
+ for ( i = 0; i < item->naxes; i++) {
item->axis[i] = gamepadEvent->axis[i];
}
- for( i = 0; i < item->nbuttons; i++) {
+ for ( i = 0; i < item->nbuttons; i++) {
item->analogButton[i] = gamepadEvent->analogButton[i];
item->digitalButton[i] = gamepadEvent->digitalButton[i];
}
@@ -199,7 +199,7 @@ EMSCRIPTEN_JoystickInit(void)
/* handle already connected gamepads */
if (numjs > 0) {
- for(i = 0; i < numjs; i++) {
+ for (i = 0; i < numjs; i++) {
retval = emscripten_get_gamepad_status(i, &gamepadState);
if (retval == EMSCRIPTEN_RESULT_SUCCESS) {
Emscripten_JoyStickConnected(EMSCRIPTEN_EVENT_GAMEPADCONNECTED,
@@ -213,7 +213,7 @@ EMSCRIPTEN_JoystickInit(void)
0,
Emscripten_JoyStickConnected);
- if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
+ if (retval != EMSCRIPTEN_RESULT_SUCCESS) {
EMSCRIPTEN_JoystickQuit();
return SDL_SetError("Could not set gamepad connect callback");
}
@@ -221,7 +221,7 @@ EMSCRIPTEN_JoystickInit(void)
retval = emscripten_set_gamepaddisconnected_callback(NULL,
0,
Emscripten_JoyStickDisconnected);
- if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
+ if (retval != EMSCRIPTEN_RESULT_SUCCESS) {
EMSCRIPTEN_JoystickQuit();
return SDL_SetError("Could not set gamepad disconnect callback");
}
@@ -332,7 +332,7 @@ EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
joystick->nbuttons = item->nbuttons;
joystick->naxes = item->naxes;
- return (0);
+ return 0;
}
/* Function to update the state of a joystick - called as a device poll.
@@ -351,10 +351,10 @@ EMSCRIPTEN_JoystickUpdate(SDL_Joystick *joystick)
if (item) {
result = emscripten_get_gamepad_status(item->index, &gamepadState);
- if( result == EMSCRIPTEN_RESULT_SUCCESS) {
- if(gamepadState.timestamp == 0 || gamepadState.timestamp != item->timestamp) {
- for(i = 0; i < item->nbuttons; i++) {
- if(item->digitalButton[i] != gamepadState.digitalButton[i]) {
+ if ( result == EMSCRIPTEN_RESULT_SUCCESS) {
+ if (gamepadState.timestamp == 0 || gamepadState.timestamp != item->timestamp) {
+ for (i = 0; i < item->nbuttons; i++) {
+ if (item->digitalButton[i] != gamepadState.digitalButton[i]) {
buttonState = gamepadState.digitalButton[i]? SDL_PRESSED: SDL_RELEASED;
SDL_PrivateJoystickButton(item->joystick, i, buttonState);
}
@@ -364,8 +364,8 @@ EMSCRIPTEN_JoystickUpdate(SDL_Joystick *joystick)
item->digitalButton[i] = gamepadState.digitalButton[i];
}
- for(i = 0; i < item->naxes; i++) {
- if(item->axis[i] != gamepadState.axis[i]) {
+ for (i = 0; i < item->naxes; i++) {
+ if (item->axis[i] != gamepadState.axis[i]) {
/* do we need to do conversion? */
SDL_PrivateJoystickAxis(item->joystick, i,
(Sint16) (32767.*gamepadState.axis[i]));
diff --git a/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc
index cacaf76..0beee31 100644
--- a/src/joystick/haiku/SDL_haikujoystick.cc
+++ b/src/joystick/haiku/SDL_haikujoystick.cc
@@ -68,8 +68,7 @@ extern "C"
numjoysticks = 0;
SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport));
SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname));
- for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i)
- {
+ for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) {
if (joystick.GetDeviceName(i, name) == B_OK) {
if (joystick.Open(name) != B_ERROR) {
BString stick_name;
diff --git a/src/joystick/hidapi/SDL_hidapi_gamecube.c b/src/joystick/hidapi/SDL_hidapi_gamecube.c
index 4e68f47..4219328 100644
--- a/src/joystick/hidapi/SDL_hidapi_gamecube.c
+++ b/src/joystick/hidapi/SDL_hidapi_gamecube.c
@@ -146,7 +146,7 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device)
#endif
ctx = (SDL_DriverGameCube_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -258,7 +258,7 @@ HIDAPI_DriverGameCube_HandleJoystickPacket(SDL_HIDAPI_Device *device, SDL_Driver
}
joystick = SDL_JoystickFromInstanceID(ctx->joysticks[i]);
- if (!joystick) {
+ if (joystick == NULL) {
/* Hasn't been opened yet, skip */
return;
}
diff --git a/src/joystick/hidapi/SDL_hidapi_luna.c b/src/joystick/hidapi/SDL_hidapi_luna.c
index c9cd281..173e0a0 100644
--- a/src/joystick/hidapi/SDL_hidapi_luna.c
+++ b/src/joystick/hidapi/SDL_hidapi_luna.c
@@ -66,9 +66,7 @@ HIDAPI_DriverLuna_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverLuna_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_LUNA,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_LUNA, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -83,7 +81,7 @@ HIDAPI_DriverLuna_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverLuna_Context *ctx;
ctx = (SDL_DriverLuna_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -289,14 +287,11 @@ HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick, SDL_DriverL
int level = data[1] * 100 / 0xFF;
if (level == 0) {
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY);
- }
- else if (level <= 20) {
+ } else if (level <= 20) {
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW);
- }
- else if (level <= 70) {
+ } else if (level <= 70) {
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM);
- }
- else {
+ } else {
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL);
}
@@ -416,7 +411,7 @@ HIDAPI_DriverLuna_UpdateDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_LUNA_PROTOCOL
HIDAPI_DumpPacket("Amazon Luna packet: size = %d", data, size);
#endif
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -434,7 +429,7 @@ HIDAPI_DriverLuna_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_ps3.c b/src/joystick/hidapi/SDL_hidapi_ps3.c
index 10e3bc5..f77f91e 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps3.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps3.c
@@ -145,7 +145,7 @@ HIDAPI_DriverPS3_InitDevice(SDL_HIDAPI_Device *device)
}
ctx = (SDL_DriverPS3_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -228,7 +228,7 @@ HIDAPI_DriverPS3_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID
{
SDL_DriverPS3_Context *ctx = (SDL_DriverPS3_Context *)device->context;
- if (!ctx) {
+ if (ctx == NULL) {
return;
}
@@ -511,7 +511,7 @@ HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_PS3_PROTOCOL
HIDAPI_DumpPacket("PS3 packet: size = %d", data, size);
#endif
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -553,7 +553,7 @@ HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
@@ -634,7 +634,7 @@ HIDAPI_DriverPS3ThirdParty_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverPS3_Context *ctx;
ctx = (SDL_DriverPS3_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -842,7 +842,7 @@ HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_PS3_PROTOCOL
HIDAPI_DumpPacket("PS3 packet: size = %d", data, size);
#endif
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -859,7 +859,7 @@ HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index 63d720d..ee04a95 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -171,9 +171,7 @@ HIDAPI_DriverPS4_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverPS4_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS4,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS4, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static int ReadFeatureReport(SDL_hid_device *dev, Uint8 report_id, Uint8 *report, size_t length)
@@ -248,7 +246,7 @@ HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
SDL_JoystickType joystick_type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
ctx = (SDL_DriverPS4_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -425,7 +423,7 @@ HIDAPI_DriverPS4_LoadCalibrationData(SDL_HIDAPI_Device *device)
return;
}
- for( tries = 0; tries < 5; ++tries ) {
+ for ( tries = 0; tries < 5; ++tries ) {
/* For Bluetooth controllers, this report switches them into advanced report mode */
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_USB, data, sizeof(data));
if (size < 35) {
@@ -1076,7 +1074,7 @@ HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
++packet_count;
ctx->last_packet = now;
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -1150,7 +1148,7 @@ HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 7458ada..69535fd 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -254,9 +254,7 @@ HIDAPI_DriverPS5_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverPS5_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS5,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS5, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static int ReadFeatureReport(SDL_hid_device *dev, Uint8 report_id, Uint8 *report, size_t length)
@@ -349,7 +347,7 @@ HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
SDL_JoystickType joystick_type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
ctx = (SDL_DriverPS5_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -1354,7 +1352,7 @@ HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
++packet_count;
ctx->last_packet = now;
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -1414,7 +1412,7 @@ HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_rumble.c b/src/joystick/hidapi/SDL_hidapi_rumble.c
index e15ecf0..c411245 100644
--- a/src/joystick/hidapi/SDL_hidapi_rumble.c
+++ b/src/joystick/hidapi/SDL_hidapi_rumble.c
@@ -215,7 +215,7 @@ int SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(SDL_HIDAPI_Device *device, const
}
request = (SDL_HIDAPI_RumbleRequest *)SDL_calloc(1, sizeof(*request));
- if (!request) {
+ if (request == NULL) {
SDL_HIDAPI_UnlockRumble();
return SDL_OutOfMemory();
}
diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c
index 4fe0090..a4dcdbd 100644
--- a/src/joystick/hidapi/SDL_hidapi_shield.c
+++ b/src/joystick/hidapi/SDL_hidapi_shield.c
@@ -107,9 +107,7 @@ HIDAPI_DriverShield_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverShield_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SHIELD,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SHIELD, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -124,7 +122,7 @@ HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverShield_Context *ctx;
ctx = (SDL_DriverShield_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -508,7 +506,7 @@ HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device)
/* Byte 0 is HID report ID */
switch (data[0]) {
case k_ShieldReportIdControllerState:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
if (size == 16) {
@@ -518,7 +516,7 @@ HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device)
}
break;
case k_ShieldReportIdControllerTouch:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
HIDAPI_DriverShield_HandleTouchPacketV103(joystick, ctx, data, size);
@@ -582,7 +580,7 @@ HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_stadia.c b/src/joystick/hidapi/SDL_hidapi_stadia.c
index a6d54b2..6c6d0d5 100644
--- a/src/joystick/hidapi/SDL_hidapi_stadia.c
+++ b/src/joystick/hidapi/SDL_hidapi_stadia.c
@@ -62,9 +62,7 @@ HIDAPI_DriverStadia_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverStadia_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STADIA,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STADIA, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -79,7 +77,7 @@ HIDAPI_DriverStadia_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverStadia_Context *ctx;
ctx = (SDL_DriverStadia_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -283,7 +281,7 @@ HIDAPI_DriverStadia_UpdateDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_STADIA_PROTOCOL
HIDAPI_DumpPacket("Google Stadia packet: size = %d", data, size);
#endif
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -294,7 +292,7 @@ HIDAPI_DriverStadia_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c
index 9221d12..23d3b8c 100644
--- a/src/joystick/hidapi/SDL_hidapi_steam.c
+++ b/src/joystick/hidapi/SDL_hidapi_steam.c
@@ -203,8 +203,9 @@ static uint8_t GetSegmentHeader( int nSegmentNumber, bool bLastPacket )
{
uint8_t header = REPORT_SEGMENT_DATA_FLAG;
header |= nSegmentNumber;
- if ( bLastPacket )
+ if (bLastPacket) {
header |= REPORT_SEGMENT_LAST_FLAG;
+ }
return header;
}
@@ -212,8 +213,9 @@ static uint8_t GetSegmentHeader( int nSegmentNumber, bool bLastPacket )
static void hexdump( const uint8_t *ptr, int len )
{
int i;
- for ( i = 0; i < len ; ++i )
+ for (i = 0; i < len; ++i) {
printf("%02x ", ptr[i]);
+ }
printf("\n");
}
@@ -236,21 +238,18 @@ static void InitializeSteamControllerPacketAssembler( SteamControllerPacketAssem
// Complete packet size on completion
static int WriteSegmentToSteamControllerPacketAssembler( SteamControllerPacketAssembler *pAssembler, const uint8_t *pSegment, int nSegmentLength )
{
- if ( pAssembler->bIsBle )
- {
+ if ( pAssembler->bIsBle ) {
uint8_t uSegmentHeader = pSegment[ 1 ];
int nSegmentNumber = uSegmentHeader & 0x07;
HEXDUMP( pSegment, nSegmentLength );
- if ( pSegment[ 0 ] != BLE_REPORT_NUMBER )
- {
+ if ( pSegment[ 0 ] != BLE_REPORT_NUMBER ) {
// We may get keyboard/mouse input events until controller stops sending them
return 0;
}
- if ( nSegmentLength != MAX_REPORT_SEGMENT_SIZE )
- {
+ if ( nSegmentLength != MAX_REPORT_SEGMENT_SIZE ) {
printf( "Bad segment size! %d\n", (int)nSegmentLength );
hexdump( pSegment, nSegmentLength );
ResetSteamControllerPacketAssembler( pAssembler );
@@ -259,18 +258,15 @@ static int WriteSegmentToSteamControllerPacketAssembler( SteamControllerPacketAs
DPRINTF("GOT PACKET HEADER = 0x%x\n", uSegmentHeader);
- if ( ( uSegmentHeader & REPORT_SEGMENT_DATA_FLAG ) == 0 )
- {
+ if ( ( uSegmentHeader & REPORT_SEGMENT_DATA_FLAG ) == 0 ) {
// We get empty segments, just ignore them
return 0;
}
- if ( nSegmentNumber != pAssembler->nExpectedSegmentNumber )
- {
+ if ( nSegmentNumber != pAssembler->nExpectedSegmentNumber ) {
ResetSteamControllerPacketAssembler( pAssembler );
- if ( nSegmentNumber )
- {
+ if ( nSegmentNumber ) {
// This happens occasionally
DPRINTF("Bad segment number, got %d, expected %d\n",
nSegmentNumber, pAssembler->nExpectedSegmentNumber );
@@ -282,16 +278,13 @@ static int WriteSegmentToSteamControllerPacketAssembler( SteamControllerPacketAs
pSegment + 2, // ignore header and report number
MAX_REPORT_SEGMENT_PAYLOAD_SIZE );
- if ( uSegmentHeader & REPORT_SEGMENT_LAST_FLAG )
- {
+ if ( uSegmentHeader & REPORT_SEGMENT_LAST_FLAG ) {
pAssembler->nExpectedSegmentNumber = 0;
return ( nSegmentNumber + 1 ) * MAX_REPORT_SEGMENT_PAYLOAD_SIZE;
}
pAssembler->nExpectedSegmentNumber++;
- }
- else
- {
+ } else {
// Just pass through
SDL_memcpy( pAssembler->uBuffer,
pSegment,
@@ -311,20 +304,19 @@ static int SetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65], int
DPRINTF("SetFeatureReport %p %p %d\n", dev, uBuffer, nActualDataLen);
- if ( bBle )
- {
+ if ( bBle ) {
int nSegmentNumber = 0;
uint8_t uPacketBuffer[ MAX_REPORT_SEGMENT_SIZE ];
unsigned char *pBufferPtr = uBuffer + 1;
- if ( nActualDataLen < 1 )
+ if (nActualDataLen < 1) {
return -1;
+ }
// Skip report number in data
nActualDataLen--;
- while ( nActualDataLen > 0 )
- {
+ while ( nActualDataLen > 0 ) {
int nBytesInPacket = nActualDataLen > MAX_REPORT_SEGMENT_PAYLOAD_SIZE ? MAX_REPORT_SEGMENT_PAYLOAD_SIZE : nActualDataLen;
nActualDataLen -= nBytesInPacket;
@@ -353,8 +345,7 @@ static int GetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65] )
DPRINTF("GetFeatureReport( %p %p )\n", dev, uBuffer );
- if ( bBle )
- {
+ if ( bBle ) {
int nRetries = 0;
uint8_t uSegmentBuffer[ MAX_REPORT_SEGMENT_SIZE + 1 ];
uint8_t ucBytesToRead = MAX_REPORT_SEGMENT_SIZE;
@@ -371,8 +362,7 @@ static int GetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65] )
++ucDataStartOffset;
#endif
- while( nRetries < BLE_MAX_READ_RETRIES )
- {
+ while ( nRetries < BLE_MAX_READ_RETRIES ) {
SDL_memset( uSegmentBuffer, 0, sizeof( uSegmentBuffer ) );
uSegmentBuffer[ 0 ] = BLE_REPORT_NUMBER;
nRet = SDL_hid_get_feature_report( dev, uSegmentBuffer, ucBytesToRead );
@@ -386,14 +376,12 @@ static int GetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65] )
else
nRetries++;
- if ( nRet > 0 )
- {
+ if ( nRet > 0 ) {
int nPacketLength = WriteSegmentToSteamControllerPacketAssembler( &assembler,
uSegmentBuffer + ucDataStartOffset,
nRet - ucDataStartOffset );
- if ( nPacketLength > 0 && nPacketLength < 65 )
- {
+ if ( nPacketLength > 0 && nPacketLength < 65 ) {
// Leave space for "report number"
uBuffer[ 0 ] = 0;
SDL_memcpy( uBuffer + 1, assembler.uBuffer, nPacketLength );
@@ -416,14 +404,16 @@ static int ReadResponse( SDL_hid_device *dev, uint8_t uBuffer[65], int nExpected
DPRINTF("ReadResponse( %p %p %d )\n", dev, uBuffer, nExpectedResponse );
- if ( nRet < 0 )
+ if (nRet < 0) {
return nRet;
+ }
DPRINTF("ReadResponse got %d bytes of data: ", nRet );
HEXDUMP( uBuffer, nRet );
- if ( uBuffer[1] != nExpectedResponse )
+ if (uBuffer[1] != nExpectedResponse) {
return -1;
+ }
return nRet;
}
@@ -447,35 +437,34 @@ static bool ResetSteamController( SDL_hid_device *dev, bool bSuppressErrorSpew,
buf[0] = 0;
buf[1] = ID_GET_ATTRIBUTES_VALUES;
res = SetFeatureReport( dev, buf, 2 );
- if ( res < 0 )
- {
- if ( !bSuppressErrorSpew )
- printf( "GET_ATTRIBUTES_VALUES failed for controller %p\n", dev );
+ if ( res < 0 ) {
+ if (!bSuppressErrorSpew) {
+ printf("GET_ATTRIBUTES_VALUES failed for controller %p\n", dev);
+ }
return false;
}
// Retrieve GET_ATTRIBUTES_VALUES result
// Wireless controller endpoints without a connected controller will return nAttrs == 0
res = ReadResponse( dev, buf, ID_GET_ATTRIBUTES_VALUES );
- if ( res < 0 || buf[1] != ID_GET_ATTRIBUTES_VALUES )
- {
+ if ( res < 0 || buf[1] != ID_GET_ATTRIBUTES_VALUES ) {
HEXDUMP(buf, res);
- if ( !bSuppressErrorSpew )
- printf( "Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev );
+ if (!bSuppressErrorSpew) {
+ printf("Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev);
+ }
return false;
}
nAttributesLength = buf[ 2 ];
- if ( nAttributesLength > res )
- {
- if ( !bSuppressErrorSpew )
- printf( "Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev );
+ if ( nAttributesLength > res ) {
+ if (!bSuppressErrorSpew) {
+ printf("Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev);
+ }
return false;
}
msg = (FeatureReportMsg *)&buf[1];
- for ( i = 0; i < (int)msg->header.length / sizeof( ControllerAttribute ); ++i )
- {
+ for ( i = 0; i < (int)msg->header.length / sizeof( ControllerAttribute ); ++i ) {
uint8_t unAttribute = msg->payload.getAttributes.attributes[i].attributeTag;
uint32_t unValue = msg->payload.getAttributes.attributes[i].attributeValue;
@@ -494,8 +483,7 @@ static bool ResetSteamController( SDL_hid_device *dev, bool bSuppressErrorSpew,
break;
}
}
- if ( punUpdateRateUS )
- {
+ if ( punUpdateRateUS ) {
*punUpdateRateUS = unUpdateRateUS;
}
@@ -503,10 +491,10 @@ static bool ResetSteamController( SDL_hid_device *dev, bool bSuppressErrorSpew,
buf[0] = 0;
buf[1] = ID_CLEAR_DIGITAL_MAPPINGS;
res = SetFeatureReport( dev, buf, 2 );
- if ( res < 0 )
- {
- if ( !bSuppressErrorSpew )
- printf( "CLEAR_DIGITAL_MAPPINGS failed for controller %p\n", dev );
+ if ( res < 0 ) {
+ if (!bSuppressErrorSpew) {
+ printf("CLEAR_DIGITAL_MAPPINGS failed for controller %p\n", dev);
+ }
return false;
}
@@ -515,10 +503,10 @@ static bool ResetSteamController( SDL_hid_device *dev, bool bSuppressErrorSpew,
buf[1] = ID_LOAD_DEFAULT_SETTINGS;
buf[2] = 0;
res = SetFeatureReport( dev, buf, 3 );
- if ( res < 0 )
- {
- if ( !bSuppressErrorSpew )
- printf( "LOAD_DEFAULT_SETTINGS failed for controller %p\n", dev );
+ if ( res < 0 ) {
+ if (!bSuppressErrorSpew) {
+ printf("LOAD_DEFAULT_SETTINGS failed for controller %p\n", dev);
+ }
return false;
}
@@ -545,10 +533,10 @@ buf[3+nSettings*3+2] = ((uint16_t)VALUE)>>8; \
buf[2] = nSettings*3;
res = SetFeatureReport( dev, buf, 3+nSettings*3 );
- if ( res < 0 )
- {
- if ( !bSuppressErrorSpew )
- printf( "SET_SETTINGS failed for controller %p\n", dev );
+ if ( res < 0 ) {
+ if (!bSuppressErrorSpew) {
+ printf("SET_SETTINGS failed for controller %p\n", dev);
+ }
return false;
}
@@ -556,37 +544,32 @@ buf[3+nSettings*3+2] = ((uint16_t)VALUE)>>8; \
// Wait for ID_CLEAR_DIGITAL_MAPPINGS to be processed on the controller
bool bMappingsCleared = false;
int iRetry;
- for ( iRetry = 0; iRetry < 2; ++iRetry )
- {
+ for ( iRetry = 0; iRetry < 2; ++iRetry ) {
SDL_memset( buf, 0, 65 );
buf[1] = ID_GET_DIGITAL_MAPPINGS;
buf[2] = 1; // one byte - requesting from index 0
buf[3] = 0;
res = SetFeatureReport( dev, buf, 4 );
- if ( res < 0 )
- {
+ if ( res < 0 ) {
printf( "GET_DIGITAL_MAPPINGS failed for controller %p\n", dev );
return false;
}
res = ReadResponse( dev, buf, ID_GET_DIGITAL_MAPPINGS );
- if ( res < 0 || buf[1] != ID_GET_DIGITAL_MAPPINGS )
- {
+ if ( res < 0 || buf[1] != ID_GET_DIGITAL_MAPPINGS ) {
printf( "Bad GET_DIGITAL_MAPPINGS response for controller %p\n", dev );
return false;
}
// If the length of the digital mappings result is not 1 (index byte, no mappings) then clearing hasn't executed
- if ( buf[2] == 1 && buf[3] == 0xFF )
- {
+ if ( buf[2] == 1 && buf[3] == 0xFF ) {
bMappingsCleared = true;
break;
}
usleep( CONTROLLER_CONFIGURATION_DELAY_US );
}
- if ( !bMappingsCleared && !bSuppressErrorSpew )
- {
+ if ( !bMappingsCleared && !bSuppressErrorSpew ) {
printf( "Warning: CLEAR_DIGITAL_MAPPINGS never completed for controller %p\n", dev );
}
@@ -602,10 +585,10 @@ buf[3+nSettings*3+2] = ((uint16_t)VALUE)>>8; \
buf[8] = MOUSE_BTN_RIGHT;
res = SetFeatureReport( dev, buf, 9 );
- if ( res < 0 )
- {
- if ( !bSuppressErrorSpew )
- printf( "SET_DIGITAL_MAPPINGS failed for controller %p\n", dev );
+ if ( res < 0 ) {
+ if (!bSuppressErrorSpew) {
+ printf("SET_DIGITAL_MAPPINGS failed for controller %p\n", dev);
+ }
return false;
}
#endif // ENABLE_MOUSE_MODE
@@ -659,12 +642,9 @@ static void CloseSteamController( SDL_hid_device *dev )
//---------------------------------------------------------------------------
static float RemapValClamped( float val, float A, float B, float C, float D)
{
- if ( A == B )
- {
+ if ( A == B ) {
return ( val - B ) >= 0.0f ? D : C;
- }
- else
- {
+ } else {
float cVal = (val - A) / (B - A);
cVal = clamp( cVal, 0.0f, 1.0f );
@@ -717,65 +697,52 @@ static void FormatStatePacketUntilGyro( SteamControllerStateInternal_t *pState,
pState->ulButtons &= ~0xFFFF000000LL;
// The firmware uses this bit to tell us what kind of data is packed into the left two axises
- if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_FINGERDOWN_MASK)
- {
+ if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_FINGERDOWN_MASK) {
// Finger-down bit not set; "left pad" is actually trackpad
pState->sLeftPadX = pState->sPrevLeftPad[0] = pStatePacket->sLeftPadX;
pState->sLeftPadY = pState->sPrevLeftPad[1] = pStatePacket->sLeftPadY;
- if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK)
- {
+ if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK) {
// The controller is interleaving both stick and pad data, both are active
pState->sLeftStickX = pState->sPrevLeftStick[0];
pState->sLeftStickY = pState->sPrevLeftStick[1];
- }
- else
- {
+ } else {
// The stick is not active
pState->sPrevLeftStick[0] = 0;
pState->sPrevLeftStick[1] = 0;
}
- }
- else
- {
+ } else {
// Finger-down bit not set; "left pad" is actually joystick
// XXX there's a firmware bug where sometimes padX is 0 and padY is a large number (acutally the battery voltage)
// If that happens skip this packet and report last frames stick
/*
- if ( m_eControllerType == k_eControllerType_SteamControllerV2 && pStatePacket->sLeftPadY > 900 )
- {
+ if ( m_eControllerType == k_eControllerType_SteamControllerV2 && pStatePacket->sLeftPadY > 900 ) {
pState->sLeftStickX = pState->sPrevLeftStick[0];
pState->sLeftStickY = pState->sPrevLeftStick[1];
- }
- else
+ } else
*/
{
pState->sPrevLeftStick[0] = pState->sLeftStickX = pStatePacket->sLeftPadX;
pState->sPrevLeftStick[1] = pState->sLeftStickY = pStatePacket->sLeftPadY;
}
/*
- if (m_eControllerType == k_eControllerType_SteamControllerV2)
- {
+ if (m_eControllerType == k_eControllerType_SteamControllerV2) {
UpdateV2JoystickCap(&state);
}
*/
- if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK)
- {
+ if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK) {
// The controller is interleaving both stick and pad data, both are active
pState->sLeftPadX = pState->sPrevLeftPad[0];
pState->sLeftPadY = pState->sPrevLeftPad[1];
- }
- else
- {
+ } else {
// The trackpad is not active
pState->sPrevLeftPad[0] = 0;
pState->sPrevLeftPad[1] = 0;
// Old controllers send trackpad click for joystick button when trackpad is not active
- if (pState->ulButtons & STEAM_BUTTON_LEFTPAD_CLICKED_MASK)
- {
+ if (pState->ulButtons & STEAM_BUTTON_LEFTPAD_CLICKED_MASK) {
pState->ulButtons &= ~STEAM_BUTTON_LEFTPAD_CLICKED_MASK;
pState->ulButtons |= STEAM_JOYSTICK_BUTTON_MASK;
}
@@ -784,8 +751,9 @@ static void FormatStatePacketUntilGyro( SteamControllerStateInternal_t *pState,
// Fingerdown bit indicates if the packed left axis data was joystick or pad,
// but if we are interleaving both, the left finger is definitely on the pad.
- if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK)
+ if (pStatePacket->ButtonTriggerData.ulButtons & STEAM_LEFTPAD_AND_JOYSTICK_MASK) {
pState->ulButtons |= STEAM_LEFTPAD_FINGERDOWN_MASK;
+ }
pState->sRightPadX = pStatePacket->sRightPadX;
pState->sRightPadY = pStatePacket->sRightPadY;
@@ -831,35 +799,30 @@ static bool UpdateBLESteamControllerState( const uint8_t *pData, int nDataSize,
pState->unPacketNum++;
ucOptionDataMask = ( *pData++ & 0xF0 );
ucOptionDataMask |= (uint32_t)(*pData++) << 8;
- if ( ucOptionDataMask & k_EBLEButtonChunk1 )
- {
+ if ( ucOptionDataMask & k_EBLEButtonChunk1 ) {
SDL_memcpy( &pState->ulButtons, pData, 3 );
pData += 3;
}
- if ( ucOptionDataMask & k_EBLEButtonChunk2 )
- {
+ if ( ucOptionDataMask & k_EBLEButtonChunk2 ) {
// The middle 2 bytes of the button bits over the wire are triggers when over the wire and non-SC buttons in the internal controller state packet
pState->sTriggerL = (unsigned short)RemapValClamped( (float)(( pData[ 0 ] << 7 ) | pData[ 0 ]), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 );
pState->sTriggerR = (unsigned short)RemapValClamped( (float)(( pData[ 1 ] << 7 ) | pData[ 1 ]), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16 );
pData += 2;
}
- if ( ucOptionDataMask & k_EBLEButtonChunk3 )
- {
+ if ( ucOptionDataMask & k_EBLEButtonChunk3 ) {
uint8_t *pButtonByte = (uint8_t *)&pState->ulButtons;
pButtonByte[ 5 ] = *pData++;
pButtonByte[ 6 ] = *pData++;
pButtonByte[ 7 ] = *pData++;
}
- if ( ucOptionDataMask & k_EBLELeftJoystickChunk )
- {
+ if ( ucOptionDataMask & k_EBLELeftJoystickChunk ) {
// This doesn't handle any of the special headcrab stuff for raw joystick which is OK for now since that FW doesn't support
// this protocol yet either
int nLength = sizeof( pState->sLeftStickX ) + sizeof( pState->sLeftStickY );
SDL_memcpy( &pState->sLeftStickX, pData, nLength );
pData += nLength;
}
- if ( ucOptionDataMask & k_EBLELeftTrackpadChunk )
- {
+ if ( ucOptionDataMask & k_EBLELeftTrackpadChunk ) {
int nLength = sizeof( pState->sLeftPadX ) + sizeof( pState->sLeftPadY );
int nPadOffset;
SDL_memcpy( &pState->sLeftPadX, pData, nLength );
@@ -873,8 +836,7 @@ static bool UpdateBLESteamControllerState( const uint8_t *pData, int nDataSize,
pState->sLeftPadY = clamp( pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16 );
pData += nLength;
}
- if ( ucOptionDataMask & k_EBLERightTrackpadChunk )
- {
+ if ( ucOptionDataMask & k_EBLERightTrackpadChunk ) {
int nLength = sizeof( pState->sRightPadX ) + sizeof( pState->sRightPadY );
int nPadOffset = 0;
@@ -890,20 +852,17 @@ static bool UpdateBLESteamControllerState( const uint8_t *pData, int nDataSize,
pState->sRightPadY = clamp( pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16 );
pData += nLength;
}
- if ( ucOptionDataMask & k_EBLEIMUAccelChunk )
- {
+ if ( ucOptionDataMask & k_EBLEIMUAccelChunk ) {
int nLength = sizeof( pState->sAccelX ) + sizeof( pState->sAccelY ) + sizeof( pState->sAccelZ );
SDL_memcpy( &pState->sAccelX, pData, nLength );
pData += nLength;
}
- if ( ucOptionDataMask & k_EBLEIMUGyroChunk )
- {
+ if ( ucOptionDataMask & k_EBLEIMUGyroChunk ) {
int nLength = sizeof( pState->sAccelX ) + sizeof( pState->sAccelY ) + sizeof( pState->sAccelZ );
SDL_memcpy( &pState->sGyroX, pData, nLength );
pData += nLength;
}
- if ( ucOptionDataMask & k_EBLEIMUQuatChunk )
- {
+ if ( ucOptionDataMask & k_EBLEIMUQuatChunk ) {
int nLength = sizeof( pState->sGyroQuatW ) + sizeof( pState->sGyroQuatX ) + sizeof( pState->sGyroQuatY ) + sizeof( pState->sGyroQuatZ );
SDL_memcpy( &pState->sGyroQuatW, pData, nLength );
pData += nLength;
@@ -919,10 +878,8 @@ static bool UpdateSteamControllerState( const uint8_t *pData, int nDataSize, Ste
{
ValveInReport_t *pInReport = (ValveInReport_t*)pData;
- if ( pInReport->header.unReportVersion != k_ValveInReportMsgVersion )
- {
- if ( ( pData[ 0 ] & 0x0F ) == k_EBLEReportState )
- {
+ if ( pInReport->header.unReportVersion != k_ValveInReportMsgVersion ) {
+ if ( ( pData[ 0 ] & 0x0F ) == k_EBLEReportState ) {
return UpdateBLESteamControllerState( pData, nDataSize, pState );
}
return false;
@@ -934,13 +891,13 @@ static bool UpdateSteamControllerState( const uint8_t *pData, int nDataSize, Ste
return false;
}
- if ( pInReport->header.ucType == ID_CONTROLLER_STATE )
- {
+ if ( pInReport->header.ucType == ID_CONTROLLER_STATE ) {
ValveControllerStatePacket_t *pStatePacket = &pInReport->payload.controllerState;
// No new data to process; indicate that we received a state packet, but otherwise do nothing.
- if ( pState->unPacketNum == pStatePacket->unPacketNum )
+ if (pState->unPacketNum == pStatePacket->unPacketNum) {
return true;
+ }
FormatStatePacketUntilGyro( pState, pStatePacket );
@@ -957,15 +914,14 @@ static bool UpdateSteamControllerState( const uint8_t *pData, int nDataSize, Ste
pState->sGyroY = pStatePacket->sGyroY;
pState->sGyroZ = pStatePacket->sGyroZ;
- }
- else if ( pInReport->header.ucType == ID_CONTROLLER_BLE_STATE )
- {
+ } else if ( pInReport->header.ucType == ID_CONTROLLER_BLE_STATE ) {
ValveControllerBLEStatePacket_t *pBLEStatePacket = &pInReport->payload.controllerBLEState;
ValveControllerStatePacket_t *pStatePacket = &pInReport->payload.controllerState;
// No new data to process; indicate that we received a state packet, but otherwise do nothing.
- if ( pState->unPacketNum == pStatePacket->unPacketNum )
+ if (pState->unPacketNum == pStatePacket->unPacketNum) {
return true;
+ }
FormatStatePacketUntilGyro( pState, pStatePacket );
@@ -1041,7 +997,7 @@ HIDAPI_DriverSteam_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverSteam_Context *ctx;
ctx = (SDL_DriverSteam_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -1171,8 +1127,7 @@ HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
return SDL_FALSE;
}
- for (;;)
- {
+ for (;;) {
uint8_t data[128];
int r, nPacketLength;
const Uint8 *pPacket;
@@ -1182,7 +1137,7 @@ HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
break;
}
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c
index 901761f..aedb66a 100644
--- a/src/joystick/hidapi/SDL_hidapi_switch.c
+++ b/src/joystick/hidapi/SDL_hidapi_switch.c
@@ -400,9 +400,9 @@ static SDL_bool WritePacket(SDL_DriverSwitch_Context *ctx, void *pBuf, Uint8 ucL
ucLen = (Uint8)unWriteSize;
}
if (ctx->m_bSyncWrite) {
- return (SDL_hid_write(ctx->device->dev, (Uint8 *)pBuf, ucLen) >= 0);
+ return SDL_hid_write(ctx->device->dev, (Uint8 *)pBuf, ucLen) >= 0;
} else {
- return (WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0);
+ return WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0;
}
}
@@ -411,7 +411,7 @@ static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommand
SwitchSubcommandInputPacket_t *reply = NULL;
int nTries;
- for (nTries = 1; !reply && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
+ for (nTries = 1; reply == NULL && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
SwitchSubcommandOutputPacket_t commandPacket;
ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket);
@@ -435,7 +435,7 @@ static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprieta
for (nTries = 1; nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
SwitchProprietaryOutputPacket_t packet;
- if ((!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) {
+ if ((pBuf == NULL && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) {
return SDL_FALSE;
}
@@ -596,8 +596,9 @@ static SDL_bool BReadDeviceInfo(SDL_DriverSwitch_Context *ctx)
ctx->m_eControllerType = CalculateControllerType(ctx, (ESwitchDeviceInfoControllerType)status->ucDeviceType);
- for (i = 0; i < sizeof (ctx->m_rgucMACAddress); ++i)
- ctx->m_rgucMACAddress[i] = status->rgucMACAddress[ sizeof(ctx->m_rgucMACAddress) - i - 1 ];
+ for (i = 0; i < sizeof(ctx->m_rgucMACAddress); ++i) {
+ ctx->m_rgucMACAddress[i] = status->rgucMACAddress[sizeof(ctx->m_rgucMACAddress) - i - 1];
+ }
return SDL_TRUE;
}
@@ -776,14 +777,14 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx, Uint8 input_
}
for (stick = 0; stick < 2; ++stick) {
- for(axis = 0; axis < 2; ++axis) {
+ for (axis = 0; axis < 2; ++axis) {
ctx->m_StickExtents[stick].axis[axis].sMin = -(Sint16)(ctx->m_StickCalData[stick].axis[axis].sMin * 0.7f);
ctx->m_StickExtents[stick].axis[axis].sMax = (Sint16)(ctx->m_StickCalData[stick].axis[axis].sMax * 0.7f);
}
}
for (stick = 0; stick < 2; ++stick) {
- for(axis = 0; axis < 2; ++axis) {
+ for (axis = 0; axis < 2; ++axis) {
ctx->m_SimpleStickExtents[stick].axis[axis].sMin = (Sint16)(SDL_MIN_SINT16 * 0.5f);
ctx->m_SimpleStickExtents[stick].axis[axis].sMax = (Sint16)(SDL_MAX_SINT16 * 0.5f);
}
@@ -869,7 +870,8 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
}
- return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
+ return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax,
+ SDL_MIN_SINT16, SDL_MAX_SINT16);
}
static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)
@@ -886,7 +888,8 @@ static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nSt
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
}
- return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
+ return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax,
+ SDL_MIN_SINT16, SDL_MAX_SINT16);
}
static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
@@ -1051,9 +1054,7 @@ HIDAPI_DriverNintendoClassic_UnregisterHints(SDL_HintCallback callback, void *us
static SDL_bool
HIDAPI_DriverNintendoClassic_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -1097,9 +1098,7 @@ HIDAPI_DriverJoyCons_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverJoyCons_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -1139,9 +1138,7 @@ HIDAPI_DriverSwitch_UnregisterHints(SDL_HintCallback callback, void *userdata)
static SDL_bool
HIDAPI_DriverSwitch_IsEnabled(void)
{
- return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT));
+ return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool
@@ -1232,7 +1229,7 @@ HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverSwitch_Context *ctx;
ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -2142,7 +2139,7 @@ HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
++packet_count;
ctx->m_unLastInput = now;
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -2201,7 +2198,7 @@ HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c
index 3b4e794..3149f27 100644
--- a/src/joystick/hidapi/SDL_hidapi_wii.c
+++ b/src/joystick/hidapi/SDL_hidapi_wii.c
@@ -216,13 +216,13 @@ static SDL_bool WriteOutput(SDL_DriverWii_Context *ctx, const Uint8 *data, int s
}
#endif
if (sync) {
- return (SDL_hid_write(ctx->device->dev, data, size) >= 0);
+ return SDL_hid_write(ctx->device->dev, data, size) >= 0;
} else {
/* Use the rumble thread for general asynchronous writes */
if (SDL_HIDAPI_LockRumble() < 0) {
return SDL_FALSE;
}
- return (SDL_HIDAPI_SendRumbleAndUnlock(ctx->device, data, size) >= 0);
+ return SDL_HIDAPI_SendRumbleAndUnlock(ctx->device, data, size) >= 0;
}
}
@@ -234,7 +234,7 @@ static SDL_bool ReadInputSync(SDL_DriverWii_Context *ctx, EWiiInputReportIDs exp
int nRead = 0;
while ((nRead = ReadInput(ctx)) != -1) {
if (nRead > 0) {
- if (ctx->m_rgucReadBuffer[0] == expectedID && (!isMine || isMine(ctx->m_rgucReadBuffer))) {
+ if (ctx->m_rgucReadBuffer[0] == expectedID && (isMine == NULL || isMine(ctx->m_rgucReadBuffer))) {
return SDL_TRUE;
}
} else {
@@ -734,7 +734,7 @@ HIDAPI_DriverWii_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverWii_Context *ctx;
ctx = (SDL_DriverWii_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -1529,7 +1529,7 @@ HIDAPI_DriverWii_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c
index 191ccb9..ddc53a3 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c
@@ -64,9 +64,7 @@ static SDL_bool
HIDAPI_DriverXbox360_IsEnabled(void)
{
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_360,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT)));
+ SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)));
}
static SDL_bool
@@ -149,7 +147,7 @@ HIDAPI_DriverXbox360_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverXbox360_Context *ctx;
ctx = (SDL_DriverXbox360_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -347,7 +345,7 @@ HIDAPI_DriverXbox360_UpdateDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_XBOX_PROTOCOL
HIDAPI_DumpPacket("Xbox 360 packet: size = %d", data, size);
#endif
- if (!joystick) {
+ if (joystick == NULL) {
continue;
}
@@ -360,7 +358,7 @@ HIDAPI_DriverXbox360_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
index f0a1d29..5c1d8bd 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
@@ -67,10 +67,7 @@ static SDL_bool
HIDAPI_DriverXbox360W_IsEnabled(void)
{
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_360,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT))));
+ SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_360, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT))));
}
static SDL_bool
@@ -146,7 +143,7 @@ HIDAPI_DriverXbox360W_InitDevice(SDL_HIDAPI_Device *device)
HIDAPI_SetDeviceName(device, "Xbox 360 Wireless Controller");
ctx = (SDL_DriverXbox360W_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -175,7 +172,7 @@ HIDAPI_DriverXbox360W_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_Joysti
{
SDL_DriverXbox360W_Context *ctx = (SDL_DriverXbox360W_Context *)device->context;
- if (!ctx) {
+ if (ctx == NULL) {
return;
}
@@ -360,7 +357,7 @@ HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index 1a5798e..3c1e00e 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -140,7 +140,7 @@ typedef struct {
static SDL_bool
ControllerHasColorLED(Uint16 vendor_id, Uint16 product_id)
{
- return (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2);
+ return vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2;
}
static SDL_bool
@@ -357,9 +357,7 @@ static SDL_bool
HIDAPI_DriverXboxOne_IsEnabled(void)
{
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX,
- SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
- SDL_HIDAPI_DEFAULT)));
+ SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)));
}
static SDL_bool
@@ -380,7 +378,7 @@ HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverXboxOne_Context *ctx;
ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -1105,7 +1103,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
if (ctx->bluetooth) {
switch (data[0]) {
case 0x01:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
if (size >= 16) {
@@ -1117,13 +1115,13 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
}
break;
case 0x02:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
HIDAPI_DriverXboxOneBluetooth_HandleGuidePacket(joystick, ctx, data, size);
break;
case 0x04:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
HIDAPI_DriverXboxOneBluetooth_HandleBatteryPacket(joystick, ctx, data, size);
@@ -1171,7 +1169,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
break;
case 0x03:
/* Controller status update */
- if (!joystick) {
+ if (joystick == NULL) {
/* We actually want to handle this packet any time it arrives */
/*break;*/
}
@@ -1184,7 +1182,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
/* Unknown chatty controller information, sent by both sides */
break;
case 0x07:
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
HIDAPI_DriverXboxOne_HandleModePacket(joystick, ctx, data, size);
@@ -1199,7 +1197,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
The controller sends that in response to this request:
0x1E 0x30 0x07 0x01 0x04
*/
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
#ifdef SET_SERIAL_AFTER_OPEN
@@ -1218,7 +1216,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
#endif
break;
}
- if (!joystick) {
+ if (joystick == NULL) {
break;
}
HIDAPI_DriverXboxOne_HandleStatePacket(joystick, ctx, data, size);
@@ -1253,7 +1251,7 @@ HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
/* Read error, device is disconnected */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
}
- return (size >= 0);
+ return size >= 0;
}
static void
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 2ed4aee..ae3f2cc 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -394,7 +394,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
for (curr = SDL_HIDAPI_devices; curr && curr != device; curr = curr->next) {
continue;
}
- if (!curr) {
+ if (curr == NULL) {
*removed = SDL_TRUE;
if (dev) {
SDL_hid_close(dev);
@@ -402,7 +402,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
return;
}
- if (!dev) {
+ if (dev == NULL) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
"HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n",
device->path, SDL_GetError());
@@ -518,7 +518,7 @@ static SDL_bool
HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
{
SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1)*sizeof(*device->joysticks));
- if (!joysticks) {
+ if (joysticks == NULL) {
return SDL_FALSE;
}
@@ -588,7 +588,7 @@ HIDAPI_HasConnectedUSBDevice(const char *serial)
{
SDL_HIDAPI_Device *device;
- if (!serial) {
+ if (serial == NULL) {
return SDL_FALSE;
}
@@ -613,7 +613,7 @@ HIDAPI_DisconnectBluetoothDevice(const char *serial)
{
SDL_HIDAPI_Device *device;
- if (!serial) {
+ if (serial == NULL) {
return;
}
@@ -718,7 +718,7 @@ HIDAPI_ConvertString(const wchar_t *wide_string)
if (wide_string) {
string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
- if (!string) {
+ if (string == NULL) {
switch (sizeof(wchar_t)) {
case 2:
string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
@@ -744,7 +744,7 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H
}
device = (SDL_HIDAPI_Device *)SDL_calloc(1, sizeof(*device));
- if (!device) {
+ if (device == NULL) {
return NULL;
}
device->path = SDL_strdup(info->path);
@@ -908,7 +908,7 @@ HIDAPI_CreateCombinedJoyCons()
if (joycons[0] && joycons[1]) {
SDL_hid_device_info info;
SDL_HIDAPI_Device **children = (SDL_HIDAPI_Device **)SDL_malloc(2 * sizeof(SDL_HIDAPI_Device *));
- if (!children) {
+ if (children == NULL) {
return SDL_FALSE;
}
children[0] = joycons[0];
@@ -1300,13 +1300,13 @@ HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID);
struct joystick_hwdata *hwdata;
- if (!device || !device->driver) {
+ if (device == NULL || !device->driver) {
/* This should never happen - validated before being called */
return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index);
}
hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata));
- if (!hwdata) {
+ if (hwdata == NULL) {
return SDL_OutOfMemory();
}
hwdata->device = device;
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index 5d3a994..a03401b 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -177,7 +177,7 @@ GuessIsJoystick(int fd)
(ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
(ioctl(fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) < 0) ||
(ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) < 0)) {
- return (0);
+ return 0;
}
devclass = SDL_EVDEV_GuessDeviceClass(evbit, absbit, keybit, relbit);
@@ -217,7 +217,7 @@ IsJoystick(const char *path, int fd, char **name_return, SDL_JoystickGUID *guid)
}
name = SDL_CreateJoystickName(inpid.vendor, inpid.product, NULL, product_string);
- if (!name) {
+ if (name == NULL) {
return 0;
}
@@ -489,7 +489,7 @@ static void SteamControllerDisconnectedCallback(int device_instance)
static int
StrHasPrefix(const char *string, const char *prefix)
{
- return (SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0);
+ return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0;
}
static int
@@ -517,7 +517,7 @@ IsJoystickJSNode(const char *node)
if (last_slash) {
node = last_slash + 1;
}
- return (StrHasPrefix(node, "js") && StrIsInteger(node + 2));
+ return StrHasPrefix(node, "js") && StrIsInteger(node + 2);
}
static SDL_bool
@@ -527,7 +527,7 @@ IsJoystickEventNode(const char *node)
if (last_slash) {
node = last_slash + 1;
}
- return (StrHasPrefix(node, "event") && StrIsInteger(node + 5));
+ return StrHasPrefix(node, "event") && StrIsInteger(node + 5);
}
static SDL_bool
@@ -548,7 +548,9 @@ static int SDL_inotify_init1(void) {
#else
static int SDL_inotify_init1(void) {
int fd = inotify_init();
- if (fd < 0) return -1;
+ if (fd < 0) {
+ return -1;
+ }
fcntl(fd, F_SETFL, O_NONBLOCK);
fcntl(fd, F_SETFD, FD_CLOEXEC);
return fd;
@@ -582,8 +584,7 @@ LINUX_InotifyJoystickDetect(void)
if (buf.event.mask & (IN_CREATE | IN_MOVED_TO | IN_ATTRIB)) {
MaybeAddDevice(path);
- }
- else if (buf.event.mask & (IN_DELETE | IN_MOVED_FROM)) {
+ } else if (buf.event.mask & (IN_DELETE | IN_MOVED_FROM)) {
MaybeRemoveDevice(path);
}
}
@@ -659,7 +660,7 @@ sort_entries(const void *_a, const void *_b)
}
}
}
- return (numA - numB);
+ return numA - numB;
}
static void
@@ -702,14 +703,12 @@ LINUX_JoystickDetect(void)
#if SDL_USE_LIBUDEV
if (enumeration_method == ENUMERATION_LIBUDEV) {
SDL_UDEV_Poll();
- }
- else
+ } else
#endif
#ifdef HAVE_INOTIFY
if (inotify_fd >= 0 && last_joy_detect_time != 0) {
LINUX_InotifyJoystickDetect();
- }
- else
+ } else
#endif
{
LINUX_FallbackJoystickDetect();
@@ -786,8 +785,7 @@ LINUX_JoystickInit(void)
/* Force a scan to build the initial device list */
SDL_UDEV_Scan();
- }
- else
+ } else
#endif
{
#if defined(HAVE_INOTIFY)
@@ -887,13 +885,13 @@ allocate_hatdata(SDL_Joystick *joystick)
(struct hwdata_hat *) SDL_malloc(joystick->nhats *
sizeof(struct hwdata_hat));
if (joystick->hwdata->hats == NULL) {
- return (-1);
+ return -1;
}
for (i = 0; i < joystick->nhats; ++i) {
joystick->hwdata->hats[i].axis[0] = 1;
joystick->hwdata->hats[i].axis[1] = 1;
}
- return (0);
+ return 0;
}
static int
@@ -905,13 +903,13 @@ allocate_balldata(SDL_Joystick *joystick)
(struct hwdata_ball *) SDL_malloc(joystick->nballs *
sizeof(struct hwdata_ball));
if (joystick->hwdata->balls == NULL) {
- return (-1);
+ return -1;
}
for (i = 0; i < joystick->nballs; ++i) {
joystick->hwdata->balls[i].axis[0] = 0;
joystick->hwdata->balls[i].axis[1] = 0;
}
- return (0);
+ return 0;
}
static SDL_bool
@@ -924,22 +922,24 @@ GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct input_absinfo *
* other continuous analog axis, so we have to guess. */
/* If both axes are missing, they're not anything. */
- if (!absinfo_x && !absinfo_y)
+ if (absinfo_x == NULL && absinfo_y == NULL) {
return SDL_FALSE;
+ }
/* If the hint says so, treat all hats as digital. */
- if (SDL_GetHintBoolean(SDL_HINT_LINUX_DIGITAL_HATS, SDL_FALSE))
+ if (SDL_GetHintBoolean(SDL_HINT_LINUX_DIGITAL_HATS, SDL_FALSE)) {
return SDL_TRUE;
+ }
/* If both axes have ranges constrained between -1 and 1, they're definitely digital. */
- if ((!absinfo_x || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) &&
- (!absinfo_y || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1)))
+ if ((absinfo_x == NULL || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) && (absinfo_y == NULL || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1))) {
return SDL_TRUE;
+ }
/* If both axes lack fuzz, flat, and resolution values, they're probably digital. */
- if ((!absinfo_x || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) &&
- (!absinfo_y || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution)))
+ if ((absinfo_x == NULL || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) && (absinfo_y == NULL || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution))) {
return SDL_TRUE;
+ }
/* Otherwise, treat them as analog. */
return SDL_FALSE;
@@ -988,10 +988,12 @@ ConfigJoystick(SDL_Joystick *joystick, int fd)
int hat_y = -1;
struct input_absinfo absinfo_x;
struct input_absinfo absinfo_y;
- if (test_bit(i, absbit))
+ if (test_bit(i, absbit)) {
hat_x = ioctl(fd, EVIOCGABS(i), &absinfo_x);
- if (test_bit(i + 1, absbit))
+ }
+ if (test_bit(i + 1, absbit)) {
hat_y = ioctl(fd, EVIOCGABS(i + 1), &absinfo_y);
+ }
if (GuessIfAxesAreDigitalHat((hat_x < 0 ? (void*)0 : &absinfo_x),
(hat_y < 0 ? (void*)0 : &absinfo_y))) {
const int hat_index = (i - ABS_HAT0X) / 2;
diff --git a/src/joystick/n3ds/SDL_sysjoystick.c b/src/joystick/n3ds/SDL_sysjoystick.c
index 933f64e..848bef3 100644
--- a/src/joystick/n3ds/SDL_sysjoystick.c
+++ b/src/joystick/n3ds/SDL_sysjoystick.c
@@ -195,7 +195,7 @@ static SDL_bool
N3DS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
{
/* There is only one possible mapping. */
- *out = (SDL_GamepadMapping){
+ *out = (SDL_GamepadMapping) {
.a = { EMappingKind_Button, 0 },
.b = { EMappingKind_Button, 1 },
.x = { EMappingKind_Button, 10 },
diff --git a/src/joystick/ps2/SDL_sysjoystick.c b/src/joystick/ps2/SDL_sysjoystick.c
index 3847d79..d86f972 100644
--- a/src/joystick/ps2/SDL_sysjoystick.c
+++ b/src/joystick/ps2/SDL_sysjoystick.c
@@ -60,8 +60,9 @@ static struct JoyInfo joyInfo[MAX_CONTROLLERS];
static inline int16_t convert_u8_to_s16(uint8_t val)
{
- if (val == 0)
+ if (val == 0) {
return -0x7fff;
+ }
return val * 0x0101 - 0x8000;
}
@@ -95,11 +96,13 @@ static int PS2_JoystickInit(void)
uint32_t port = 0;
uint32_t slot = 0;
- if(init_joystick_driver(true) < 0)
+ if (init_joystick_driver(true) < 0) {
return -1;
+ }
- for (port = 0; port < PS2_MAX_PORT; port++)
+ for (port = 0; port < PS2_MAX_PORT; port++) {
mtapPortOpen(port);
+ }
/* it can fail - we dont care, we will check it more strictly when padPortOpen */
for (slot = 0; slot < PS2_MAX_SLOT; slot++) {
@@ -116,7 +119,7 @@ static int PS2_JoystickInit(void)
*/
struct JoyInfo *info = &joyInfo[enabled_pads];
- if(padPortOpen(port, slot, (void *)info->padBuf) > 0) {
+ if (padPortOpen(port, slot, (void *)info->padBuf) > 0) {
info->port = (uint8_t)port;
info->slot = (uint8_t)slot;
info->opened = 1;
@@ -142,8 +145,9 @@ static void PS2_JoystickDetect()
/* Function to get the device-dependent name of a joystick */
static const char *PS2_JoystickGetDeviceName(int index)
{
- if (index >= 0 && index < enabled_pads)
+ if (index >= 0 && index < enabled_pads) {
return "PS2 Controller";
+ }
SDL_SetError("No joystick available with that index");
return NULL;
@@ -285,8 +289,9 @@ static void PS2_JoystickUpdate(SDL_Joystick *joystick)
mask = (1 << i);
previous = info->btns & mask;
current = pressed_buttons & mask;
- if (previous != current)
+ if (previous != current) {
SDL_PrivateJoystickButton(joystick, i, current ? SDL_PRESSED : SDL_RELEASED);
+ }
}
}
info->btns = pressed_buttons;
@@ -300,8 +305,9 @@ static void PS2_JoystickUpdate(SDL_Joystick *joystick)
for (i = 0; i < PS2_TOTAL_AXIS; i++) {
previous_axis = info->analog_state[i];
current_axis = all_axis[i];
- if (previous_axis != current_axis)
+ if (previous_axis != current_axis) {
SDL_PrivateJoystickAxis(joystick, i, convert_u8_to_s16(current_axis));
+ }
info->analog_state[i] = current_axis;
}
diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c
index 06c0f28..ab8490b 100644
--- a/src/joystick/psp/SDL_sysjoystick.c
+++ b/src/joystick/psp/SDL_sysjoystick.c
@@ -89,8 +89,7 @@ static int PSP_JoystickInit(void)
/* Create an accurate map from analog inputs (0 to 255)
to SDL joystick positions (-32768 to 32767) */
- for (i = 0; i < 128; i++)
- {
+ for (i = 0; i < 128; i++) {
float t = (float)i/127.0f;
analog_map[i+128] = calc_bezier_y(t);
analog_map[127-i] = -1 * analog_map[i+128];
@@ -111,11 +110,12 @@ static void PSP_JoystickDetect(void)
/* Function to get the device-dependent name of a joystick */
static const char *PSP_JoystickGetDeviceName(int device_index)
{
- if (device_index == 0)
+ if (device_index == 0) {
return "PSP builtin joypad";
+ }
SDL_SetError("No joystick available with that index");
- return(NULL);
+ return NULL;
}
static const char *PSP_JoystickGetDevicePath(int index)
@@ -210,11 +210,11 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick)
y = pad.Ly;
/* Axes */
- if(old_x != x) {
+ if (old_x != x) {
SDL_PrivateJoystickAxis(joystick, 0, analog_map[x]);
old_x = x;
}
- if(old_y != y) {
+ if (old_y != y) {
SDL_PrivateJoystickAxis(joystick, 1, analog_map[y]);
old_y = y;
}
@@ -222,7 +222,7 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick)
/* Buttons */
changed = old_buttons ^ buttons;
old_buttons = buttons;
- if(changed) {
+ if (changed) {
for (i = 0; i < SDL_arraysize(button_map); i++) {
if (changed & button_map[i]) {
SDL_PrivateJoystickButton(
diff --git a/src/joystick/virtual/SDL_virtualjoystick.c b/src/joystick/virtual/SDL_virtualjoystick.c
index 9a6d943..ef31709 100644
--- a/src/joystick/virtual/SDL_virtualjoystick.c
+++ b/src/joystick/virtual/SDL_virtualjoystick.c
@@ -38,8 +38,9 @@ VIRTUAL_HWDataForIndex(int device_index)
{
joystick_hwdata *vjoy = g_VJoys;
while (vjoy) {
- if (device_index == 0)
+ if (device_index == 0) {
break;
+ }
--device_index;
vjoy = vjoy->next;
}
@@ -53,7 +54,7 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
joystick_hwdata * cur = g_VJoys;
joystick_hwdata * prev = NULL;
- if (!hwdata) {
+ if (hwdata == NULL) {
return;
}
@@ -104,7 +105,7 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
int axis_triggerleft = -1;
int axis_triggerright = -1;
- if (!desc) {
+ if (desc == NULL) {
return SDL_InvalidParamError("desc");
}
if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) {
@@ -113,7 +114,7 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
}
hwdata = SDL_calloc(1, sizeof(joystick_hwdata));
- if (!hwdata) {
+ if (hwdata == NULL) {
VIRTUAL_FreeHWData(hwdata);
return SDL_OutOfMemory();
}
@@ -253,7 +254,7 @@ SDL_JoystickDetachVirtualInner(int device_index)
{
SDL_JoystickID instance_id;
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
- if (!hwdata) {
+ if (hwdata == NULL) {
return SDL_SetError("Virtual joystick data not found");
}
instance_id = hwdata->instance_id;
@@ -270,7 +271,7 @@ SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 value)
SDL_LockJoysticks();
- if (!joystick || !joystick->hwdata) {
+ if (joystick == NULL || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@@ -295,7 +296,7 @@ SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 valu
SDL_LockJoysticks();
- if (!joystick || !joystick->hwdata) {
+ if (joystick == NULL || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@@ -320,7 +321,7 @@ SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value)
SDL_LockJoysticks();
- if (!joystick || !joystick->hwdata) {
+ if (joystick == NULL || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@@ -368,7 +369,7 @@ static const char *
VIRTUAL_JoystickGetDeviceName(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
- if (!hwdata) {
+ if (hwdata == NULL) {
return NULL;
}
return hwdata->name;
@@ -404,7 +405,7 @@ static SDL_JoystickGUID
VIRTUAL_JoystickGetDeviceGUID(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
- if (!hwdata) {
+ if (hwdata == NULL) {
SDL_JoystickGUID guid;
SDL_zero(guid);
return guid;
@@ -417,7 +418,7 @@ static SDL_JoystickID
VIRTUAL_JoystickGetDeviceInstanceID(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
- if (!hwdata) {
+ if (hwdata == NULL) {
return -1;
}
return hwdata->instance_id;
@@ -428,7 +429,7 @@ static int
VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
- if (!hwdata) {
+ if (hwdata == NULL) {
return SDL_SetError("No such device");
}
joystick->instance_id = hwdata->instance_id;
@@ -552,7 +553,7 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
joystick_hwdata *hwdata;
int i;
- if (!joystick) {
+ if (joystick == NULL) {
return;
}
if (!joystick->hwdata) {
diff --git a/src/joystick/vita/SDL_sysjoystick.c b/src/joystick/vita/SDL_sysjoystick.c
index 994655f..c5dc862 100644
--- a/src/joystick/vita/SDL_sysjoystick.c
+++ b/src/joystick/vita/SDL_sysjoystick.c
@@ -118,8 +118,7 @@ int VITA_JoystickInit(void)
/* Create an accurate map from analog inputs (0 to 255)
to SDL joystick positions (-32768 to 32767) */
- for (i = 0; i < 128; i++)
- {
+ for (i = 0; i < 128; i++) {
float t = (float)i/127.0f;
analog_map[i+128] = calc_bezier_y(t);
analog_map[127-i] = -1 * analog_map[i+128];
@@ -137,10 +136,8 @@ int VITA_JoystickInit(void)
// On Vita TV, port 0 and 1 are the same controller
// and that is the first one, so start at port 2
- for (i=2; i<=4; i++)
- {
- if (myPortInfo.port[i]!=SCE_CTRL_TYPE_UNPAIRED)
- {
+ for (i=2; i<=4; i++) {
+ if (myPortInfo.port[i]!=SCE_CTRL_TYPE_UNPAIRED) {
SDL_PrivateJoystickAdded(SDL_numjoysticks);
SDL_numjoysticks++;
}
@@ -165,17 +162,21 @@ SDL_JoystickID VITA_JoystickGetDeviceInstanceID(int device_index)
const char *VITA_JoystickGetDeviceName(int index)
{
- if (index == 0)
+ if (index == 0) {
return "PSVita Controller";
+ }
- if (index == 1)
+ if (index == 1) {
return "PSVita Controller";
+ }
- if (index == 2)
+ if (index == 2) {
return "PSVita Controller";
+ }
- if (index == 3)
+ if (index == 3) {
return "PSVita Controller";
+ }
SDL_SetError("No joystick available with that index");
return NULL;
diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index 9c5a46b..1b6cc94 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -272,7 +272,7 @@ QueryDeviceName(LPDIRECTINPUTDEVICE8 device, char** device_name)
{
DIPROPSTRING dipstr;
- if (!device || !device_name) {
+ if (!device || device_name == NULL) {
return SDL_FALSE;
}
@@ -295,7 +295,7 @@ QueryDevicePath(LPDIRECTINPUTDEVICE8 device, char** device_path)
{
DIPROPGUIDANDPATH dippath;
- if (!device || !device_path) {
+ if (!device || device_path == NULL) {
return SDL_FALSE;
}
@@ -321,7 +321,7 @@ QueryDeviceInfo(LPDIRECTINPUTDEVICE8 device, Uint16* vendor_id, Uint16* product_
{
DIPROPDWORD dipdw;
- if (!device || !vendor_id || !product_id) {
+ if (!device || vendor_id == NULL || product_id == NULL) {
return SDL_FALSE;
}
@@ -343,7 +343,7 @@ QueryDeviceInfo(LPDIRECTINPUTDEVICE8 device, Uint16* vendor_id, Uint16* product_
void FreeRumbleEffectData(DIEFFECT *effect)
{
- if (!effect) {
+ if (effect == NULL) {
return;
}
SDL_free(effect->rgdwAxes);
@@ -359,7 +359,7 @@ DIEFFECT *CreateRumbleEffectData(Sint16 magnitude)
/* Create the effect */
effect = (DIEFFECT *)SDL_calloc(1, sizeof(*effect));
- if (!effect) {
+ if (effect == NULL) {
return NULL;
}
effect->dwSize = sizeof(*effect);
@@ -383,7 +383,7 @@ DIEFFECT *CreateRumbleEffectData(Sint16 magnitude)
effect->dwFlags |= DIEFF_CARTESIAN;
periodic = (DIPERIODIC *)SDL_calloc(1, sizeof(*periodic));
- if (!periodic) {
+ if (periodic == NULL) {
FreeRumbleEffectData(effect);
return NULL;
}
@@ -443,7 +443,7 @@ SDL_DINPUT_JoystickInit(void)
static BOOL CALLBACK
EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
{
-#define CHECK(expression) { if(!(expression)) goto err; }
+#define CHECK(expression) { if (!(expression)) goto err; }
JoyStick_DeviceData *pNewJoystick = NULL;
JoyStick_DeviceData *pPrevJoystick = NULL;
Uint16 vendor = 0;
@@ -470,8 +470,7 @@ EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
/* if we are replacing the front of the list then update it */
if (pNewJoystick == *(JoyStick_DeviceData**)pContext) {
*(JoyStick_DeviceData**)pContext = pNewJoystick->pNext;
- }
- else if (pPrevJoystick) {
+ } else if (pPrevJoystick) {
pPrevJoystick->pNext = pNewJoystick->pNext;
}
@@ -556,7 +555,7 @@ typedef struct
static BOOL CALLBACK
EnumJoystickPresentCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
{
-#define CHECK(expression) { if(!(expression)) goto err; }
+#define CHECK(expression) { if (!(expression)) goto err; }
Joystick_PresentData *pData = (Joystick_PresentData *)pContext;
Uint16 vendor = 0;
Uint16 product = 0;
@@ -692,10 +691,12 @@ SortDevFunc(const void *a, const void *b)
const input_t *inputA = (const input_t*)a;
const input_t *inputB = (const input_t*)b;
- if (inputA->ofs < inputB->ofs)
+ if (inputA->ofs < inputB->ofs) {
return -1;
- if (inputA->ofs > inputB->ofs)
+ }
+ if (inputA->ofs > inputB->ofs) {
return 1;
+ }
return 0;
}
@@ -967,16 +968,18 @@ TranslatePOV(DWORD value)
SDL_HAT_UP | SDL_HAT_LEFT
};
- if (LOWORD(value) == 0xFFFF)
+ if (LOWORD(value) == 0xFFFF) {
return SDL_HAT_CENTERED;
+ }
/* Round the value up: */
value += 4500 / 2;
value %= 36000;
value /= 4500;
- if (value >= 8)
- return SDL_HAT_CENTERED; /* shouldn't happen */
+ if (value >= 8) {
+ return SDL_HAT_CENTERED; /* shouldn't happen */
+ }
return HAT_VALS[value];
}
@@ -1087,8 +1090,9 @@ UpdateDINPUTJoystickState_Buffered(SDL_Joystick * joystick)
for (j = 0; j < joystick->hwdata->NumInputs; ++j) {
const input_t *in = &joystick->hwdata->Inputs[j];
- if (evtbuf[i].dwOfs != in->ofs)
+ if (evtbuf[i].dwOfs != in->ofs) {
continue;
+ }
switch (in->type) {
case AXIS:
diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index fc738b0..2583a84 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -258,8 +258,9 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? XINPUT_GAMEPAD_DPAD_RIGHT : 0);
*/
- if (state->xinput_buttons)
+ if (state->xinput_buttons) {
state->any_data = SDL_TRUE;
+ }
#endif
#ifdef SDL_JOYSTICK_RAWINPUT_WGI
@@ -296,8 +297,9 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_LEFT)) ? GamepadButtons_DPadLeft : 0) |
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? GamepadButtons_DPadRight : 0); */
- if (state->wgi_buttons)
+ if (state->wgi_buttons) {
state->any_data = SDL_TRUE;
+ }
#endif
}
@@ -471,11 +473,13 @@ static void
RAWINPUT_UpdateWindowsGamingInput()
{
int ii;
- if (!wgi_state.gamepad_statics)
+ if (!wgi_state.gamepad_statics) {
return;
+ }
- if (!wgi_state.dirty)
+ if (!wgi_state.dirty) {
return;
+ }
wgi_state.dirty = SDL_FALSE;
@@ -519,7 +523,7 @@ RAWINPUT_UpdateWindowsGamingInput()
return;
}
gamepad_state = SDL_calloc(1, sizeof(*gamepad_state));
- if (!gamepad_state) {
+ if (gamepad_state == NULL) {
SDL_OutOfMemory();
return;
}
@@ -702,8 +706,9 @@ RAWINPUT_DeviceFromHandle(HANDLE hDevice)
SDL_RAWINPUT_Device *curr;
for (curr = SDL_RAWINPUT_devices; curr; curr = curr->next) {
- if (curr->hDevice == hDevice)
+ if (curr->hDevice == hDevice) {
return curr;
+ }
}
return NULL;
}
@@ -711,7 +716,7 @@ RAWINPUT_DeviceFromHandle(HANDLE hDevice)
static void
RAWINPUT_AddDevice(HANDLE hDevice)
{
-#define CHECK(expression) { if(!(expression)) goto err; }
+#define CHECK(expression) { if (!(expression)) goto err; }
SDL_RAWINPUT_Device *device = NULL;
SDL_RAWINPUT_Device *curr, *last;
RID_DEVICE_INFO rdi;
@@ -1076,7 +1081,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
ULONG i;
ctx = (RAWINPUT_DeviceContext *)SDL_calloc(1, sizeof(RAWINPUT_DeviceContext));
- if (!ctx) {
+ if (ctx == NULL) {
return SDL_OutOfMemory();
}
joystick->hwdata = ctx;
@@ -1089,7 +1094,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
#ifdef SDL_JOYSTICK_RAWINPUT_XINPUT
xinput_device_change = SDL_TRUE;
ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, SDL_TRUE);
- if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || !XINPUTGETSTATE)) {
+ if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || XINPUTGETSTATE == NULL)) {
ctx->xinput_enabled = SDL_FALSE;
}
ctx->xinput_slot = XUSER_INDEX_ANY;
@@ -1285,7 +1290,7 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin
if (!rumbled && ctx->xinput_correlated) {
XINPUT_VIBRATION XVibration;
- if (!XINPUTSETSTATE) {
+ if (XINPUTSETSTATE == NULL) {
return SDL_Unsupported();
}
@@ -1638,10 +1643,12 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
correlated = SDL_TRUE;
RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx);
/* If the generalized Guide button was using us, it doesn't need to anymore */
- if (guide_button_candidate.joystick == joystick)
+ if (guide_button_candidate.joystick == joystick) {
guide_button_candidate.joystick = NULL;
- if (guide_button_candidate.last_joystick == joystick)
+ }
+ if (guide_button_candidate.last_joystick == joystick) {
guide_button_candidate.last_joystick = NULL;
+ }
}
} else {
/* someone else also possibly correlated to this device, start over */
@@ -1732,10 +1739,12 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
correlated = SDL_TRUE;
RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot);
/* If the generalized Guide button was using us, it doesn't need to anymore */
- if (guide_button_candidate.joystick == joystick)
+ if (guide_button_candidate.joystick == joystick) {
guide_button_candidate.joystick = NULL;
- if (guide_button_candidate.last_joystick == joystick)
+ }
+ if (guide_button_candidate.last_joystick == joystick) {
guide_button_candidate.last_joystick = NULL;
+ }
}
} else {
/* someone else also possibly correlated to this device, start over */
@@ -1847,10 +1856,12 @@ RAWINPUT_JoystickClose(SDL_Joystick *joystick)
RAWINPUT_DeviceContext *ctx = joystick->hwdata;
#ifdef SDL_JOYSTICK_RAWINPUT_MATCHING
- if (guide_button_candidate.joystick == joystick)
+ if (guide_button_candidate.joystick == joystick) {
guide_button_candidate.joystick = NULL;
- if (guide_button_candidate.last_joystick == joystick)
+ }
+ if (guide_button_candidate.last_joystick == joystick) {
guide_button_candidate.last_joystick = NULL;
+ }
#endif
if (ctx) {
diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c
index 3a89d11..c86c228 100644
--- a/src/joystick/windows/SDL_windows_gaming_input.c
+++ b/src/joystick/windows/SDL_windows_gaming_input.c
@@ -216,7 +216,7 @@ typedef struct RawGameControllerDelegate {
static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_QueryInterface(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController * This, REFIID riid, void **ppvObject)
{
- if (!ppvObject) {
+ if (ppvObject == NULL) {
return E_INVALIDARG;
}
@@ -306,7 +306,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde
}
__x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2);
}
- if (!name) {
+ if (name == NULL) {
name = SDL_strdup("");
}
@@ -664,7 +664,7 @@ WGI_JoystickOpen(SDL_Joystick *joystick, int device_index)
boolean wireless = SDL_FALSE;
hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata));
- if (!hwdata) {
+ if (hwdata == NULL) {
return SDL_OutOfMemory();
}
joystick->hwdata = hwdata;
diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c
index ccd8f37..4d8d451 100644
--- a/src/joystick/windows/SDL_windowsjoystick.c
+++ b/src/joystick/windows/SDL_windowsjoystick.c
@@ -252,11 +252,13 @@ SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
RAWINPUT_UnregisterNotifications();
#endif
- if (data->hNotify)
+ if (data->hNotify) {
UnregisterDeviceNotification(data->hNotify);
+ }
- if (data->messageWindow)
+ if (data->messageWindow) {
DestroyWindow(data->messageWindow);
+ }
UnregisterClass(data->wincl.lpszClassName, data->wincl.hInstance);
@@ -400,18 +402,18 @@ static int
SDL_StartJoystickThread(void)
{
s_mutexJoyStickEnum = SDL_CreateMutex();
- if (!s_mutexJoyStickEnum) {
+ if (s_mutexJoyStickEnum == NULL) {
return -1;
}
s_condJoystickThread = SDL_CreateCond();
- if (!s_condJoystickThread) {
+ if (s_condJoystickThread == NULL) {
return -1;
}
s_bJoystickThreadQuit = SDL_FALSE;
s_joystickThread = SDL_CreateThreadInternal(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL);
- if (!s_joystickThread) {
+ if (s_joystickThread == NULL) {
return -1;
}
return 0;
@@ -420,7 +422,7 @@ SDL_StartJoystickThread(void)
static void
SDL_StopJoystickThread(void)
{
- if (!s_joystickThread) {
+ if (s_joystickThread == NULL) {
return;
}
@@ -594,8 +596,9 @@ WINDOWS_JoystickGetDeviceName(int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
return device->joystickname;
}
@@ -606,8 +609,9 @@ WINDOWS_JoystickGetDevicePath(int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
return device->path;
}
@@ -618,8 +622,9 @@ WINDOWS_JoystickGetDevicePlayerIndex(int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
return device->bXInputDevice ? (int)device->XInputUserId : -1;
}
@@ -636,8 +641,9 @@ WINDOWS_JoystickGetDeviceGUID(int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
return device->guid;
}
@@ -649,8 +655,9 @@ WINDOWS_JoystickGetDeviceInstanceID(int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
return device->nInstanceID;
}
@@ -666,8 +673,9 @@ WINDOWS_JoystickOpen(SDL_Joystick *joystick, int device_index)
JoyStick_DeviceData *device = SYS_Joystick;
int index;
- for (index = device_index; index > 0; index--)
+ for (index = device_index; index > 0; index--) {
device = device->pNext;
+ }
/* allocate memory for system specific hardware data */
joystick->instance_id = device->nInstanceID;
diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c
index 4fa3555..091c641 100644
--- a/src/joystick/windows/SDL_xinputjoystick.c
+++ b/src/joystick/windows/SDL_xinputjoystick.c
@@ -49,7 +49,7 @@ SDL_XInputUseOldJoystickMapping()
#ifdef __WINRT__
/* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
/* FIXME: Why are Win8/10 different here? -flibit */
- return (NTDDI_VERSION < NTDDI_WIN10);
+ return NTDDI_VERSION < NTDDI_WIN10;
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
return SDL_FALSE;
#else
@@ -57,7 +57,7 @@ SDL_XInputUseOldJoystickMapping()
if (s_XInputUseOldJoystickMapping < 0) {
s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
}
- return (s_XInputUseOldJoystickMapping > 0);
+ return s_XInputUseOldJoystickMapping > 0;
#endif
}
@@ -248,11 +248,13 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
JoyStick_DeviceData *pPrevJoystick = NULL;
JoyStick_DeviceData *pNewJoystick = *pContext;
- if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD)
+ if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD) {
return;
+ }
- if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN)
+ if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN) {
return;
+ }
while (pNewJoystick) {
if (pNewJoystick->bXInputDevice && (pNewJoystick->XInputUserId == userid) && (pNewJoystick->SubType == SubType)) {
@@ -273,7 +275,7 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
}
pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData));
- if (!pNewJoystick) {
+ if (pNewJoystick == NULL) {
return; /* better luck next time? */
}
@@ -521,8 +523,9 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
XINPUT_STATE_EX XInputState;
XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
- if (!XINPUTGETSTATE)
+ if (!XINPUTGETSTATE) {
return;
+ }
result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState);
if (result == ERROR_DEVICE_NOT_CONNECTED) {
diff --git a/src/loadso/dlopen/SDL_sysloadso.c b/src/loadso/dlopen/SDL_sysloadso.c
index 3b55a6e..54337b9 100644
--- a/src/loadso/dlopen/SDL_sysloadso.c
+++ b/src/loadso/dlopen/SDL_sysloadso.c
@@ -52,7 +52,7 @@ SDL_LoadObject(const char *sofile)
if (handle == NULL) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
}
- return (handle);
+ return handle;
}
void *
@@ -73,7 +73,7 @@ SDL_LoadFunction(void *handle, const char *name)
(const char *) dlerror());
}
}
- return (symbol);
+ return symbol;
}
void
diff --git a/src/loadso/dummy/SDL_sysloadso.c b/src/loadso/dummy/SDL_sysloadso.c
index da45a84..feb1630 100644
--- a/src/loadso/dummy/SDL_sysloadso.c
+++ b/src/loadso/dummy/SDL_sysloadso.c
@@ -32,7 +32,7 @@ SDL_LoadObject(const char *sofile)
{
const char *loaderror = "SDL_LoadObject() not implemented";
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
- return (NULL);
+ return NULL;
}
void *
@@ -40,7 +40,7 @@ SDL_LoadFunction(void *handle, const char *name)
{
const char *loaderror = "SDL_LoadFunction() not implemented";
SDL_SetError("Failed loading %s: %s", name, loaderror);
- return (NULL);
+ return NULL;
}
void
diff --git a/src/loadso/windows/SDL_sysloadso.c b/src/loadso/windows/SDL_sysloadso.c
index 1157ed3..3db6be2 100644
--- a/src/loadso/windows/SDL_sysloadso.c
+++ b/src/loadso/windows/SDL_sysloadso.c
@@ -35,7 +35,7 @@ SDL_LoadObject(const char *sofile)
void *handle;
LPTSTR tstr;
- if (!sofile) {
+ if (sofile == NULL) {
SDL_InvalidParamError("sofile");
return NULL;
}
diff --git a/src/locale/SDL_locale.c b/src/locale/SDL_locale.c
index 5aaf872..c9fa478 100644
--- a/src/locale/SDL_locale.c
+++ b/src/locale/SDL_locale.c
@@ -33,7 +33,7 @@ build_locales_from_csv_string(char *csv)
SDL_Locale *loc;
SDL_Locale *retval;
- if (!csv || !csv[0]) {
+ if (csv == NULL || !csv[0]) {
return NULL; /* nothing to report */
}
@@ -49,7 +49,7 @@ build_locales_from_csv_string(char *csv)
alloclen = slen + (num_locales * sizeof (SDL_Locale));
loc = retval = (SDL_Locale *) SDL_calloc(1, alloclen);
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL; /* oh well */
}
@@ -57,7 +57,10 @@ build_locales_from_csv_string(char *csv)
SDL_strlcpy(ptr, csv, slen);
while (SDL_TRUE) { /* parse out the string */
- while (*ptr == ' ') ptr++; /* skip whitespace. */
+ while (*ptr == ' ') {
+ ptr++; /* skip whitespace. */
+ }
+
if (*ptr == '\0') {
break;
}
diff --git a/src/locale/unix/SDL_syslocale.c b/src/locale/unix/SDL_syslocale.c
index b9a3774..518856a 100644
--- a/src/locale/unix/SDL_syslocale.c
+++ b/src/locale/unix/SDL_syslocale.c
@@ -74,7 +74,7 @@ SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
SDL_assert(buflen > 0);
tmp = SDL_small_alloc(char, buflen, &isstack);
- if (!tmp) {
+ if (tmp == NULL) {
SDL_OutOfMemory();
return;
}
diff --git a/src/locale/vita/SDL_syslocale.c b/src/locale/vita/SDL_syslocale.c
index 0a057cb..cde912c 100644
--- a/src/locale/vita/SDL_syslocale.c
+++ b/src/locale/vita/SDL_syslocale.c
@@ -59,8 +59,9 @@ SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
sceAppUtilInit(&initParam, &bootParam);
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, &language);
- if (language < 0 || language > SCE_SYSTEM_PARAM_LANG_TURKISH)
+ if (language < 0 || language > SCE_SYSTEM_PARAM_LANG_TURKISH) {
language = SCE_SYSTEM_PARAM_LANG_ENGLISH_US; // default to english
+ }
SDL_strlcpy(buf, vita_locales[language], buflen);
diff --git a/src/locale/windows/SDL_syslocale.c b/src/locale/windows/SDL_syslocale.c
index 2d033f4..3bbaa1e 100644
--- a/src/locale/windows/SDL_syslocale.c
+++ b/src/locale/windows/SDL_syslocale.c
@@ -68,7 +68,7 @@ SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, NULL, &wbuflen);
wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack);
- if (!wbuf) {
+ if (wbuf == NULL) {
SDL_OutOfMemory();
return;
}
diff --git a/src/locale/winrt/SDL_syslocale.c b/src/locale/winrt/SDL_syslocale.c
index 1af2a95..55de845 100644
--- a/src/locale/winrt/SDL_syslocale.c
+++ b/src/locale/winrt/SDL_syslocale.c
@@ -40,8 +40,7 @@ SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer));
# endif
- if (ret > 0)
- {
+ if (ret > 0) {
/* Need to convert LPWSTR to LPSTR, that is wide char to char. */
int i;
diff --git a/src/main/dummy/SDL_dummy_main.c b/src/main/dummy/SDL_dummy_main.c
index b78d8db..4abe47d 100644
--- a/src/main/dummy/SDL_dummy_main.c
+++ b/src/main/dummy/SDL_dummy_main.c
@@ -11,7 +11,7 @@
int
main(int argc, char *argv[])
{
- return (SDL_main(argc, argv));
+ return SDL_main(argc, argv);
}
#else
/* Nothing to do on this platform */
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index a5e1428..1fb6fe1 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -65,8 +65,9 @@ StartBeApp(void *unused)
BAppFileInfo app_info(&f);
if (app_info.InitCheck() == B_OK) {
char sig[B_MIME_TYPE_LENGTH];
- if (app_info.GetSignature(sig) == B_OK)
+ if (app_info.GetSignature(sig) == B_OK) {
signature = strndup(sig, B_MIME_TYPE_LENGTH);
+ }
}
}
}
@@ -75,7 +76,7 @@ StartBeApp(void *unused)
App->Run();
delete App;
- return (0);
+ return 0;
}
/* Initialize the Be Application, if it's not already started */
@@ -116,7 +117,7 @@ SDL_InitBeApp(void)
++SDL_BeAppActive;
/* The app is running, and we're ready to go */
- return (0);
+ return 0;
}
/* Quit the Be Application, if there's nothing left to do */
@@ -147,7 +148,7 @@ SDL_QuitBeApp(void)
void SDL_BApp::ClearID(SDL_BWin *bwin) {
_SetSDLWindow(NULL, bwin->GetID());
int32 i = _GetNumWindowSlots() - 1;
- while(i >= 0 && GetSDLWindow(i) == NULL) {
+ while (i >= 0 && GetSDLWindow(i) == NULL) {
_PopBackWindow();
--i;
}
diff --git a/src/main/ngage/SDL_ngage_main.cpp b/src/main/ngage/SDL_ngage_main.cpp
index 6dbf2f1..dc83a8b 100644
--- a/src/main/ngage/SDL_ngage_main.cpp
+++ b/src/main/ngage/SDL_ngage_main.cpp
@@ -58,13 +58,10 @@ TInt E32Main()
newHeap = User::ChunkHeap(NULL, heapSize, heapSize, KMinHeapGrowBy);
- if (NULL == newHeap)
- {
+ if (newHeap == NULL) {
ret = 3;
goto cleanup;
- }
- else
- {
+ } else {
oldHeap = User::SwitchHeap(newHeap);
/* Call stdlib main */
SDL_SetMainReady();
diff --git a/src/main/ps2/SDL_ps2_main.c b/src/main/ps2/SDL_ps2_main.c
index e9a4b51..0525797 100644
--- a/src/main/ps2/SDL_ps2_main.c
+++ b/src/main/ps2/SDL_ps2_main.c
@@ -28,9 +28,9 @@
__attribute__((weak))
void reset_IOP() {
SifInitRpc(0);
- while(!SifIopReset(NULL, 0)) {
+ while (!SifIopReset(NULL, 0)) {
}
- while(!SifIopSync()){
+ while (!SifIopSync()) {
}
}
@@ -59,7 +59,7 @@ static void waitUntilDeviceIsReady(char *path)
int ret = -1;
int retries = 50;
- while(ret != 0 && retries > 0) {
+ while (ret != 0 && retries > 0) {
ret = stat(path, &buffer);
/* Wait until the device is ready */
nopdelay();
diff --git a/src/main/psp/SDL_psp_main.c b/src/main/psp/SDL_psp_main.c
index 8eb173f..6e7bc8e 100644
--- a/src/main/psp/SDL_psp_main.c
+++ b/src/main/psp/SDL_psp_main.c
@@ -47,8 +47,9 @@ int sdl_psp_setup_callbacks(void)
int thid;
thid = sceKernelCreateThread("update_thread",
sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
- if(thid >= 0)
+ if (thid >= 0) {
sceKernelStartThread(thid, 0, 0);
+ }
return thid;
}
diff --git a/src/main/windows/SDL_windows_main.c b/src/main/windows/SDL_windows_main.c
index 70fb9b9..dd477ae 100644
--- a/src/main/windows/SDL_windows_main.c
+++ b/src/main/windows/SDL_windows_main.c
@@ -56,13 +56,13 @@ main_getcmdline(void)
/* Parse it into argv and argc */
argv = (char **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv));
- if (!argv) {
+ if (argv == NULL) {
return OutOfMemory();
}
for (i = 0; i < argc; ++i) {
DWORD len;
char *arg = WIN_StringToUTF8W(argvw[i]);
- if (!arg) {
+ if (arg == NULL) {
return OutOfMemory();
}
len = (DWORD)SDL_strlen(arg);
diff --git a/src/misc/SDL_url.c b/src/misc/SDL_url.c
index eb258d9..8091bd8 100644
--- a/src/misc/SDL_url.c
+++ b/src/misc/SDL_url.c
@@ -26,7 +26,7 @@ extern int SDL_SYS_OpenURL(const char *url);
int
SDL_OpenURL(const char *url)
{
- if (!url) {
+ if (url == NULL) {
return SDL_InvalidParamError("url");
}
return SDL_SYS_OpenURL(url);
diff --git a/src/power/emscripten/SDL_syspower.c b/src/power/emscripten/SDL_syspower.c
index 4bac686..75352ef 100644
--- a/src/power/emscripten/SDL_syspower.c
+++ b/src/power/emscripten/SDL_syspower.c
@@ -33,8 +33,9 @@ SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
EmscriptenBatteryEvent batteryState;
int haveBattery = 0;
- if (emscripten_get_battery_status(&batteryState) == EMSCRIPTEN_RESULT_NOT_SUPPORTED)
+ if (emscripten_get_battery_status(&batteryState) == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
return SDL_FALSE;
+ }
haveBattery = batteryState.level != 1.0 || !batteryState.charging || batteryState.chargingTime != 0.0;
diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c
index c33ab5c..d14a77d 100644
--- a/src/power/linux/SDL_syspower.c
+++ b/src/power/linux/SDL_syspower.c
@@ -303,11 +303,13 @@ next_string(char **_ptr, char **_str)
}
str = ptr;
- while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0'))
+ while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0')) {
ptr++;
+ }
- if (*ptr != '\0')
+ if (*ptr != '\0') {
*(ptr++) = '\0';
+ }
*_str = str;
*_ptr = ptr;
@@ -319,7 +321,7 @@ int_string(char *str, int *val)
{
char *endptr = NULL;
*val = (int) SDL_strtol(str, &endptr, 0);
- return ((*str != '\0') && (*endptr == '\0'));
+ return (*str != '\0') && (*endptr == '\0');
}
/* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
@@ -439,7 +441,7 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second
DIR *dirp;
dirp = opendir(base);
- if (!dirp) {
+ if (dirp == NULL) {
return SDL_FALSE;
}
@@ -633,9 +635,9 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second
char **paths = NULL;
int i, numpaths = 0;
- if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices",
- DBUS_TYPE_INVALID,
- DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) {
+ if (dbus == NULL || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices",
+ DBUS_TYPE_INVALID,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) {
return SDL_FALSE; /* try a different approach than UPower. */
}
diff --git a/src/power/windows/SDL_syspower.c b/src/power/windows/SDL_syspower.c
index 666b563..02e4fa8 100644
--- a/src/power/windows/SDL_syspower.c
+++ b/src/power/windows/SDL_syspower.c
@@ -34,8 +34,7 @@ SDL_GetPowerInfo_Windows(SDL_PowerState * state, int *seconds, int *percent)
SDL_bool need_details = SDL_FALSE;
/* This API should exist back to Win95. */
- if (!GetSystemPowerStatus(&status))
- {
+ if (!GetSystemPowerStatus(&status)) {
/* !!! FIXME: push GetLastError() into SDL_GetError() */
*state = SDL_POWERSTATE_UNKNOWN;
} else if (status.BatteryFlag == 0xFF) { /* unknown state */
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 5f821b3..f49272e 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -336,7 +336,7 @@ AllocateRenderCommand(SDL_Renderer *renderer)
retval->next = NULL;
} else {
retval = SDL_calloc(1, sizeof (*retval));
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -969,7 +969,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
Android_ActivityMutex_Lock_Running();
#endif
- if (!window) {
+ if (window == NULL) {
SDL_InvalidParamError("window");
goto error;
}
@@ -1005,7 +1005,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
}
}
- if (!renderer) {
+ if (renderer == NULL) {
for (index = 0; index < n; ++index) {
const SDL_RenderDriver *driver = render_drivers[index];
@@ -1019,7 +1019,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
}
}
}
- if (!renderer) {
+ if (renderer == NULL) {
SDL_SetError("Couldn't find matching render driver");
goto error;
}
@@ -1032,7 +1032,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
/* Create a new renderer instance */
renderer = render_drivers[index]->CreateRenderer(window, flags);
batching = SDL_FALSE;
- if (!renderer) {
+ if (renderer == NULL) {
goto error;
}
}
@@ -1257,7 +1257,7 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
{
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
- if (!hint || SDL_strcasecmp(hint, "nearest") == 0) {
+ if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) {
return SDL_ScaleModeNearest;
} else if (SDL_strcasecmp(hint, "linear") == 0) {
return SDL_ScaleModeLinear;
@@ -1299,7 +1299,7 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
return NULL;
}
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
- if (!texture) {
+ if (texture == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1391,7 +1391,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
CHECK_RENDERER_MAGIC(renderer, NULL);
- if (!surface) {
+ if (surface == NULL) {
SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface");
return NULL;
}
@@ -1455,7 +1455,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_STATIC,
surface->w, surface->h);
- if (!texture) {
+ if (texture == NULL) {
return NULL;
}
@@ -1499,7 +1499,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
/* Set up a destination surface for the texture update */
dst_fmt = SDL_AllocFormat(format);
- if (!dst_fmt) {
+ if (dst_fmt == NULL) {
SDL_DestroyTexture(texture);
return NULL;
}
@@ -1730,7 +1730,7 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
const size_t alloclen = rect->h * temp_pitch;
if (alloclen > 0) {
void *temp_pixels = SDL_malloc(alloclen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
@@ -1771,7 +1771,7 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
const size_t alloclen = rect->h * temp_pitch;
if (alloclen > 0) {
void *temp_pixels = SDL_malloc(alloclen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
SDL_ConvertPixels(rect->w, rect->h,
@@ -1792,7 +1792,7 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
CHECK_TEXTURE_MAGIC(texture, -1);
- if (!pixels) {
+ if (pixels == NULL) {
return SDL_InvalidParamError("pixels");
}
if (!pitch) {
@@ -1867,7 +1867,7 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect,
const size_t alloclen = rect->h * temp_pitch;
if (alloclen > 0) {
void *temp_pixels = SDL_malloc(alloclen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
@@ -1918,7 +1918,7 @@ SDL_UpdateTextureNVPlanar(SDL_Texture * texture, const SDL_Rect * rect,
const size_t alloclen = rect->h * temp_pitch;
if (alloclen > 0) {
void *temp_pixels = SDL_malloc(alloclen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
@@ -1944,19 +1944,19 @@ int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect,
CHECK_TEXTURE_MAGIC(texture, -1);
- if (!Yplane) {
+ if (Yplane == NULL) {
return SDL_InvalidParamError("Yplane");
}
if (!Ypitch) {
return SDL_InvalidParamError("Ypitch");
}
- if (!Uplane) {
+ if (Uplane == NULL) {
return SDL_InvalidParamError("Uplane");
}
if (!Upitch) {
return SDL_InvalidParamError("Upitch");
}
- if (!Vplane) {
+ if (Vplane == NULL) {
return SDL_InvalidParamError("Vplane");
}
if (!Vpitch) {
@@ -2010,13 +2010,13 @@ int SDL_UpdateNVTexture(SDL_Texture * texture, const SDL_Rect * rect,
CHECK_TEXTURE_MAGIC(texture, -1);
- if (!Yplane) {
+ if (Yplane == NULL) {
return SDL_InvalidParamError("Yplane");
}
if (!Ypitch) {
return SDL_InvalidParamError("Ypitch");
}
- if (!UVplane) {
+ if (UVplane == NULL) {
return SDL_InvalidParamError("UVplane");
}
if (!UVpitch) {
@@ -2095,7 +2095,7 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect,
return SDL_SetError("SDL_LockTexture(): texture must be streaming");
}
- if (!rect) {
+ if (rect == NULL) {
full_rect.x = 0;
full_rect.y = 0;
full_rect.w = texture->w;
@@ -2230,7 +2230,7 @@ SDL_UnlockTexture(SDL_Texture * texture)
SDL_bool
SDL_RenderTargetSupported(SDL_Renderer *renderer)
{
- if (!renderer || !renderer->SetRenderTarget) {
+ if (renderer == NULL || !renderer->SetRenderTarget) {
return SDL_FALSE;
}
return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0;
@@ -2344,7 +2344,7 @@ UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd)
}
hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
- if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) {
+ if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) {
#if SDL_VIDEO_RENDER_D3D
SDL_bool overscan_supported = SDL_TRUE;
/* Unfortunately, Direct3D 9 doesn't support negative viewport numbers
@@ -2742,7 +2742,7 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer,
}
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
- if (!frects) {
+ if (frects == NULL) {
return SDL_OutOfMemory();
}
@@ -2771,7 +2771,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!points) {
+ if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawPoints(): points");
}
if (count < 1) {
@@ -2789,7 +2789,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer,
retval = RenderDrawPointsWithRects(renderer, points, count);
} else {
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
- if (!fpoints) {
+ if (fpoints == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
@@ -2818,7 +2818,7 @@ RenderDrawPointsWithRectsF(SDL_Renderer * renderer,
}
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
- if (!frects) {
+ if (frects == NULL) {
return SDL_OutOfMemory();
}
@@ -2844,7 +2844,7 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!points) {
+ if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points");
}
if (count < 1) {
@@ -2938,7 +2938,7 @@ static int RenderDrawLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x
}
points = SDL_small_alloc(SDL_FPoint, numpixels, &isstack);
- if (!points) {
+ if (points == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < numpixels; ++i) {
@@ -2982,7 +2982,7 @@ RenderDrawLinesWithRectsF(SDL_Renderer * renderer,
SDL_bool draw_last = SDL_FALSE;
frects = SDL_small_alloc(SDL_FRect, count-1, &isstack);
- if (!frects) {
+ if (frects == NULL) {
return SDL_OutOfMemory();
}
@@ -3053,7 +3053,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!points) {
+ if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawLines(): points");
}
if (count < 2) {
@@ -3068,7 +3068,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer,
#endif
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
- if (!fpoints) {
+ if (fpoints == NULL) {
return SDL_OutOfMemory();
}
@@ -3092,7 +3092,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!points) {
+ if (points == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points");
}
if (count < 2) {
@@ -3266,7 +3266,7 @@ SDL_RenderDrawRectF(SDL_Renderer * renderer, const SDL_FRect * rect)
CHECK_RENDERER_MAGIC(renderer, -1);
/* If 'rect' == NULL, then outline the whole surface */
- if (!rect) {
+ if (rect == NULL) {
RenderGetViewportSize(renderer, &frect);
rect = &frect;
}
@@ -3292,7 +3292,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!rects) {
+ if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawRects(): rects");
}
if (count < 1) {
@@ -3322,7 +3322,7 @@ SDL_RenderDrawRectsF(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!rects) {
+ if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects");
}
if (count < 1) {
@@ -3371,7 +3371,7 @@ SDL_RenderFillRectF(SDL_Renderer * renderer, const SDL_FRect * rect)
CHECK_RENDERER_MAGIC(renderer, -1);
/* If 'rect' == NULL, then outline the whole surface */
- if (!rect) {
+ if (rect == NULL) {
RenderGetViewportSize(renderer, &frect);
rect = &frect;
}
@@ -3389,7 +3389,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!rects) {
+ if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderFillRects(): rects");
}
if (count < 1) {
@@ -3404,7 +3404,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer,
#endif
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
- if (!frects) {
+ if (frects == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
@@ -3432,7 +3432,7 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer,
CHECK_RENDERER_MAGIC(renderer, -1);
- if (!rects) {
+ if (rects == NULL) {
return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects");
}
if (count < 1) {
@@ -3447,7 +3447,7 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer,
#endif
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
- if (!frects) {
+ if (frects == NULL) {
return SDL_OutOfMemory();
}
for (i = 0; i < count; ++i) {
@@ -3999,7 +3999,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
x2 = xy2_[0]; y2 = xy2_[1];
/* Check if triangle A B C is rectangle */
- if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)){
+ if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)) {
/* ok */
} else {
is_quad = 0;
@@ -4012,7 +4012,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
x2 = xy2_[0]; y2 = xy2_[1];
/* Check if triangle A B C2 is rectangle */
- if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)){
+ if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)) {
/* ok */
} else {
is_quad = 0;
@@ -4121,7 +4121,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
prev[1] = k1;
prev[2] = k2;
}
- } /* End for(), next triangle */
+ } /* End for (), next triangle */
if (prev[0] != -1) {
/* flush the last triangle */
@@ -4173,15 +4173,15 @@ SDL_RenderGeometryRaw(SDL_Renderer *renderer,
}
}
- if (!xy) {
+ if (xy == NULL) {
return SDL_InvalidParamError("xy");
}
- if (!color) {
+ if (color == NULL) {
return SDL_InvalidParamError("color");
}
- if (texture && !uv) {
+ if (texture && uv == NULL) {
return SDL_InvalidParamError("uv");
}
diff --git a/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c
index 10fe54e..2db8c70 100644
--- a/src/render/SDL_yuv_sw.c
+++ b/src/render/SDL_yuv_sw.c
@@ -49,7 +49,7 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
}
swdata = (SDL_SW_YUVTexture *) SDL_calloc(1, sizeof(*swdata));
- if (!swdata) {
+ if (swdata == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -125,7 +125,7 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
}
/* We're all done.. */
- return (swdata);
+ return swdata;
}
int
@@ -346,8 +346,7 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
if (rect
&& (rect->x != 0 || rect->y != 0 || rect->w != swdata->w
|| rect->h != swdata->h)) {
- return SDL_SetError
- ("YV12, IYUV, NV12, NV21 textures only support full surface locks");
+ return SDL_SetError("YV12, IYUV, NV12, NV21 textures only support full surface locks");
}
break;
}
@@ -407,7 +406,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask,
Gmask, Bmask, Amask);
if (!swdata->display) {
- return (-1);
+ return -1;
}
}
if (!swdata->stretch) {
@@ -418,7 +417,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
SDL_CreateRGBSurface(0, swdata->w, swdata->h, bpp, Rmask,
Gmask, Bmask, Amask);
if (!swdata->stretch) {
- return (-1);
+ return -1;
}
}
pixels = swdata->stretch->pixels;
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index e68e4d8..1bb62c3 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -551,7 +551,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
DWORD usage;
texturedata = (D3D_TextureData *) SDL_calloc(1, sizeof(*texturedata));
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_OutOfMemory();
}
texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
@@ -590,7 +590,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return 0;
}
@@ -618,7 +618,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -655,7 +655,7 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -680,7 +680,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
IDirect3DDevice9 *device = data->device;
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_SetError("Texture is not currently available");
}
#if SDL_HAVE_YUV
@@ -731,7 +731,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return;
}
#if SDL_HAVE_YUV
@@ -741,8 +741,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
(void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch);
- }
- else
+ } else
#endif
{
IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0);
@@ -761,7 +760,7 @@ D3D_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Scal
{
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return;
}
@@ -789,7 +788,7 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
}
texturedata = (D3D_TextureData *)texture->driverdata;
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -812,11 +811,11 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
}
result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture.texture, 0, &data->currentRenderTarget);
- if(FAILED(result)) {
+ if (FAILED(result)) {
return D3D_SetError("GetSurfaceLevel()", result);
}
result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget);
- if(FAILED(result)) {
+ if (FAILED(result)) {
return D3D_SetError("SetRenderTarget()", result);
}
@@ -848,7 +847,7 @@ D3D_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -874,7 +873,7 @@ D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
int count = indices ? num_indices : num_vertices;
Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, count * sizeof (Vertex), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -974,7 +973,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH
SDL_assert(*shader == NULL);
- if (!texturedata) {
+ if (texturedata == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1031,7 +1030,7 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
IDirect3DDevice9_SetTexture(data->device, 0, NULL);
}
#if SDL_HAVE_YUV
- if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) {
+ if ((newtexturedata == NULL || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) {
IDirect3DDevice9_SetTexture(data->device, 1, NULL);
IDirect3DDevice9_SetTexture(data->device, 2, NULL);
}
@@ -1422,7 +1421,7 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
#endif
}
- if (!data) {
+ if (data == NULL) {
return;
}
@@ -1597,13 +1596,13 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
int displayIndex;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (D3D_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index 8369e54..9d02297 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -391,7 +391,7 @@ D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode)
}
blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes));
- if (!blendModes) {
+ if (blendModes == NULL) {
SAFE_RELEASE(blendState);
SDL_OutOfMemory();
return NULL;
@@ -450,7 +450,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
}
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
- if (!CreateDXGIFactoryFunc) {
+ if (CreateDXGIFactoryFunc == NULL) {
result = E_FAIL;
goto done;
}
@@ -1102,7 +1102,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
textureData = (D3D11_TextureData*) SDL_calloc(1, sizeof(*textureData));
- if (!textureData) {
+ if (textureData == NULL) {
SDL_OutOfMemory();
return -1;
}
@@ -1272,7 +1272,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer,
{
D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata;
- if (!data) {
+ if (data == NULL) {
return;
}
@@ -1382,7 +1382,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1428,7 +1428,7 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1453,7 +1453,7 @@ D3D11_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture,
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1478,7 +1478,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D11_TEXTURE2D_DESC stagingTextureDesc;
D3D11_MAPPED_SUBRESOURCE textureMemory;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
#if SDL_HAVE_YUV
@@ -1559,7 +1559,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return;
}
#if SDL_HAVE_YUV
@@ -1596,7 +1596,7 @@ D3D11_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Sc
{
D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return;
}
@@ -1642,7 +1642,7 @@ D3D11_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -1670,7 +1670,7 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
int count = indices ? num_indices : num_vertices;
VertexPositionColor *verts = (VertexPositionColor *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertexPositionColor), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -1882,8 +1882,7 @@ D3D11_GetCurrentRenderTargetView(SDL_Renderer * renderer)
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
if (data->currentOffscreenRenderTargetView) {
return data->currentOffscreenRenderTargetView;
- }
- else {
+ } else {
return data->mainRenderTargetView;
}
}
@@ -1951,9 +1950,9 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11
break;
}
}
- if (!blendState) {
+ if (blendState == NULL) {
blendState = D3D11_CreateBlendState(renderer, blendMode);
- if (!blendState) {
+ if (blendState == NULL) {
return -1;
}
}
@@ -2369,13 +2368,13 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
D3D11_RenderData *data;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (D3D11_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;
diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp
index 9784c32..7fb4fa6 100644
--- a/src/render/direct3d11/SDL_render_winrt.cpp
+++ b/src/render/direct3d11/SDL_render_winrt.cpp
@@ -47,7 +47,7 @@ extern "C" void *
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
{
SDL_Window * sdlWindow = renderer->window;
- if ( ! renderer->window ) {
+ if (renderer->window == NULL) {
return NULL;
}
diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c
index 79cf30e..2f7fcd4 100644
--- a/src/render/direct3d12/SDL_render_d3d12.c
+++ b/src/render/direct3d12/SDL_render_d3d12.c
@@ -268,7 +268,7 @@ static const GUID SDL_IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9
UINT
D3D12_Align(UINT location, UINT alignment)
{
- return ((location + (alignment - 1)) & ~(alignment - 1));
+ return (location + (alignment - 1)) & ~(alignment - 1);
}
Uint32
@@ -404,8 +404,7 @@ D3D12_CPUtoGPUHandle(ID3D12DescriptorHeap * heap, D3D12_CPU_DESCRIPTOR_HANDLE CP
static void
D3D12_WaitForGPU(D3D12_RenderData * data)
{
- if (data->commandQueue && data->fence && data->fenceEvent)
- {
+ if (data->commandQueue && data->fence && data->fenceEvent) {
D3D_CALL(data->commandQueue, Signal, data->fence, data->fenceValue);
if (D3D_CALL(data->fence, GetCompletedValue) < data->fenceValue) {
D3D_CALL(data->fence, SetEventOnCompletion,
@@ -648,7 +647,7 @@ D3D12_CreatePipelineState(SDL_Renderer * renderer,
}
pipelineStates = (D3D12_PipelineState*)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates));
- if (!pipelineStates) {
+ if (pipelineStates == NULL) {
SAFE_RELEASE(pipelineState);
SDL_OutOfMemory();
return NULL;
@@ -766,7 +765,7 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
}
}
#endif
- if (!CreateEventExFunc) {
+ if (CreateEventExFunc == NULL) {
result = E_FAIL;
goto done;
}
@@ -779,7 +778,7 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
}
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
- if (!CreateDXGIFactoryFunc) {
+ if (CreateDXGIFactoryFunc == NULL) {
result = E_FAIL;
goto done;
}
@@ -823,7 +822,7 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
/* If the debug hint is set, also create the DXGI factory in debug mode */
DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
- if (!DXGIGetDebugInterfaceFunc) {
+ if (DXGIGetDebugInterfaceFunc == NULL) {
result = E_FAIL;
goto done;
}
@@ -1474,12 +1473,11 @@ D3D12_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D12_SHADER_RESOURCE_VIEW_DESC resourceViewDesc;
if (textureFormat == DXGI_FORMAT_UNKNOWN) {
- return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified",
- __FUNCTION__, texture->format);
+ return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified", __FUNCTION__, texture->format);
}
textureData = (D3D12_TextureData*) SDL_calloc(1, sizeof(*textureData));
- if (!textureData) {
+ if (textureData == NULL) {
SDL_OutOfMemory();
return -1;
}
@@ -1666,7 +1664,7 @@ D3D12_DestroyTexture(SDL_Renderer * renderer,
D3D12_RenderData *rendererData = (D3D12_RenderData*)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return;
}
@@ -1850,7 +1848,7 @@ D3D12_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1896,7 +1894,7 @@ D3D12_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1921,7 +1919,7 @@ D3D12_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
@@ -1951,7 +1949,7 @@ D3D12_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
BYTE *textureMemory;
int bpp;
- if (!textureData) {
+ if (textureData == NULL) {
return SDL_SetError("Texture is not currently available");
}
#if SDL_HAVE_YUV
@@ -2043,8 +2041,7 @@ D3D12_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
pitchedDesc.Depth = 1;
if (pitchedDesc.Format == DXGI_FORMAT_R8_UNORM) {
bpp = 1;
- }
- else {
+ } else {
bpp = 4;
}
pitchedDesc.RowPitch = D3D12_Align(rect->w * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
@@ -2075,7 +2072,7 @@ D3D12_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D12_TEXTURE_COPY_LOCATION dstLocation;
int bpp;
- if (!textureData) {
+ if (textureData == NULL) {
return;
}
#if SDL_HAVE_YUV
@@ -2103,8 +2100,7 @@ D3D12_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
pitchedDesc.Depth = 1;
if (pitchedDesc.Format == DXGI_FORMAT_R8_UNORM) {
bpp = 1;
- }
- else {
+ } else {
bpp = 4;
}
pitchedDesc.RowPitch = D3D12_Align(textureData->lockedRect.w * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
@@ -2149,7 +2145,7 @@ D3D12_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Sc
{
D3D12_TextureData *textureData = (D3D12_TextureData *) texture->driverdata;
- if (!textureData) {
+ if (textureData == NULL) {
return;
}
@@ -2210,7 +2206,7 @@ D3D12_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -2238,7 +2234,7 @@ D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
int count = indices ? num_indices : num_vertices;
VertexPositionColor *verts = (VertexPositionColor *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertexPositionColor), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -2614,8 +2610,8 @@ D3D12_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const
D3D12_TransitionResource(rendererData, textureData->mainTextureV, textureData->mainResourceStateV, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
textureData->mainResourceStateV = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
- return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
- SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
+ return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources,
+ textureSampler, matrix);
} else if (textureData->nv12) {
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[] = {
textureData->mainTextureResourceView,
@@ -2643,14 +2639,14 @@ D3D12_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const
D3D12_TransitionResource(rendererData, textureData->mainTextureNV, textureData->mainResourceStateNV, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
textureData->mainResourceStateNV = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
- return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
- SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
+ return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources,
+ textureSampler, matrix);
}
#endif /* SDL_HAVE_YUV */
D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
- return D3D12_SetDrawState(renderer, cmd, SHADER_RGB, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE,
- 1, &textureData->mainTextureResourceView, textureSampler, matrix);
+ return D3D12_SetDrawState(renderer, cmd, SHADER_RGB, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 1, &textureData->mainTextureResourceView,
+ textureSampler, matrix);
}
static void
@@ -3045,13 +3041,13 @@ D3D12_CreateRenderer(SDL_Window * window, Uint32 flags)
D3D12_RenderData *data;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (D3D12_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 4f6f1e5..bdb0d2b 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -173,8 +173,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
{
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
- if (!data->debug_enabled)
- {
+ if (!data->debug_enabled) {
return;
}
if (data->GL_ARB_debug_output_supported) {
@@ -201,8 +200,7 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file,
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
int ret = 0;
- if (!data->debug_enabled)
- {
+ if (!data->debug_enabled) {
return 0;
}
if (data->GL_ARB_debug_output_supported) {
@@ -313,7 +311,7 @@ GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h)
result = result->next;
}
- if (!result) {
+ if (result == NULL) {
result = SDL_malloc(sizeof(GL_FBOList));
if (result) {
result->w = w;
@@ -478,7 +476,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
@@ -580,8 +578,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexImage2D(textype, 0, internalFormat, texture_w,
texture_h, 0, format, type, data->pixels);
renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
- }
- else
+ } else
#endif
{
renderdata->glTexImage2D(textype, 0, internalFormat, texture_w,
@@ -938,7 +935,7 @@ GL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FP
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -959,7 +956,7 @@ GL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPo
const size_t vertlen = (sizeof (GLfloat) * 2) * count;
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
cmd->data.draw.count = count;
@@ -1005,7 +1002,7 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
size_t sz = 2 * sizeof(GLfloat) + 4 * sizeof(Uint8) + (texture ? 2 : 0) * sizeof(GLfloat);
verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -1459,7 +1456,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
temp_pixels = SDL_malloc(rect->h * temp_pitch);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
@@ -1526,7 +1523,7 @@ GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->drawstate.target = NULL;
}
- if (!data) {
+ if (data == NULL) {
return;
}
if (data->texture) {
@@ -1760,13 +1757,13 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
#endif
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
goto error;
}
data = (GL_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
goto error;
@@ -1861,7 +1858,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
}
hint = SDL_getenv("GL_ARB_texture_non_power_of_two");
- if (!hint || *hint != '0') {
+ if (hint == NULL || *hint != '0') {
SDL_bool isGL2 = SDL_FALSE;
const char *verstr = (const char *)data->glGetString(GL_VERSION);
if (verstr) {
diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c
index 4db0835..4c06350 100644
--- a/src/render/opengl/SDL_shaders_gl.c
+++ b/src/render/opengl/SDL_shaders_gl.c
@@ -479,7 +479,7 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
}
ctx->glUseProgramObjectARB(0);
- return (ctx->glGetError() == GL_NO_ERROR);
+ return ctx->glGetError() == GL_NO_ERROR;
}
static void
@@ -498,7 +498,7 @@ GL_CreateShaderContext(void)
int i;
ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx));
- if (!ctx) {
+ if (ctx == NULL) {
return NULL;
}
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index ba08a46..462b3fe 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -329,7 +329,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
@@ -424,7 +424,7 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
src = (Uint8 *)pixels;
if (pitch != srcPitch) {
blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
- if (!blob) {
+ if (blob == NULL) {
return SDL_OutOfMemory();
}
src = blob;
@@ -544,7 +544,7 @@ GLES_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -565,7 +565,7 @@ GLES_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
const size_t vertlen = (sizeof (GLfloat) * 2) * count;
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
cmd->data.draw.count = count;
@@ -611,7 +611,7 @@ GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *
int sz = 2 + 4 + (texture ? 2 : 0);
verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * sz * sizeof (GLfloat), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -918,7 +918,7 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
temp_pixels = SDL_malloc(rect->h * temp_pitch);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
@@ -979,7 +979,7 @@ GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->drawstate.target = NULL;
}
- if (!data) {
+ if (data == NULL) {
return;
}
if (data->texture) {
@@ -1095,13 +1095,13 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
}
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
goto error;
}
data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
GLES_DestroyRenderer(renderer);
SDL_OutOfMemory();
goto error;
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 41bf300..c5cfae6 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -421,7 +421,7 @@ GLES2_CacheProgram(GLES2_RenderData *data, GLuint vertex, GLuint fragment)
/* Create a program cache entry */
entry = (GLES2_ProgramCacheEntry *)SDL_calloc(1, sizeof(GLES2_ProgramCacheEntry));
- if (!entry) {
+ if (entry == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -500,7 +500,7 @@ GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, GLenum shader_t
const GLchar *shader_src_list[3];
const GLchar *shader_body = GLES2_GetShader(type);
- if (!shader_body) {
+ if (shader_body == NULL) {
SDL_SetError("No shader body src");
return 0;
}
@@ -711,7 +711,7 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int
/* Generate a matching program */
program = GLES2_CacheProgram(data, vertex, fragment);
- if (!program) {
+ if (program == NULL) {
goto fault;
}
@@ -746,7 +746,7 @@ GLES2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -780,7 +780,7 @@ GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -839,7 +839,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
if (texture) {
SDL_Vertex *verts = (SDL_Vertex *) SDL_AllocateRenderVertices(renderer, count * sizeof (*verts), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -879,7 +879,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
} else {
SDL_VertexSolid *verts = (SDL_VertexSolid *) SDL_AllocateRenderVertices(renderer, count * sizeof (*verts), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -1455,7 +1455,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
/* Allocate a texture struct */
data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData));
- if (!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
data->texture = 0;
@@ -1591,12 +1591,11 @@ GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint
src = (Uint8 *)pixels;
if (pitch != src_pitch) {
blob = (Uint8 *)SDL_malloc(src_pitch * height);
- if (!blob) {
+ if (blob == NULL) {
return SDL_OutOfMemory();
}
src = blob;
- for (y = 0; y < height; ++y)
- {
+ for (y = 0; y < height; ++y) {
SDL_memcpy(src, pixels, src_pitch);
src += src_pitch;
pixels = (Uint8 *)pixels + pitch;
@@ -1609,7 +1608,7 @@ GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint
int i;
Uint32 *src32 = (Uint32 *)src;
blob2 = (Uint32 *)SDL_malloc(src_pitch * height);
- if (!blob2) {
+ if (blob2 == NULL) {
if (blob) {
SDL_free(blob);
}
@@ -1946,7 +1945,7 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
}
temp_pixels = SDL_malloc(buflen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
@@ -2110,13 +2109,13 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
/* Create the renderer struct */
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(SDL_Renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
goto error;
}
data = (GLES2_RenderData *)SDL_calloc(1, sizeof(GLES2_RenderData));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
goto error;
diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c
index cd7f6f1..e59b733 100644
--- a/src/render/opengles2/SDL_shaders_gles2.c
+++ b/src/render/opengles2/SDL_shaders_gles2.c
@@ -382,12 +382,15 @@ GLES2_ShaderIncludeType GLES2_GetTexCoordPrecisionEnumFromHint()
const char *texcoord_hint = SDL_GetHint("SDL_RENDER_OPENGLES2_TEXCOORD_PRECISION");
GLES2_ShaderIncludeType value = GLES2_SHADER_FRAGMENT_INCLUDE_BEST_TEXCOORD_PRECISION;
if (texcoord_hint) {
- if (SDL_strcmp(texcoord_hint, "undefined") == 0)
+ if (SDL_strcmp(texcoord_hint, "undefined") == 0) {
return GLES2_SHADER_FRAGMENT_INCLUDE_UNDEF_PRECISION;
- if (SDL_strcmp(texcoord_hint, "high") == 0)
+ }
+ if (SDL_strcmp(texcoord_hint, "high") == 0) {
return GLES2_SHADER_FRAGMENT_INCLUDE_HIGH_TEXCOORD_PRECISION;
- if (SDL_strcmp(texcoord_hint, "medium") == 0)
+ }
+ if (SDL_strcmp(texcoord_hint, "medium") == 0) {
return GLES2_SHADER_FRAGMENT_INCLUDE_MEDIUM_TEXCOORD_PRECISION;
+ }
}
return value;
}
diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c
index f385f53..6070523 100644
--- a/src/render/ps2/SDL_render_ps2.c
+++ b/src/render/ps2/SDL_render_ps2.c
@@ -66,7 +66,9 @@ static int vsync_handler()
/* Copy of gsKit_sync_flip, but without the 'flip' */
static void gsKit_sync(GSGLOBAL *gsGlobal)
{
- if (!gsGlobal->FirstFrame) WaitSema(vsync_sema_id);
+ if (!gsGlobal->FirstFrame) {
+ WaitSema(vsync_sema_id);
+ }
while (PollSema(vsync_sema_id) >= 0)
;
}
@@ -74,10 +76,8 @@ static void gsKit_sync(GSGLOBAL *gsGlobal)
/* Copy of gsKit_sync_flip, but without the 'sync' */
static void gsKit_flip(GSGLOBAL *gsGlobal)
{
- if (!gsGlobal->FirstFrame)
- {
- if (gsGlobal->DoubleBuffering == GS_SETTING_ON)
- {
+ if (!gsGlobal->FirstFrame) {
+ if (gsGlobal->DoubleBuffering == GS_SETTING_ON) {
GS_SET_DISPFB2( gsGlobal->ScreenBuffer[
gsGlobal->ActiveBuffer & 1] / 8192,
gsGlobal->Width / 64, gsGlobal->PSM, 0, 0 );
@@ -111,16 +111,16 @@ PS2_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
GSTEXTURE* ps2_tex = (GSTEXTURE*) SDL_calloc(1, sizeof(GSTEXTURE));
- if (!ps2_tex)
+ if (ps2_tex == NULL) {
return SDL_OutOfMemory();
+ }
ps2_tex->Width = texture->w;
ps2_tex->Height = texture->h;
ps2_tex->PSM = PixelFormatToPS2PSM(texture->format);
ps2_tex->Mem = memalign(128, gsKit_texture_size_ee(ps2_tex->Width, ps2_tex->Height, ps2_tex->PSM));
- if (!ps2_tex->Mem)
- {
+ if (!ps2_tex->Mem) {
SDL_free(ps2_tex);
return SDL_OutOfMemory();
}
@@ -215,7 +215,7 @@ PS2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
gs_rgbaq rgbaq;
int i;
- if (!vertices) {
+ if (vertices == NULL) {
return -1;
}
@@ -250,7 +250,7 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
if (texture) {
GSPRIMSTQPOINT *vertices = (GSPRIMSTQPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMSTQPOINT), 4, &cmd->data.draw.first);
- if (!vertices) {
+ if (vertices == NULL) {
return -1;
}
@@ -283,7 +283,7 @@ PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
} else {
GSPRIMPOINT *vertices = (GSPRIMPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof (GSPRIMPOINT), 4, &cmd->data.draw.first);
- if (!vertices) {
+ if (vertices == NULL) {
return -1;
}
@@ -333,7 +333,7 @@ PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
const SDL_Rect *rect = &cmd->data.cliprect.rect;
- if(cmd->data.cliprect.enabled){
+ if (cmd->data.cliprect.enabled) {
gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(rect->x, rect->y, rect->w, rect->h));
} else {
gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET);
@@ -521,18 +521,20 @@ PS2_RenderPresent(SDL_Renderer * renderer)
PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata;
if (data->gsGlobal->DoubleBuffering == GS_SETTING_OFF) {
- if (data->vsync == 2) // Dynamic
+ if (data->vsync == 2) { // Dynamic
gsKit_sync(data->gsGlobal);
- else if (data->vsync == 1)
+ } else if (data->vsync == 1) {
gsKit_vsync_wait();
+ }
gsKit_queue_exec(data->gsGlobal);
} else {
gsKit_queue_exec(data->gsGlobal);
gsKit_finish();
- if (data->vsync == 2) // Dynamic
+ if (data->vsync == 2) { // Dynamic
gsKit_sync(data->gsGlobal);
- else if (data->vsync == 1)
+ } else if (data->vsync == 1) {
gsKit_vsync_wait();
+ }
gsKit_flip(data->gsGlobal);
}
gsKit_TexManager_nextFrame(data->gsGlobal);
@@ -546,11 +548,13 @@ PS2_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata;
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
- if (data == NULL)
+ if (data == NULL) {
return;
+ }
- if(ps2_texture == NULL)
+ if (ps2_texture == NULL) {
return;
+ }
// Free from vram
gsKit_TexManager_free(data->gsGlobal, ps2_texture);
@@ -574,8 +578,9 @@ PS2_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(data);
}
- if (vsync_sema_id >= 0)
+ if (vsync_sema_id >= 0) {
DeleteSema(vsync_sema_id);
+ }
SDL_free(renderer);
}
@@ -599,13 +604,13 @@ PS2_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_bool dynamicVsync;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (PS2_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
PS2_DestroyRenderer(renderer);
SDL_OutOfMemory();
return NULL;
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 9a4e5c7..8c199ac 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -182,19 +182,22 @@ static int
TextureNextPow2(unsigned int w)
{
unsigned int n = 2;
- if(w == 0)
+ if (w == 0) {
return 0;
+ }
- while(w > n)
+ while (w > n) {
n <<= 1;
+ }
return n;
}
static void psp_on_vblank(u32 sub, PSP_RenderData *data)
{
- if (data)
+ if (data) {
data->vblank_not_reached = SDL_FALSE;
+ }
}
@@ -218,10 +221,10 @@ PixelFormatToPSPFMT(Uint32 format)
///SECTION render target LRU management
static void
LRUTargetRelink(PSP_TextureData* psp_texture) {
- if(psp_texture->prevhotw) {
+ if (psp_texture->prevhotw) {
psp_texture->prevhotw->nexthotw = psp_texture->nexthotw;
}
- if(psp_texture->nexthotw) {
+ if (psp_texture->nexthotw) {
psp_texture->nexthotw->prevhotw = psp_texture->prevhotw;
}
}
@@ -229,11 +232,11 @@ LRUTargetRelink(PSP_TextureData* psp_texture) {
static void
LRUTargetPushFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
psp_texture->nexthotw = data->most_recent_target;
- if(data->most_recent_target) {
+ if (data->most_recent_target) {
data->most_recent_target->prevhotw = psp_texture;
}
data->most_recent_target = psp_texture;
- if(!data->least_recent_target) {
+ if (!data->least_recent_target) {
data->least_recent_target = psp_texture;
}
}
@@ -241,10 +244,10 @@ LRUTargetPushFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
static void
LRUTargetRemove(PSP_RenderData* data, PSP_TextureData* psp_texture) {
LRUTargetRelink(psp_texture);
- if(data->most_recent_target == psp_texture) {
+ if (data->most_recent_target == psp_texture) {
data->most_recent_target = psp_texture->nexthotw;
}
- if(data->least_recent_target == psp_texture) {
+ if (data->least_recent_target == psp_texture) {
data->least_recent_target = psp_texture->prevhotw;
}
psp_texture->prevhotw = NULL;
@@ -253,7 +256,7 @@ LRUTargetRemove(PSP_RenderData* data, PSP_TextureData* psp_texture) {
static void
LRUTargetBringFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
- if(data->most_recent_target == psp_texture) {
+ if (data->most_recent_target == psp_texture) {
return; //nothing to do
}
LRUTargetRemove(data, psp_texture);
@@ -262,7 +265,7 @@ LRUTargetBringFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
static void
TextureStorageFree(void* storage) {
- if(InVram(storage)) {
+ if (InVram(storage)) {
vfree(storage);
} else {
SDL_free(storage);
@@ -279,8 +282,9 @@ TextureSwizzle(PSP_TextureData *psp_texture, void* dst)
unsigned int *src = NULL;
unsigned char *data = NULL;
- if(psp_texture->swizzled)
+ if (psp_texture->swizzled) {
return 1;
+ }
bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
height = psp_texture->size / bytewidth;
@@ -291,21 +295,21 @@ TextureSwizzle(PSP_TextureData *psp_texture, void* dst)
src = (unsigned int*) psp_texture->data;
data = dst;
- if(!data) {
+ if (data == NULL) {
data = SDL_malloc(psp_texture->size);
}
- if(!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
- for(j = 0; j < height; j++, blockaddress += 16)
+ for (j = 0; j < height; j++, blockaddress += 16)
{
unsigned int *block;
block = (unsigned int*)&data[blockaddress];
- for(i = 0; i < rowblocks; i++)
+ for (i = 0; i < rowblocks; i++)
{
*block++ = *src++;
*block++ = *src++;
@@ -314,8 +318,9 @@ TextureSwizzle(PSP_TextureData *psp_texture, void* dst)
block += 28;
}
- if((j & 0x7) == 0x7)
+ if ((j & 0x7) == 0x7) {
blockaddress += rowblocksadd;
+ }
}
TextureStorageFree(psp_texture->data);
@@ -338,8 +343,9 @@ TextureUnswizzle(PSP_TextureData *psp_texture, void* dst)
unsigned char *data = NULL;
unsigned char *ydst = NULL;
- if(!psp_texture->swizzled)
+ if (!psp_texture->swizzled) {
return 1;
+ }
bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
height = psp_texture->size / bytewidth;
@@ -354,26 +360,27 @@ TextureUnswizzle(PSP_TextureData *psp_texture, void* dst)
data = dst;
- if(!data) {
+ if (data == NULL) {
data = SDL_malloc(psp_texture->size);
}
- if(!data)
+ if (data == NULL) {
return SDL_OutOfMemory();
+ }
ydst = (unsigned char *)data;
- for(blocky = 0; blocky < heightblocks; ++blocky)
+ for (blocky = 0; blocky < heightblocks; ++blocky)
{
unsigned char *xdst = ydst;
- for(blockx = 0; blockx < widthblocks; ++blockx)
+ for (blockx = 0; blockx < widthblocks; ++blockx)
{
unsigned int *block;
block = (unsigned int*)xdst;
- for(j = 0; j < 8; ++j)
+ for (j = 0; j < 8; ++j)
{
*(block++) = *(src++);
*(block++) = *(src++);
@@ -402,10 +409,10 @@ static int
TextureSpillToSram(PSP_RenderData* data, PSP_TextureData* psp_texture)
{
// Assumes the texture is in VRAM
- if(psp_texture->swizzled) {
+ if (psp_texture->swizzled) {
//Texture was swizzled in vram, just copy to system memory
void* sdata = SDL_malloc(psp_texture->size);
- if(!sdata) {
+ if (sdata == NULL) {
return SDL_OutOfMemory();
}
@@ -423,7 +430,7 @@ TexturePromoteToVram(PSP_RenderData* data, PSP_TextureData* psp_texture, SDL_boo
{
// Assumes texture in sram and a large enough continuous block in vram
void* tdata = vramalloc(psp_texture->size);
- if(psp_texture->swizzled && target) {
+ if (psp_texture->swizzled && target) {
return TextureUnswizzle(psp_texture, tdata);
} else {
SDL_memcpy(tdata, psp_texture->data, psp_texture->size);
@@ -436,8 +443,8 @@ TexturePromoteToVram(PSP_RenderData* data, PSP_TextureData* psp_texture, SDL_boo
static int
TextureSpillLRU(PSP_RenderData* data, size_t wanted) {
PSP_TextureData* lru = data->least_recent_target;
- if(lru) {
- if(TextureSpillToSram(data, lru) < 0) {
+ if (lru) {
+ if (TextureSpillToSram(data, lru) < 0) {
return -1;
}
LRUTargetRemove(data, lru);
@@ -451,8 +458,8 @@ TextureSpillLRU(PSP_RenderData* data, size_t wanted) {
static int
TextureSpillTargetsForSpace(PSP_RenderData* data, size_t size)
{
- while(vlargestblock() < size) {
- if(TextureSpillLRU(data, size) < 0) {
+ while (vlargestblock() < size) {
+ if (TextureSpillLRU(data, size) < 0) {
return -1;
}
}
@@ -463,12 +470,12 @@ static int
TextureBindAsTarget(PSP_RenderData* data, PSP_TextureData* psp_texture) {
unsigned int dstFormat;
- if(!InVram(psp_texture->data)) {
+ if (!InVram(psp_texture->data)) {
// Bring back the texture in vram
- if(TextureSpillTargetsForSpace(data, psp_texture->size) < 0) {
+ if (TextureSpillTargetsForSpace(data, psp_texture->size) < 0) {
return -1;
}
- if(TexturePromoteToVram(data, psp_texture, SDL_TRUE) < 0) {
+ if (TexturePromoteToVram(data, psp_texture, SDL_TRUE) < 0) {
return -1;
}
}
@@ -477,7 +484,7 @@ TextureBindAsTarget(PSP_RenderData* data, PSP_TextureData* psp_texture) {
// Stencil alpha dst hack
dstFormat = psp_texture->format;
- if(dstFormat == GU_PSM_5551) {
+ if (dstFormat == GU_PSM_5551) {
sceGuEnable(GU_STENCIL_TEST);
sceGuStencilOp(GU_REPLACE, GU_REPLACE, GU_REPLACE);
sceGuStencilFunc(GU_GEQUAL, 0xff, 0xff);
@@ -502,8 +509,9 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
PSP_RenderData *data = renderer->driverdata;
PSP_TextureData* psp_texture = (PSP_TextureData*) SDL_calloc(1, sizeof(*psp_texture));
- if(!psp_texture)
+ if (psp_texture == NULL) {
return SDL_OutOfMemory();
+ }
psp_texture->swizzled = SDL_FALSE;
psp_texture->width = texture->w;
@@ -531,21 +539,20 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
psp_texture->size = psp_texture->textureHeight*psp_texture->pitch;
- if(texture->access & SDL_TEXTUREACCESS_TARGET) {
- if(TextureSpillTargetsForSpace(renderer->driverdata, psp_texture->size) < 0){
+ if (texture->access & SDL_TEXTUREACCESS_TARGET) {
+ if (TextureSpillTargetsForSpace(renderer->driverdata, psp_texture->size) < 0) {
SDL_free(psp_texture);
return -1;
}
psp_texture->data = vramalloc(psp_texture->size);
- if(psp_texture->data) {
+ if (psp_texture->data) {
LRUTargetPushFront(data, psp_texture);
}
} else {
psp_texture->data = SDL_calloc(1, psp_texture->size);
}
- if(!psp_texture->data)
- {
+ if (!psp_texture->data) {
SDL_free(psp_texture);
return SDL_OutOfMemory();
}
@@ -569,8 +576,7 @@ TextureActivate(SDL_Texture * texture)
int scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GU_NEAREST : GU_LINEAR;
/* Swizzling is useless with small textures. */
- if (TextureShouldSwizzle(psp_texture, texture))
- {
+ if (TextureShouldSwizzle(psp_texture, texture)) {
TextureSwizzle(psp_texture, NULL);
}
@@ -662,7 +668,7 @@ PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertV), 4, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -692,7 +698,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
if (texture == NULL) {
VertCV *verts;
verts = (VertCV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertCV), 4, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -725,7 +731,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
VertTCV *verts;
verts = (VertTCV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertTCV), 4, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -771,7 +777,7 @@ PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FR
VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -806,10 +812,9 @@ PSP_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * tex
const float u1 = srcrect->x + srcrect->w;
const float v1 = srcrect->y + srcrect->h;
- if((MathAbs(u1) - MathAbs(u0)) < 64.0f)
- {
+ if ((MathAbs(u1) - MathAbs(u0)) < 64.0f) {
verts = (VertTV *) SDL_AllocateRenderVertices(renderer, 2 * sizeof (VertTV), 4, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -828,9 +833,7 @@ PSP_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * tex
verts->y = y + height;
verts->z = 0;
verts++;
- }
- else
- {
+ } else {
float start, end;
float curU = u0;
float curX = x;
@@ -840,18 +843,19 @@ PSP_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * tex
size_t i;
float ustep = (u1 - u0)/width * slice;
- if(ustep < 0.0f)
+ if (ustep < 0.0f) {
ustep = -ustep;
+ }
cmd->data.draw.count = count;
verts = (VertTV *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertTV), 4, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
- for(i = 0, start = 0, end = width; i < count; i++, start += slice)
+ for (i = 0, start = 0, end = width; i < count; i++, start += slice)
{
const float polyWidth = ((curX + slice) > endX) ? (endX - curX) : slice;
const float sourceWidth = ((curU + ustep) > u1) ? (u1 - curU) : ustep;
@@ -900,7 +904,7 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t
float u1 = srcrect->x + srcrect->w;
float v1 = srcrect->y + srcrect->h;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -986,16 +990,16 @@ StartDrawing(SDL_Renderer * renderer)
PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
// Check if we need to start GU displaylist
- if(!data->displayListAvail) {
+ if (!data->displayListAvail) {
sceGuStart(GU_DIRECT, DisplayList);
data->displayListAvail = SDL_TRUE;
//ResetBlendState(&data->blendState);
}
// Check if we need a draw buffer change
- if(renderer->target != data->boundTarget) {
+ if (renderer->target != data->boundTarget) {
SDL_Texture* texture = renderer->target;
- if(texture) {
+ if (texture) {
PSP_TextureData* psp_texture = (PSP_TextureData*) texture->driverdata;
// Set target, registering LRU
TextureBindAsTarget(data, psp_texture);
@@ -1044,16 +1048,16 @@ PSP_SetBlendState(PSP_RenderData* data, PSP_BlendState* state)
}
}
- if(state->color != current->color) {
+ if (state->color != current->color) {
sceGuColor(state->color);
}
- if(state->shadeModel != current->shadeModel) {
+ if (state->shadeModel != current->shadeModel) {
sceGuShadeModel(state->shadeModel);
}
- if(state->texture != current->texture) {
- if(state->texture != NULL) {
+ if (state->texture != current->texture) {
+ if (state->texture != NULL) {
TextureActivate(state->texture);
sceGuEnable(GU_TEXTURE_2D);
} else {
@@ -1078,7 +1082,7 @@ PSP_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
rendering backends report a reasonable maximum, so the higher level can flush
if we appear to be exceeding that. */
gpumem = (Uint8 *) sceGuGetMemory(vertsize);
- if (!gpumem) {
+ if (gpumem == NULL) {
return SDL_SetError("Couldn't obtain a %d-byte vertex buffer!", (int) vertsize);
}
SDL_memcpy(gpumem, vertices, vertsize);
@@ -1099,7 +1103,7 @@ PSP_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
case SDL_RENDERCMD_SETCLIPRECT: {
const SDL_Rect *rect = &cmd->data.cliprect.rect;
- if(cmd->data.cliprect.enabled){
+ if (cmd->data.cliprect.enabled) {
sceGuEnable(GU_SCISSOR_TEST);
sceGuScissor(rect->x, rect->y, rect->w, rect->h);
} else {
@@ -1264,8 +1268,9 @@ PSP_RenderPresent(SDL_Renderer * renderer)
sceGuFinish();
sceGuSync(0,0);
- if ((data->vsync) && (data->vblank_not_reached))
+ if ((data->vsync) && (data->vblank_not_reached)) {
sceDisplayWaitVblankStart();
+ }
data->vblank_not_reached = SDL_TRUE;
data->backbuffer = data->frontbuffer;
@@ -1280,11 +1285,13 @@ PSP_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
- if (renderdata == NULL)
+ if (renderdata == NULL) {
return;
+ }
- if(psp_texture == NULL)
+ if (psp_texture == NULL) {
return;
+ }
LRUTargetRemove(renderdata, psp_texture);
TextureStorageFree(psp_texture->data);
@@ -1297,8 +1304,9 @@ PSP_DestroyRenderer(SDL_Renderer * renderer)
{
PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
if (data) {
- if (!data->initialized)
+ if (!data->initialized) {
return;
+ }
StartDrawing(renderer);
@@ -1335,13 +1343,13 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
void* doublebuffer = NULL;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (PSP_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
PSP_DestroyRenderer(renderer);
SDL_OutOfMemory();
return NULL;
diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c
index 569c150..d068232 100644
--- a/src/render/software/SDL_blendfillrect.c
+++ b/src/render/software/SDL_blendfillrect.c
@@ -219,7 +219,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect,
{
SDL_Rect clipped;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
}
@@ -290,7 +290,7 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
int status = 0;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
}
@@ -334,7 +334,7 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
break;
}
- if (!func) {
+ if (func == NULL) {
if (!dst->format->Amask) {
func = SDL_BlendFillRect_RGB;
} else {
diff --git a/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c
index 4921bf1..f7631c2 100644
--- a/src/render/software/SDL_blendline.c
+++ b/src/render/software/SDL_blendline.c
@@ -808,12 +808,12 @@ SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2,
{
BlendLineFunc func;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_BlendLine(): dst");
}
func = SDL_CalculateBlendLineFunc(dst->format);
- if (!func) {
+ if (func == NULL) {
return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
}
@@ -837,12 +837,12 @@ SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count,
SDL_bool draw_end;
BlendLineFunc func;
- if (!dst) {
+ if (dst == NULL) {
return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
}
func = SDL_CalculateBlendLineFunc(dst->format);
- if (!func) {
+ if (func == NULL) {
return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
}
diff --git a/src/render/software/SDL_blendpoint.c b/src/render/software/SDL_blendpoint.c
index 613169b..ffbf866 100644
--- a/src/render/software/SDL_blendpoint.c
+++ b/src/render/software/SDL_blendpoint.c
@@ -217,7 +217,7 @@ int
SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
Uint8 g, Uint8 b, Uint8 a)
{
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
}
@@ -286,7 +286,7 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
int status = 0;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
}
@@ -332,7 +332,7 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
break;
}
- if (!func) {
+ if (func == NULL) {
if (!dst->format->Amask) {
func = SDL_BlendPoint_RGB;
} else {
diff --git a/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c
index e309f16..76f4b60 100644
--- a/src/render/software/SDL_drawline.c
+++ b/src/render/software/SDL_drawline.c
@@ -143,12 +143,12 @@ SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color)
{
DrawLineFunc func;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_DrawLine(): dst");
}
func = SDL_CalculateDrawLineFunc(dst->format);
- if (!func) {
+ if (func == NULL) {
return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
}
@@ -172,12 +172,12 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count,
SDL_bool draw_end;
DrawLineFunc func;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_DrawLines(): dst");
}
func = SDL_CalculateDrawLineFunc(dst->format);
- if (!func) {
+ if (func == NULL) {
return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
}
diff --git a/src/render/software/SDL_drawpoint.c b/src/render/software/SDL_drawpoint.c
index b99838a..5c16075 100644
--- a/src/render/software/SDL_drawpoint.c
+++ b/src/render/software/SDL_drawpoint.c
@@ -29,7 +29,7 @@
int
SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color)
{
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
}
@@ -70,7 +70,7 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count,
int i;
int x, y;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
}
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 6ba77d4..9141a7a 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -142,8 +142,9 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int row;
size_t length;
- if(SDL_MUSTLOCK(surface))
+ if (SDL_MUSTLOCK(surface)) {
SDL_LockSurface(surface);
+ }
src = (Uint8 *) pixels;
dst = (Uint8 *) surface->pixels +
rect->y * surface->pitch +
@@ -154,8 +155,9 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
src += pitch;
dst += surface->pitch;
}
- if(SDL_MUSTLOCK(surface))
+ if (SDL_MUSTLOCK(surface)) {
SDL_UnlockSurface(surface);
+ }
return 0;
}
@@ -207,7 +209,7 @@ SW_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FP
SDL_Point *verts = (SDL_Point *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Point), 0, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -227,7 +229,7 @@ SW_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRe
SDL_Rect *verts = (SDL_Rect *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Rect), 0, &cmd->data.draw.first);
int i;
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -249,7 +251,7 @@ SW_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * text
{
SDL_Rect *verts = (SDL_Rect *) SDL_AllocateRenderVertices(renderer, 2 * sizeof (SDL_Rect), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -284,7 +286,7 @@ SW_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te
{
CopyExData *verts = (CopyExData *) SDL_AllocateRenderVertices(renderer, sizeof (CopyExData), 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -340,7 +342,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex
int blitRequired = SDL_FALSE;
int isOpaque = SDL_FALSE;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -559,7 +561,7 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
int sz = texture ? sizeof (GeometryCopyData) : sizeof (GeometryFillData);
verts = (void *) SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first);
- if (!verts) {
+ if (verts == NULL) {
return -1;
}
@@ -684,7 +686,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
SDL_Surface *surface = SW_ActivateRenderer(renderer);
SW_DrawStateCache drawstate;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -960,7 +962,7 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 src_format;
void *src_pixels;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -988,7 +990,7 @@ SW_RenderPresent(SDL_Renderer * renderer)
{
SDL_Window *window = renderer->window;
- if (!window) {
+ if (window == NULL) {
return -1;
}
return SDL_UpdateWindowSurface(window);
@@ -1017,19 +1019,19 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
SDL_Renderer *renderer;
SW_RenderData *data;
- if (!surface) {
+ if (surface == NULL) {
SDL_InvalidParamError("surface");
return NULL;
}
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (SW_RenderData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SW_DestroyRenderer(renderer);
SDL_OutOfMemory();
return NULL;
@@ -1075,7 +1077,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
/* Set the vsync hint based on our flags, if it's not already set */
hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
- if (!hint || !*hint) {
+ if (hint == NULL || !*hint) {
no_hint_set = SDL_TRUE;
} else {
no_hint_set = SDL_FALSE;
@@ -1092,7 +1094,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "");
}
- if (!surface) {
+ if (surface == NULL) {
return NULL;
}
return SW_CreateRendererForSurface(surface);
diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c
index ade0872..c3d6ebd 100644
--- a/src/render/software/SDL_rotate.c
+++ b/src/render/software/SDL_rotate.c
@@ -152,10 +152,13 @@ SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FP
{
/* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */
int angle90 = (int)(angle/90);
- if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */
+ if (angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */
angle90 %= 4;
- if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
- if(angle90 & 1) {
+ if (angle90 < 0) {
+ angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ }
+
+ if (angle90 & 1) {
rect_dest->w = height;
rect_dest->h = width;
*cangle = 0;
@@ -284,8 +287,12 @@ transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int isin, int icos,
for (x = 0; x < dst->w; x++) {
int dx = (sdx >> 16);
int dy = (sdy >> 16);
- if (flipx) dx = sw - dx;
- if (flipy) dy = sh - dy;
+ if (flipx) {
+ dx = sw - dx;
+ }
+ if (flipy) {
+ dy = sh - dy;
+ }
if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
int ex, ey;
int t1, t2;
@@ -341,8 +348,12 @@ transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int isin, int icos,
int dx = (sdx >> 16);
int dy = (sdy >> 16);
if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) {
- if(flipx) dx = sw - dx;
- if(flipy) dy = sh - dy;
+ if (flipx) {
+ dx = sw - dx;
+ }
+ if (flipy) {
+ dy = sh - dy;
+ }
*pc = *((tColorRGBA *)((Uint8 *)src->pixels + src->pitch * dy) + dx);
}
sdx += icos;
@@ -411,8 +422,12 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, int
int dx = (sdx >> 16);
int dy = (sdy >> 16);
if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) {
- if (flipx) dx = sw - dx;
- if (flipy) dy = sh- dy;
+ if (flipx) {
+ dx = sw - dx;
+ }
+ if (flipy) {
+ dy = sh - dy;
+ }
*pc = *((tColorY *)src->pixels + src->pitch * dy + dx);
}
sdx += icos;
@@ -463,8 +478,9 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
double sangleinv, cangleinv;
/* Sanity check */
- if (src == NULL)
+ if (src == NULL) {
return NULL;
+ }
if (SDL_HasColorKey(src)) {
if (SDL_GetColorKey(src, &colorkey) == 0) {
@@ -473,8 +489,9 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
}
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable;
- if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask)))
+ if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) {
return NULL;
+ }
/* Calculate target factors from sine/cosine and zoom */
sangleinv = sangle*65536.0;
@@ -501,8 +518,9 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
}
/* Check target */
- if (rz_dst == NULL)
+ if (rz_dst == NULL) {
return NULL;
+ }
/* Adjust for guard rows */
rz_dst->h = rect_dest->h;
@@ -542,14 +560,17 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
angle90 = (int)(angle/90);
if (angle90 == angle/90) {
angle90 %= 4;
- if (angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ if (angle90 < 0) {
+ angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ }
+
} else {
angle90 = -1;
}
if (is8bit) {
/* Call the 8-bit transformation routine to do the rotation */
- if(angle90 >= 0) {
+ if (angle90 >= 0) {
transformSurfaceY90(src, rz_dst, angle90, flipx, flipy);
} else {
transformSurfaceY(src, rz_dst, (int)sangleinv, (int)cangleinv,
diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c
index f70c079..38e2e2d 100644
--- a/src/render/software/SDL_triangle.c
+++ b/src/render/software/SDL_triangle.c
@@ -520,14 +520,26 @@ int SDL_SW_BlitTriangle(
maxx = srcrect.x + srcrect.w;
maxy = srcrect.y + srcrect.h;
if (srcrect.w > 0) {
- if (s0->x == maxx) s0->x--;
- if (s1->x == maxx) s1->x--;
- if (s2->x == maxx) s2->x--;
+ if (s0->x == maxx) {
+ s0->x--;
+ }
+ if (s1->x == maxx) {
+ s1->x--;
+ }
+ if (s2->x == maxx) {
+ s2->x--;
+ }
}
if (srcrect.h > 0) {
- if (s0->y == maxy) s0->y--;
- if (s1->y == maxy) s1->y--;
- if (s2->y == maxy) s2->y--;
+ if (s0->y == maxy) {
+ s0->y--;
+ }
+ if (s1->y == maxy) {
+ s1->y--;
+ }
+ if (s2->y == maxy) {
+ s2->y--;
+ }
}
}
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 1391b19..7456179 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -228,13 +228,13 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
VITA_GXM_RenderData *data;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
- if (!renderer) {
+ if (renderer == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (VITA_GXM_RenderData *) SDL_calloc(1, sizeof(VITA_GXM_RenderData));
- if (!data) {
+ if (data == NULL) {
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;
@@ -282,8 +282,7 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
sceSysmoduleLoadModule( SCE_SYSMODULE_RAZOR_CAPTURE );
#endif
- if (gxm_init(renderer) != 0)
- {
+ if (gxm_init(renderer) != 0) {
SDL_free(data);
SDL_free(renderer);
return NULL;
@@ -310,7 +309,7 @@ VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
VITA_GXM_TextureData* vita_texture = (VITA_GXM_TextureData*) SDL_calloc(1, sizeof(VITA_GXM_TextureData));
- if (!vita_texture) {
+ if (vita_texture == NULL) {
return SDL_OutOfMemory();
}
@@ -649,8 +648,7 @@ VITA_GXM_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
static void
VITA_GXM_SetBlendMode(VITA_GXM_RenderData *data, int blendMode)
{
- if (blendMode != data->currentBlendMode)
- {
+ if (blendMode != data->currentBlendMode) {
fragment_programs *in = &data->blendFragmentPrograms.blend_mode_blend;
switch (blendMode)
@@ -711,8 +709,7 @@ VITA_GXM_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const
cmd->data.draw.first = (size_t)vertex;
cmd->data.draw.count = count;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
vertex[i].x = points[i].x;
vertex[i].y = points[i].y;
vertex[i].color = color;
@@ -735,8 +732,7 @@ VITA_GXM_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const S
cmd->data.draw.first = (size_t)vertex;
cmd->data.draw.count = (count-1) * 2;
- for (int i = 0; i < count - 1; i++)
- {
+ for (int i = 0; i < count - 1; i++) {
vertex[i*2].x = points[i].x;
vertex[i*2].y = points[i].y;
vertex[i*2].color = color;
@@ -770,7 +766,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
data,
count * sizeof(texture_vertex));
- if (!vertices) {
+ if (vertices == NULL) {
return -1;
}
@@ -810,7 +806,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
data,
count * sizeof(color_vertex));
- if (!vertices) {
+ if (vertices == NULL) {
return -1;
}
@@ -1148,7 +1144,7 @@ VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
}
temp_pixels = SDL_malloc(buflen);
- if (!temp_pixels) {
+ if (temp_pixels == NULL) {
return SDL_OutOfMemory();
}
@@ -1236,14 +1232,17 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata;
- if (data == NULL)
+ if (data == NULL) {
return;
+ }
- if(vita_texture == NULL)
+ if (vita_texture == NULL) {
return;
+ }
- if(vita_texture->tex == NULL)
+ if (vita_texture->tex == NULL) {
return;
+ }
sceGxmFinish(data->gxm_context);
@@ -1259,8 +1258,9 @@ VITA_GXM_DestroyRenderer(SDL_Renderer *renderer)
{
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
if (data) {
- if (!data->initialized)
+ if (!data->initialized) {
return;
+ }
gxm_finish(renderer);
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/src/render/vitagxm/SDL_render_vita_gxm_memory.c
index 85d682a..dee8d60 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_memory.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm_memory.c
@@ -38,14 +38,17 @@ vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, uns
*uid = sceKernelAllocMemBlock("gpu_mem", type, size, NULL);
- if (*uid < 0)
+ if (*uid < 0) {
return NULL;
+ }
- if (sceKernelGetMemBlockBase(*uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(*uid, &mem) < 0) {
return NULL;
+ }
- if (sceGxmMapMemory(mem, size, attribs) < 0)
+ if (sceGxmMapMemory(mem, size, attribs) < 0) {
return NULL;
+ }
return mem;
}
@@ -54,8 +57,9 @@ void
vita_mem_free(SceUID uid)
{
void *mem = NULL;
- if (sceKernelGetMemBlockBase(uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(uid, &mem) < 0) {
return;
+ }
sceGxmUnmapMemory(mem);
sceKernelFreeMemBlock(uid);
}
@@ -82,8 +86,7 @@ vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
}
ret = sceKernelGetMemBlockBase(data->texturePoolUID, &mem);
- if ( ret < 0)
- {
+ if ( ret < 0) {
return NULL;
}
data->texturePool = sceClibMspaceCreate(mem, poolsize);
@@ -92,8 +95,7 @@ vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
return NULL;
}
ret = sceGxmMapMemory(mem, poolsize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE);
- if (ret < 0)
- {
+ if (ret < 0) {
return NULL;
}
}
@@ -103,8 +105,7 @@ vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
void
vita_gpu_mem_free(VITA_GXM_RenderData *data, void* ptr)
{
- if (data->texturePool != NULL)
- {
+ if (data->texturePool != NULL) {
sceClibMspaceFree(data->texturePool, ptr);
}
}
@@ -113,12 +114,12 @@ void
vita_gpu_mem_destroy(VITA_GXM_RenderData *data)
{
void *mem = NULL;
- if (data->texturePool != NULL)
- {
+ if (data->texturePool != NULL) {
sceClibMspaceDestroy(data->texturePool);
data->texturePool = NULL;
- if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0)
+ if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0) {
return;
+ }
sceGxmUnmapMemory(mem);
sceKernelFreeMemBlock(data->texturePoolUID);
}
@@ -132,10 +133,12 @@ vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_of
size = ALIGN(size, 4096);
*uid = sceKernelAllocMemBlock("vertex_usse", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, size, NULL);
- if (sceKernelGetMemBlockBase(*uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(*uid, &mem) < 0) {
return NULL;
- if (sceGxmMapVertexUsseMemory(mem, size, usse_offset) < 0)
+ }
+ if (sceGxmMapVertexUsseMemory(mem, size, usse_offset) < 0) {
return NULL;
+ }
return mem;
}
@@ -144,8 +147,9 @@ void
vita_mem_vertex_usse_free(SceUID uid)
{
void *mem = NULL;
- if (sceKernelGetMemBlockBase(uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(uid, &mem) < 0) {
return;
+ }
sceGxmUnmapVertexUsseMemory(mem);
sceKernelFreeMemBlock(uid);
}
@@ -158,10 +162,12 @@ vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_
size = ALIGN(size, 4096);
*uid = sceKernelAllocMemBlock("fragment_usse", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, size, NULL);
- if (sceKernelGetMemBlockBase(*uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(*uid, &mem) < 0) {
return NULL;
- if (sceGxmMapFragmentUsseMemory(mem, size, usse_offset) < 0)
+ }
+ if (sceGxmMapFragmentUsseMemory(mem, size, usse_offset) < 0) {
return NULL;
+ }
return mem;
}
@@ -170,8 +176,9 @@ void
vita_mem_fragment_usse_free(SceUID uid)
{
void *mem = NULL;
- if (sceKernelGetMemBlockBase(uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(uid, &mem) < 0) {
return;
+ }
sceGxmUnmapFragmentUsseMemory(mem);
sceKernelFreeMemBlock(uid);
}
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
index 10deb55..1151a5d 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
@@ -260,7 +260,7 @@ set_stencil_mask(VITA_GXM_RenderData *data, float x, float y, float w, float h)
void
set_clip_rectangle(VITA_GXM_RenderData *data, int x_min, int y_min, int x_max, int y_max)
{
- if(data->drawing) {
+ if (data->drawing) {
// clear the stencil buffer to 0
sceGxmSetFrontStencilFunc(
data->gxm_context,
@@ -750,8 +750,7 @@ gxm_init(SDL_Renderer *renderer)
&data->linearIndicesUid
);
- for (i = 0; i <= UINT16_MAX; ++i)
- {
+ for (i = 0; i <= UINT16_MAX; ++i) {
data->linearIndices[i] = i;
}
@@ -929,8 +928,7 @@ void gxm_finish(SDL_Renderer *renderer)
// clean up display queue
vita_mem_free(data->depthBufferUid);
- for (size_t i = 0; i < VITA_GXM_BUFFERS; i++)
- {
+ for (size_t i = 0; i < VITA_GXM_BUFFERS; i++) {
// clear the buffer then deallocate
SDL_memset(data->displayBufferData[i], 0, VITA_GXM_SCREEN_HEIGHT * VITA_GXM_SCREEN_STRIDE * 4);
vita_mem_free(data->displayBufferUid[i]);
@@ -1050,8 +1048,9 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc
tex_size += (((aligned_w + 1) / 2) * ((h + 1) / 2)) * 2;
}
- if (!texture)
+ if (texture == NULL) {
return NULL;
+ }
*return_w = w;
*return_h = h;
@@ -1064,7 +1063,7 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc
);
/* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */
- if (!texture_data) {
+ if (texture_data == NULL) {
SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n");
texture_data = vita_mem_alloc(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
@@ -1078,7 +1077,7 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc
texture->cdram = 1;
}
- if (!texture_data) {
+ if (texture_data == NULL) {
SDL_free(texture);
return NULL;
}
@@ -1211,8 +1210,7 @@ void gxm_minimal_term_for_common_dialog(void)
void gxm_init_for_common_dialog(void)
{
- for (int i = 0; i < VITA_GXM_BUFFERS; i += 1)
- {
+ for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) {
buffer_for_common_dialog[i].displayData.wait_vblank = SDL_TRUE;
buffer_for_common_dialog[i].displayData.address = vita_mem_alloc(
SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW,
@@ -1260,8 +1258,7 @@ void gxm_swap_for_common_dialog(void)
void gxm_term_for_common_dialog(void)
{
sceGxmDisplayQueueFinish();
- for (int i = 0; i < VITA_GXM_BUFFERS; i += 1)
- {
+ for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) {
vita_mem_free(buffer_for_common_dialog[i].uid);
sceGxmSyncObjectDestroy(buffer_for_common_dialog[i].sync);
}
diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c
index 6db4c63..6237498 100644
--- a/src/sensor/SDL_sensor.c
+++ b/src/sensor/SDL_sensor.c
@@ -79,7 +79,7 @@ SDL_SensorInit(void)
int i, status;
/* Create the sensor list lock */
- if (!SDL_sensor_lock) {
+ if (SDL_sensor_lock == NULL) {
SDL_sensor_lock = SDL_CreateMutex();
}
diff --git a/src/sensor/android/SDL_androidsensor.c b/src/sensor/android/SDL_androidsensor.c
index 27fb04c..69c3f28 100644
--- a/src/sensor/android/SDL_androidsensor.c
+++ b/src/sensor/android/SDL_androidsensor.c
@@ -56,14 +56,14 @@ SDL_ANDROID_SensorInit(void)
ASensorList sensors;
SDL_sensor_manager = ASensorManager_getInstance();
- if (!SDL_sensor_manager) {
+ if (SDL_sensor_manager == NULL) {
return SDL_SetError("Couldn't create sensor manager");
}
SDL_sensor_looper = ALooper_forThread();
- if (!SDL_sensor_looper) {
+ if (SDL_sensor_looper == NULL) {
SDL_sensor_looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
- if (!SDL_sensor_looper) {
+ if (SDL_sensor_looper == NULL) {
return SDL_SetError("Couldn't create sensor event loop");
}
}
@@ -72,7 +72,7 @@ SDL_ANDROID_SensorInit(void)
sensors_count = ASensorManager_getSensorList(SDL_sensor_manager, &sensors);
if (sensors_count > 0) {
SDL_sensors = (SDL_AndroidSensor *)SDL_calloc(sensors_count, sizeof(*SDL_sensors));
- if (!SDL_sensors) {
+ if (SDL_sensors == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/sensor/vita/SDL_vitasensor.c b/src/sensor/vita/SDL_vitasensor.c
index 3123f16..c1f28b4 100644
--- a/src/sensor/vita/SDL_vitasensor.c
+++ b/src/sensor/vita/SDL_vitasensor.c
@@ -55,7 +55,7 @@ SDL_VITA_SensorInit(void)
SDL_sensors_count = 2;
SDL_sensors = (SDL_VitaSensor *)SDL_calloc(SDL_sensors_count, sizeof(*SDL_sensors));
- if (!SDL_sensors) {
+ if (SDL_sensors == NULL) {
return SDL_OutOfMemory();
}
@@ -145,15 +145,12 @@ SDL_VITA_SensorUpdate(SDL_Sensor *sensor)
SDL_memset(motionState, 0, sizeof(motionState));
err = sceMotionGetSensorState(motionState, SCE_MOTION_MAX_NUM_STATES);
- if (err != 0)
- {
+ if (err != 0) {
return;
}
- for (int i = 0; i < SCE_MOTION_MAX_NUM_STATES; i++)
- {
- if (sensor->hwdata->counter < motionState[i].counter)
- {
+ for (int i = 0; i < SCE_MOTION_MAX_NUM_STATES; i++) {
+ if (sensor->hwdata->counter < motionState[i].counter) {
unsigned int timestamp = motionState[i].timestamp;
sensor->hwdata->counter = motionState[i].counter;
diff --git a/src/sensor/windows/SDL_windowssensor.c b/src/sensor/windows/SDL_windowssensor.c
index b2edffc..2a974b0 100644
--- a/src/sensor/windows/SDL_windowssensor.c
+++ b/src/sensor/windows/SDL_windowssensor.c
@@ -67,7 +67,7 @@ static int DisconnectSensor(ISensor *sensor);
static HRESULT STDMETHODCALLTYPE ISensorManagerEventsVtbl_QueryInterface(ISensorManagerEvents * This, REFIID riid, void **ppvObject)
{
- if (!ppvObject) {
+ if (ppvObject == NULL) {
return E_INVALIDARG;
}
@@ -107,7 +107,7 @@ static ISensorManagerEvents sensor_manager_events = {
static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_QueryInterface(ISensorEvents * This, REFIID riid, void **ppvObject)
{
- if (!ppvObject) {
+ if (ppvObject == NULL) {
return E_INVALIDARG;
}
@@ -286,7 +286,7 @@ static int ConnectSensor(ISensor *sensor)
if (bstr_name != NULL) {
SysFreeString(bstr_name);
}
- if (!name) {
+ if (name == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/stdlib/SDL_crc16.c b/src/stdlib/SDL_crc16.c
index 0008b2e..c73dad6 100644
--- a/src/stdlib/SDL_crc16.c
+++ b/src/stdlib/SDL_crc16.c
@@ -48,7 +48,7 @@ Uint16 SDL_crc16(Uint16 crc, const void *data, size_t len)
{
/* As an optimization we can precalculate a 256 entry table for each byte */
size_t i;
- for(i = 0; i < len; ++i) {
+ for (i = 0; i < len; ++i) {
crc = crc16_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
}
return crc;
diff --git a/src/stdlib/SDL_crc32.c b/src/stdlib/SDL_crc32.c
index cd7229c..be2144a 100644
--- a/src/stdlib/SDL_crc32.c
+++ b/src/stdlib/SDL_crc32.c
@@ -46,7 +46,7 @@ Uint32 SDL_crc32(Uint32 crc, const void *data, size_t len)
{
/* As an optimization we can precalculate a 256 entry table for each byte */
size_t i;
- for(i = 0; i < len; ++i) {
+ for (i = 0; i < len; ++i) {
crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
}
return crc;
diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c
index b74974c..737eb9b 100644
--- a/src/stdlib/SDL_getenv.c
+++ b/src/stdlib/SDL_getenv.c
@@ -48,8 +48,8 @@ int
SDL_setenv(const char *name, const char *value, int overwrite)
{
/* Input validation */
- if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
- return (-1);
+ if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) {
+ return -1;
}
return setenv(name, value, overwrite);
@@ -59,8 +59,8 @@ int
SDL_setenv(const char *name, const char *value, int overwrite)
{
/* Input validation */
- if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
- return (-1);
+ if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) {
+ return -1;
}
if (!overwrite) {
@@ -82,8 +82,8 @@ SDL_setenv(const char *name, const char *value, int overwrite)
char *new_variable;
/* Input validation */
- if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
- return (-1);
+ if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) {
+ return -1;
}
if (getenv(name) != NULL) {
@@ -97,8 +97,8 @@ SDL_setenv(const char *name, const char *value, int overwrite)
/* This leaks. Sorry. Get a better OS so we don't have to do this. */
len = SDL_strlen(name) + SDL_strlen(value) + 2;
new_variable = (char *) SDL_malloc(len);
- if (!new_variable) {
- return (-1);
+ if (new_variable == NULL) {
+ return -1;
}
SDL_snprintf(new_variable, len, "%s=%s", name, value);
@@ -115,8 +115,8 @@ SDL_setenv(const char *name, const char *value, int overwrite)
char *new_variable;
/* Input validation */
- if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) {
- return (-1);
+ if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) {
+ return -1;
}
/* See if it already exists */
@@ -127,8 +127,8 @@ SDL_setenv(const char *name, const char *value, int overwrite)
/* Allocate memory for the variable */
len = SDL_strlen(name) + SDL_strlen(value) + 2;
new_variable = (char *) SDL_malloc(len);
- if (!new_variable) {
- return (-1);
+ if (new_variable == NULL) {
+ return -1;
}
SDL_snprintf(new_variable, len, "%s=%s", name, value);
@@ -166,7 +166,7 @@ SDL_setenv(const char *name, const char *value, int overwrite)
SDL_free(new_variable);
}
}
- return (added ? 0 : -1);
+ return added ? 0 : -1;
}
#endif
@@ -181,7 +181,7 @@ SDL_getenv(const char *name)
#endif
/* Input validation */
- if (!name || *name == '\0') {
+ if (name == NULL || *name == '\0') {
return NULL;
}
@@ -194,7 +194,7 @@ SDL_getenv(const char *name)
size_t bufferlen;
/* Input validation */
- if (!name || *name == '\0') {
+ if (name == NULL || *name == '\0') {
return NULL;
}
@@ -222,14 +222,14 @@ SDL_getenv(const char *name)
char *value;
/* Input validation */
- if (!name || *name == '\0') {
+ if (name == NULL || *name == '\0') {
return NULL;
}
value = (char *) 0;
if (SDL_env) {
len = SDL_strlen(name);
- for (i = 0; SDL_env[i] && !value; ++i) {
+ for (i = 0; SDL_env[i] && value == NULL; ++i) {
if ((SDL_strncmp(SDL_env[i], name, len) == 0) &&
(SDL_env[i][len] == '=')) {
value = &SDL_env[i][len + 1];
@@ -308,7 +308,7 @@ main(int argc, char *argv[])
} else {
printf("failed\n");
}
- return (0);
+ return 0;
}
#endif /* TEST_MAIN */
diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c
index bee60d5..cb30ba7 100644
--- a/src/stdlib/SDL_iconv.c
+++ b/src/stdlib/SDL_iconv.c
@@ -170,16 +170,16 @@ getlocale(char *buffer, size_t bufsize)
char *ptr;
lang = SDL_getenv("LC_ALL");
- if (!lang) {
+ if (lang == NULL) {
lang = SDL_getenv("LC_CTYPE");
}
- if (!lang) {
+ if (lang == NULL) {
lang = SDL_getenv("LC_MESSAGES");
}
- if (!lang) {
+ if (lang == NULL) {
lang = SDL_getenv("LANG");
}
- if (!lang || !*lang || SDL_strcmp(lang, "C") == 0) {
+ if (lang == NULL || !*lang || SDL_strcmp(lang, "C") == 0) {
lang = "ASCII";
}
@@ -207,10 +207,10 @@ SDL_iconv_open(const char *tocode, const char *fromcode)
char fromcode_buffer[64];
char tocode_buffer[64];
- if (!fromcode || !*fromcode) {
+ if (fromcode == NULL || !*fromcode) {
fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer));
}
- if (!tocode || !*tocode) {
+ if (tocode == NULL || !*tocode) {
tocode = getlocale(tocode_buffer, sizeof(tocode_buffer));
}
for (i = 0; i < SDL_arraysize(encodings); ++i) {
@@ -250,11 +250,11 @@ SDL_iconv(SDL_iconv_t cd,
Uint32 ch = 0;
size_t total;
- if (!inbuf || !*inbuf) {
+ if (inbuf == NULL || !*inbuf) {
/* Reset the context */
return 0;
}
- if (!outbuf || !*outbuf || !outbytesleft || !*outbytesleft) {
+ if (outbuf == NULL || !*outbuf || outbytesleft == NULL || !*outbytesleft) {
return SDL_ICONV_E2BIG;
}
src = *inbuf;
@@ -820,10 +820,10 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
cd = SDL_iconv_open(tocode, fromcode);
if (cd == (SDL_iconv_t) - 1) {
/* See if we can recover here (fixes iconv on Solaris 11) */
- if (!tocode || !*tocode) {
+ if (tocode == NULL || !*tocode) {
tocode = "UTF-8";
}
- if (!fromcode || !*fromcode) {
+ if (fromcode == NULL || !*fromcode) {
fromcode = "UTF-8";
}
cd = SDL_iconv_open(tocode, fromcode);
@@ -834,7 +834,7 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
stringsize = inbytesleft > 4 ? inbytesleft : 4;
string = (char *) SDL_malloc(stringsize);
- if (!string) {
+ if (string == NULL) {
SDL_iconv_close(cd);
return NULL;
}
@@ -851,7 +851,7 @@ SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
char *oldstring = string;
stringsize *= 2;
string = (char *) SDL_realloc(string, stringsize);
- if (!string) {
+ if (string == NULL) {
SDL_free(oldstring);
SDL_iconv_close(cd);
return NULL;
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index ec632b7..1bfc13b 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -94,7 +94,7 @@ SDL_ScanLong(const char *text, int count, int radix, long *valuep)
*valuep = value;
}
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -134,7 +134,7 @@ SDL_ScanUnsignedLong(const char *text, int count, int radix, unsigned long *valu
if (valuep && text > textstart) {
*valuep = value;
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -166,7 +166,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
if (valuep && text > textstart) {
*valuep = value;
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -211,7 +211,7 @@ SDL_ScanLongLong(const char *text, int count, int radix, Sint64 * valuep)
*valuep = value;
}
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -251,7 +251,7 @@ SDL_ScanUnsignedLongLong(const char *text, int count, int radix, Uint64 * valuep
if (valuep && text > textstart) {
*valuep = value;
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -287,7 +287,7 @@ SDL_ScanFloat(const char *text, double *valuep)
*valuep = value;
}
}
- return (text - textstart);
+ return text - textstart;
}
#endif
@@ -336,7 +336,7 @@ SDL_memcmp(const void *s1, const void *s2, size_t len)
char *s2p = (char *) s2;
while (len--) {
if (*s1p != *s2p) {
- return (*s1p - *s2p);
+ return *s1p - *s2p;
}
++s1p;
++s2p;
@@ -419,7 +419,7 @@ wchar_t *
SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle)
{
#if defined(HAVE_WCSSTR)
- return SDL_const_cast(wchar_t*,wcsstr(haystack, needle));
+ return SDL_const_cast(wchar_t *, wcsstr(haystack, needle));
#else
size_t length = SDL_wcslen(needle);
while (*haystack) {
@@ -439,8 +439,9 @@ SDL_wcscmp(const wchar_t *str1, const wchar_t *str2)
return wcscmp(str1, str2);
#else
while (*str1 && *str2) {
- if (*str1 != *str2)
+ if (*str1 != *str2) {
break;
+ }
++str1;
++str2;
}
@@ -455,8 +456,9 @@ SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
return wcsncmp(str1, str2, maxlen);
#else
while (*str1 && *str2 && maxlen) {
- if (*str1 != *str2)
+ if (*str1 != *str2) {
break;
+ }
++str1;
++str2;
--maxlen;
@@ -464,7 +466,7 @@ SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
if (!maxlen) {
return 0;
}
- return (int) (*str1 - *str2);
+ return (int)(*str1 - *str2);
#endif /* HAVE_WCSNCMP */
}
@@ -488,8 +490,9 @@ SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2)
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
}
- if (a != b)
+ if (a != b) {
break;
+ }
++str1;
++str2;
}
@@ -502,7 +505,7 @@ SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2)
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
}
- return (int) ((unsigned int) a - (unsigned int) b);
+ return (int)((unsigned int)a - (unsigned int)b);
#endif /* HAVE__WCSICMP */
}
@@ -525,8 +528,9 @@ SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
}
- if (a != b)
+ if (a != b) {
break;
+ }
++str1;
++str2;
--maxlen;
@@ -543,7 +547,7 @@ SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
}
- return (int) ((unsigned int) a - (unsigned int) b);
+ return (int)((unsigned int)a - (unsigned int)b);
}
#endif /* HAVE__WCSNICMP */
}
@@ -581,8 +585,9 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
c = (unsigned char)src[i];
trailing_bytes = UTF8_TrailingBytes(c);
if (trailing_bytes) {
- if (bytes - i != trailing_bytes + 1)
+ if (bytes - i != trailing_bytes + 1) {
bytes = i;
+ }
break;
}
@@ -708,18 +713,18 @@ char *
SDL_strchr(const char *string, int c)
{
#ifdef HAVE_STRCHR
- return SDL_const_cast(char*,strchr(string, c));
+ return SDL_const_cast(char *, strchr(string, c));
#elif defined(HAVE_INDEX)
- return SDL_const_cast(char*,index(string, c));
+ return SDL_const_cast(char *, index(string, c));
#else
while (*string) {
if (*string == c) {
- return (char *) string;
+ return (char *)string;
}
++string;
}
if (c == '\0') {
- return (char *) string;
+ return (char *)string;
}
return NULL;
#endif /* HAVE_STRCHR */
@@ -729,14 +734,14 @@ char *
SDL_strrchr(const char *string, int c)
{
#ifdef HAVE_STRRCHR
- return SDL_const_cast(char*,strrchr(string, c));
+ return SDL_const_cast(char *, strrchr(string, c));
#elif defined(HAVE_RINDEX)
- return SDL_const_cast(char*,rindex(string, c));
+ return SDL_const_cast(char *, rindex(string, c));
#else
const char *bufp = string + SDL_strlen(string);
while (bufp >= string) {
if (*bufp == c) {
- return (char *) bufp;
+ return (char *)bufp;
}
--bufp;
}
@@ -748,12 +753,12 @@ char *
SDL_strstr(const char *haystack, const char *needle)
{
#if defined(HAVE_STRSTR)
- return SDL_const_cast(char*,strstr(haystack, needle));
+ return SDL_const_cast(char *, strstr(haystack, needle));
#else
size_t length = SDL_strlen(needle);
while (*haystack) {
if (SDL_strncmp(haystack, needle, length) == 0) {
- return (char *) haystack;
+ return (char *)haystack;
}
++haystack;
}
@@ -765,12 +770,12 @@ char *
SDL_strcasestr(const char *haystack, const char *needle)
{
#if defined(HAVE_STRCASESTR)
- return SDL_const_cast(char*,strcasestr(haystack, needle));
+ return SDL_const_cast(char *, strcasestr(haystack, needle));
#else
size_t length = SDL_strlen(needle);
while (*haystack) {
if (SDL_strncasecmp(haystack, needle, length) == 0) {
- return (char *) haystack;
+ return (char *)haystack;
}
++haystack;
}
@@ -1039,10 +1044,11 @@ SDL_strcmp(const char *str1, const char *str2)
#else
int result;
- while(1) {
+ while (1) {
result = (int)((unsigned char) *str1 - (unsigned char) *str2);
- if (result != 0 || (*str1 == '\0'/* && *str2 == '\0'*/))
+ if (result != 0 || (*str1 == '\0'/* && *str2 == '\0'*/)) {
break;
+ }
++str1;
++str2;
}
@@ -1060,8 +1066,9 @@ SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
while (maxlen) {
result = (int) (unsigned char) *str1 - (unsigned char) *str2;
- if (result != 0 || *str1 == '\0'/* && *str2 == '\0'*/)
+ if (result != 0 || *str1 == '\0'/* && *str2 == '\0'*/) {
break;
+ }
++str1;
++str2;
--maxlen;
@@ -1087,8 +1094,9 @@ SDL_strcasecmp(const char *str1, const char *str2)
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
result = a - b;
- if (result != 0 || a == 0 /*&& b == 0*/)
+ if (result != 0 || a == 0 /*&& b == 0*/) {
break;
+ }
++str1;
++str2;
}
@@ -1110,14 +1118,16 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
result = a - b;
- if (result != 0 || a == 0 /*&& b == 0*/)
+ if (result != 0 || a == 0 /*&& b == 0*/) {
break;
+ }
++str1;
++str2;
--maxlen;
}
- if (maxlen == 0)
+ if (maxlen == 0) {
result = 0;
+ }
return result;
#endif /* HAVE_STRNCASECMP */
}
@@ -1145,7 +1155,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap)
{
int retval = 0;
- if (!text || !*text) {
+ if (text == NULL || !*text) {
return -1;
}
@@ -1456,10 +1466,16 @@ SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
{
int retval;
- if (!fmt) fmt = "";
+ if (!fmt) {
+ fmt = "";
+ }
retval = _vsnprintf(text, maxlen, fmt, ap);
- if (maxlen > 0) text[maxlen-1] = '\0';
- if (retval < 0) retval = (int) maxlen;
+ if (maxlen > 0) {
+ text[maxlen - 1] = '\0';
+ }
+ if (retval < 0) {
+ retval = (int)maxlen;
+ }
return retval;
}
#elif defined(HAVE_VSNPRINTF)
@@ -1509,8 +1525,9 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str
size_t width = info->width - sz;
size_t filllen;
- if (info->precision >= 0 && (size_t)info->precision < sz)
+ if (info->precision >= 0 && (size_t)info->precision < sz) {
width += sz - (size_t)info->precision;
+ }
filllen = SDL_min(width, maxlen);
SDL_memset(text, fill, filllen);
@@ -1546,8 +1563,9 @@ SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
{/* left-pad num with zeroes. */
size_t sz, pad, have_sign;
- if (!info)
+ if (info == NULL) {
return;
+ }
have_sign = 0;
if (*num == '-' || *num == '+') {
@@ -1733,8 +1751,7 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
if (*fmt >= '0' && *fmt <= '9') {
info.width = SDL_strtol(fmt, (char **)&fmt, 0);
- }
- else if (*fmt == '*') {
+ } else if (*fmt == '*') {
++fmt;
info.width = va_arg(ap, int);
}
@@ -1934,8 +1951,9 @@ SDL_vasprintf(char **strp, const char *fmt, va_list ap)
*strp = NULL;
p = (char *)SDL_malloc(size);
- if (p == NULL)
+ if (p == NULL) {
return -1;
+ }
while (1) {
/* Try to print in the allocated space */
@@ -1944,8 +1962,9 @@ SDL_vasprintf(char **strp, const char *fmt, va_list ap)
va_end(aq);
/* Check error code */
- if (retval < 0)
+ if (retval < 0) {
return retval;
+ }
/* If that worked, return the string */
if (retval < size) {
diff --git a/src/test/SDL_test_assert.c b/src/test/SDL_test_assert.c
index 148564e..7737ca2 100644
--- a/src/test/SDL_test_assert.c
+++ b/src/test/SDL_test_assert.c
@@ -74,13 +74,10 @@ int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char
va_end(list);
/* Log pass or fail message */
- if (assertCondition == ASSERT_FAIL)
- {
+ if (assertCondition == ASSERT_FAIL) {
SDLTest_AssertsFailed++;
SDLTest_LogError(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Failed");
- }
- else
- {
+ } else {
SDLTest_AssertsPassed++;
SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Passed");
}
@@ -123,12 +120,9 @@ void SDLTest_ResetAssertSummary()
void SDLTest_LogAssertSummary()
{
int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
- if (SDLTest_AssertsFailed == 0)
- {
+ if (SDLTest_AssertsFailed == 0) {
SDLTest_Log(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
- }
- else
- {
+ } else {
SDLTest_LogError(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
}
}
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 1dc9793..1f6adfc 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -73,7 +73,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags)
}
state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state));
- if (!state) {
+ if (state == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -116,6 +116,16 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags)
return state;
}
+#define SEARCHARG(dim) \
+ while (*dim && *dim != ',') { \
+ ++dim; \
+ } \
+ if (!*dim) { \
+ return -1; \
+ } \
+ *dim++ = '\0';
+
+
int
SDLTest_CommonArg(SDLTest_CommonState * state, int index)
{
@@ -309,20 +319,11 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
}
x = argv[index];
y = argv[index];
- #define SEARCHARG(dim) \
- while (*dim && *dim != ',') { \
- ++dim; \
- } \
- if (!*dim) { \
- return -1; \
- } \
- *dim++ = '\0';
SEARCHARG(y)
w = y;
SEARCHARG(w)
h = w;
SEARCHARG(h)
- #undef SEARCHARG
state->confine.x = SDL_atoi(x);
state->confine.y = SDL_atoi(y);
state->confine.w = SDL_atoi(w);
@@ -596,7 +597,7 @@ static const char *
BuildCommonUsageString(char **pstr, const char **strlist, const int numitems, const char **strlist2, const int numitems2)
{
char *str = *pstr;
- if (!str) {
+ if (str == NULL) {
size_t len = SDL_strlen("[--trackmem]") + 2;
int i;
for (i = 0; i < numitems; i++) {
@@ -608,7 +609,7 @@ BuildCommonUsageString(char **pstr, const char **strlist, const int numitems, co
}
}
str = (char *) SDL_calloc(1, len);
- if (!str) {
+ if (str == NULL) {
return ""; /* oh well. */
}
SDL_strlcat(str, "[--trackmem] ", len);
@@ -1009,7 +1010,7 @@ SDLTest_LoadIcon(const char *file)
icon = SDL_LoadBMP(file);
if (icon == NULL) {
SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError());
- return (NULL);
+ return NULL;
}
if (icon->format->palette) {
@@ -1017,7 +1018,7 @@ SDLTest_LoadIcon(const char *file)
SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
}
- return (icon);
+ return icon;
}
static SDL_HitTestResult SDLCALL
@@ -1169,8 +1170,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", Bmask);
- if (Amask)
+ if (Amask) {
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask);
+ }
}
/* Print available fullscreen video modes */
@@ -1193,9 +1195,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n",
Bmask);
- if (Amask)
- SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n",
- Amask);
+ if (Amask) {
+ SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask);
+ }
}
}
}
@@ -1763,7 +1765,7 @@ SDLTest_ScreenShot(SDL_Renderer *renderer)
SDL_Rect viewport;
SDL_Surface *surface;
- if (!renderer) {
+ if (renderer == NULL) {
return;
}
@@ -1775,7 +1777,7 @@ SDLTest_ScreenShot(SDL_Renderer *renderer)
0x000000FF, 0x0000FF00, 0x00FF0000,
#endif
0x00000000);
- if (!surface) {
+ if (surface == NULL) {
SDL_Log("Couldn't create surface: %s\n", SDL_GetError());
return;
}
@@ -1800,7 +1802,7 @@ FullscreenTo(int index, int windowId)
Uint32 flags;
struct SDL_Rect rect = { 0, 0, 0, 0 };
SDL_Window *window = SDL_GetWindowFromID(windowId);
- if (!window) {
+ if (window == NULL) {
return;
}
@@ -1940,10 +1942,18 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
int x, y;
SDL_GetWindowPosition(window, &x, &y);
- if (event->key.keysym.sym == SDLK_UP) y -= delta;
- if (event->key.keysym.sym == SDLK_DOWN) y += delta;
- if (event->key.keysym.sym == SDLK_LEFT) x -= delta;
- if (event->key.keysym.sym == SDLK_RIGHT) x += delta;
+ if (event->key.keysym.sym == SDLK_UP) {
+ y -= delta;
+ }
+ if (event->key.keysym.sym == SDLK_DOWN) {
+ y += delta;
+ }
+ if (event->key.keysym.sym == SDLK_LEFT) {
+ x -= delta;
+ }
+ if (event->key.keysym.sym == SDLK_RIGHT) {
+ x += delta;
+ }
SDL_Log("Setting position to (%d, %d)\n", x, y);
SDL_SetWindowPosition(window, x, y);
diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c
index 3bfcf49..bbf0f2f 100644
--- a/src/test/SDL_test_font.c
+++ b/src/test/SDL_test_font.c
@@ -3191,7 +3191,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
charWidth, charHeight, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
if (character == NULL) {
- return (-1);
+ return -1;
}
charpos = SDLTest_FontData + ci * charSize;
@@ -3224,7 +3224,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
* Check pointer
*/
if (cache->charTextureCache[ci] == NULL) {
- return (-1);
+ return -1;
}
}
@@ -3241,7 +3241,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
*/
result |= SDL_RenderCopy(renderer, cache->charTextureCache[ci], &srect, &drect);
- return (result);
+ return result;
}
/* Gets a unicode value from a UTF-8 encoded string
@@ -3352,14 +3352,14 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s)
len -= advance;
}
- return (result);
+ return result;
}
SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h)
{
SDLTest_TextWindow *textwin = (SDLTest_TextWindow *)SDL_malloc(sizeof(*textwin));
- if ( !textwin ) {
+ if (textwin == NULL) {
return NULL;
}
@@ -3453,8 +3453,7 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin)
{
int i;
- for ( i = 0; i < textwin->numlines; ++i )
- {
+ for ( i = 0; i < textwin->numlines; ++i ) {
if ( textwin->lines[i] ) {
SDL_free(textwin->lines[i]);
textwin->lines[i] = NULL;
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index 98fb09d..7eda8a0 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -167,11 +167,11 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
Sint64 temp;
Sint64 number;
- if(pMin > pMax) {
+ if (pMin > pMax) {
temp = min;
min = max;
max = temp;
- } else if(pMin == pMax) {
+ } else if (pMin == pMax) {
return (Sint32)min;
}
@@ -493,7 +493,7 @@ SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
{
int size;
- if(maxLength < 1) {
+ if (maxLength < 1) {
SDL_InvalidParamError("maxLength");
return NULL;
}
@@ -510,7 +510,7 @@ SDLTest_RandomAsciiStringOfSize(int size)
int counter;
- if(size < 1) {
+ if (size < 1) {
SDL_InvalidParamError("size");
return NULL;
}
@@ -520,7 +520,7 @@ SDLTest_RandomAsciiStringOfSize(int size)
return NULL;
}
- for(counter = 0; counter < size; ++counter) {
+ for (counter = 0; counter < size; ++counter) {
string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
}
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index db3836b..8057b6a 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -234,14 +234,12 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseRef
int testResult = 0;
int fuzzerCount;
- if (testSuite==NULL || testCase==NULL || testSuite->name==NULL || testCase->name==NULL)
- {
+ if (testSuite==NULL || testCase==NULL || testSuite->name==NULL || testCase->name==NULL) {
SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
return TEST_RESULT_SETUP_FAILURE;
}
- if (!testCase->enabled && forceTestRun == SDL_FALSE)
- {
+ if (!testCase->enabled && forceTestRun == SDL_FALSE) {
SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Disabled)");
return TEST_RESULT_SKIPPED;
}
@@ -326,7 +324,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
/* Loop over all suites */
suiteCounter = 0;
- while(&testSuites[suiteCounter]) {
+ while (&testSuites[suiteCounter]) {
testSuite=&testSuites[suiteCounter];
suiteCounter++;
SDLTest_Log("Test Suite %i - %s\n", suiteCounter,
@@ -334,8 +332,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
/* Loop over all test cases */
testCounter = 0;
- while(testSuite->testCases[testCounter])
- {
+ while (testSuite->testCases[testCounter]) {
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
testCounter++;
SDLTest_Log(" Test Case %i - %s: %s", testCounter,
@@ -436,8 +433,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
testSuite = testSuites[suiteCounter];
suiteCounter++;
testCounter = 0;
- while (testSuite->testCases[testCounter])
- {
+ while (testSuite->testCases[testCounter]) {
testCounter++;
totalNumberOfTests++;
}
@@ -510,7 +506,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites */
suiteCounter = 0;
- while(testSuites[suiteCounter]) {
+ while (testSuites[suiteCounter]) {
testSuite = testSuites[suiteCounter];
currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
suiteCounter++;
@@ -539,8 +535,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all test cases */
testCounter = 0;
- while(testSuite->testCases[testCounter])
- {
+ while (testSuite->testCases[testCounter]) {
testCase = testSuite->testCases[testCounter];
currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
testCounter++;
@@ -575,8 +570,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all iterations */
iterationCounter = 0;
- while(iterationCounter < testIterations)
- {
+ while (iterationCounter < testIterations) {
iterationCounter++;
if (userExecKey != 0) {
@@ -603,7 +597,9 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Take time - test end */
testEndSeconds = GetClock();
runtime = testEndSeconds - testStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
+ if (runtime < 0.0f) {
+ runtime = 0.0f;
+ }
if (testIterations > 1) {
/* Log test runtime */
@@ -638,20 +634,19 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Take time - suite end */
suiteEndSeconds = GetClock();
runtime = suiteEndSeconds - suiteStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
+ if (runtime < 0.0f) {
+ runtime = 0.0f;
+ }
/* Log suite runtime */
SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
/* Log summary and final Suite result */
countSum = testPassedCount + testFailedCount + testSkippedCount;
- if (testFailedCount == 0)
- {
+ if (testFailedCount == 0) {
SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Passed");
- }
- else
- {
+ } else {
SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Failed");
}
@@ -662,21 +657,20 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Take time - run end */
runEndSeconds = GetClock();
runtime = runEndSeconds - runStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
+ if (runtime < 0.0f) {
+ runtime = 0.0f;
+ }
/* Log total runtime */
SDLTest_Log("Total Run runtime: %.1f sec", runtime);
/* Log summary and final run result */
countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
- if (totalTestFailedCount == 0)
- {
+ if (totalTestFailedCount == 0) {
runResult = 0;
SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Passed");
- }
- else
- {
+ } else {
runResult = 1;
SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Failed");
diff --git a/src/test/SDL_test_md5.c b/src/test/SDL_test_md5.c
index 662e2fa..06c188a 100644
--- a/src/test/SDL_test_md5.c
+++ b/src/test/SDL_test_md5.c
@@ -109,7 +109,9 @@ static unsigned char MD5PADDING[64] = {
void SDLTest_Md5Init(SDLTest_Md5Context * mdContext)
{
- if (mdContext==NULL) return;
+ if (mdContext == NULL) {
+ return;
+ }
mdContext->i[0] = mdContext->i[1] = (MD5UINT4) 0;
@@ -135,8 +137,12 @@ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
int mdi;
unsigned int i, ii;
- if (mdContext == NULL) return;
- if (inBuf == NULL || inLen < 1) return;
+ if (mdContext == NULL) {
+ return;
+ }
+ if (inBuf == NULL || inLen < 1) {
+ return;
+ }
/*
* compute number of bytes mod 64
@@ -146,8 +152,9 @@ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
/*
* update number of bits
*/
- if ((mdContext->i[0] + ((MD5UINT4) inLen << 3)) < mdContext->i[0])
+ if ((mdContext->i[0] + ((MD5UINT4)inLen << 3)) < mdContext->i[0]) {
mdContext->i[1]++;
+ }
mdContext->i[0] += ((MD5UINT4) inLen << 3);
mdContext->i[1] += ((MD5UINT4) inLen >> 29);
@@ -161,11 +168,9 @@ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
* transform if necessary
*/
if (mdi == 0x40) {
- for (i = 0, ii = 0; i < 16; i++, ii += 4)
- in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
- (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
- (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
- ((MD5UINT4) mdContext->in[ii]);
+ for (i = 0, ii = 0; i < 16; i++, ii += 4) {
+ in[i] = (((MD5UINT4)mdContext->in[ii + 3]) << 24) | (((MD5UINT4)mdContext->in[ii + 2]) << 16) | (((MD5UINT4)mdContext->in[ii + 1]) << 8) | ((MD5UINT4)mdContext->in[ii]);
+ }
SDLTest_Md5Transform(mdContext->buf, in);
mdi = 0;
}
@@ -184,7 +189,9 @@ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
unsigned int i, ii;
unsigned int padLen;
- if (mdContext == NULL) return;
+ if (mdContext == NULL) {
+ return;
+ }
/*
* save number of bits
@@ -206,11 +213,9 @@ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
/*
* append length in bits and transform
*/
- for (i = 0, ii = 0; i < 14; i++, ii += 4)
- in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
- (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
- (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
- ((MD5UINT4) mdContext->in[ii]);
+ for (i = 0, ii = 0; i < 14; i++, ii += 4) {
+ in[i] = (((MD5UINT4)mdContext->in[ii + 3]) << 24) | (((MD5UINT4)mdContext->in[ii + 2]) << 16) | (((MD5UINT4)mdContext->in[ii + 1]) << 8) | ((MD5UINT4)mdContext->in[ii]);
+ }
SDLTest_Md5Transform(mdContext->buf, in);
/*
diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c
index 067b7a5..f01b509 100644
--- a/src/test/SDL_test_memory.c
+++ b/src/test/SDL_test_memory.c
@@ -84,7 +84,7 @@ static void SDL_TrackAllocation(void *mem, size_t size)
return;
}
entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry));
- if (!entry) {
+ if (entry == NULL) {
return;
}
entry->mem = mem;
@@ -171,7 +171,7 @@ static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size)
{
void *mem;
- SDL_assert(!ptr || SDL_IsAllocationTracked(ptr));
+ SDL_assert(ptr == NULL || SDL_IsAllocationTracked(ptr));
mem = SDL_realloc_orig(ptr, size);
if (mem && mem != ptr) {
if (ptr) {
@@ -184,7 +184,7 @@ static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size)
static void SDLCALL SDLTest_TrackedFree(void *ptr)
{
- if (!ptr) {
+ if (ptr == NULL) {
return;
}
diff --git a/src/test/SDL_test_random.c b/src/test/SDL_test_random.c
index b2babf1..d00f2df 100644
--- a/src/test/SDL_test_random.c
+++ b/src/test/SDL_test_random.c
@@ -40,7 +40,9 @@
void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, unsigned int ci)
{
- if (rndContext==NULL) return;
+ if (rndContext == NULL) {
+ return;
+ }
/*
* Choose a value for 'a' from this list
@@ -66,7 +68,9 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext)
{
int a, b;
- if (rndContext==NULL) return;
+ if (rndContext == NULL) {
+ return;
+ }
srand((unsigned int)time(NULL));
a=rand();
@@ -81,7 +85,9 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
{
unsigned int xh, xl;
- if (rndContext==NULL) return -1;
+ if (rndContext == NULL) {
+ return -1;
+ }
xh = rndContext->x >> 16;
xl = rndContext->x & 65535;
@@ -89,9 +95,10 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
rndContext->c =
xh * rndContext->ah + ((xh * rndContext->al) >> 16) +
((xl * rndContext->ah) >> 16);
- if (xl * rndContext->al >= (~rndContext->c + 1))
+ if (xl * rndContext->al >= (~rndContext->c + 1)) {
rndContext->c++;
- return (rndContext->x);
+ }
+ return rndContext->x;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c
index 4e51be6..47abb59 100644
--- a/src/thread/SDL_thread.c
+++ b/src/thread/SDL_thread.c
@@ -42,7 +42,7 @@ SDL_TLSGet(SDL_TLSID id)
SDL_TLSData *storage;
storage = SDL_SYS_GetTLSData();
- if (!storage || id == 0 || id > storage->limit) {
+ if (storage == NULL || id == 0 || id > storage->limit) {
return NULL;
}
return storage->array[id-1].data;
@@ -58,13 +58,13 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
}
storage = SDL_SYS_GetTLSData();
- if (!storage || (id > storage->limit)) {
+ if (storage == NULL || (id > storage->limit)) {
unsigned int i, oldlimit, newlimit;
oldlimit = storage ? storage->limit : 0;
newlimit = (id + TLS_ALLOC_CHUNKSIZE);
storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage)+(newlimit-1)*sizeof(storage->array[0]));
- if (!storage) {
+ if (storage == NULL) {
return SDL_OutOfMemory();
}
storage->limit = newlimit;
@@ -127,14 +127,14 @@ SDL_Generic_GetTLSData(void)
SDL_TLSData *storage = NULL;
#if !SDL_THREADS_DISABLED
- if (!SDL_generic_TLS_mutex) {
+ if (SDL_generic_TLS_mutex == NULL) {
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
- if (!SDL_generic_TLS_mutex) {
+ if (SDL_generic_TLS_mutex == NULL) {
SDL_mutex *mutex = SDL_CreateMutex();
SDL_MemoryBarrierRelease();
SDL_generic_TLS_mutex = mutex;
- if (!SDL_generic_TLS_mutex) {
+ if (SDL_generic_TLS_mutex == NULL) {
SDL_AtomicUnlock(&tls_lock);
return NULL;
}
@@ -183,7 +183,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
prev = entry;
}
- if (!entry) {
+ if (entry == NULL) {
entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry));
if (entry) {
entry->thread = thread;
@@ -194,7 +194,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
SDL_UnlockMutex(SDL_generic_TLS_mutex);
- if (!entry) {
+ if (entry == NULL) {
return SDL_OutOfMemory();
}
return 0;
@@ -262,7 +262,7 @@ SDL_GetErrBuf(void)
if (errbuf == ALLOCATION_IN_PROGRESS) {
return SDL_GetStaticErrBuf();
}
- if (!errbuf) {
+ if (errbuf == NULL) {
/* Get the original memory functions for this allocation because the lifetime
* of the error buffer may span calls to SDL_SetMemoryFunctions() by the app
*/
@@ -273,7 +273,7 @@ SDL_GetErrBuf(void)
/* Mark that we're in the middle of allocating our buffer */
SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf));
- if (!errbuf) {
+ if (errbuf == NULL) {
SDL_TLSSet(tls_errbuf, NULL, NULL);
return SDL_GetStaticErrBuf();
}
@@ -474,7 +474,7 @@ SDL_WaitThread(SDL_Thread * thread, int *status)
void
SDL_DetachThread(SDL_Thread * thread)
{
- if (!thread) {
+ if (thread == NULL) {
return;
}
diff --git a/src/thread/generic/SDL_syscond.c b/src/thread/generic/SDL_syscond.c
index 59e8ce0..f3255f8 100644
--- a/src/thread/generic/SDL_syscond.c
+++ b/src/thread/generic/SDL_syscond.c
@@ -98,7 +98,7 @@ int
SDL_CondSignal_generic(SDL_cond * _cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -123,7 +123,7 @@ int
SDL_CondBroadcast_generic(SDL_cond * _cond)
{
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -180,7 +180,7 @@ SDL_CondWaitTimeout_generic(SDL_cond * _cond, SDL_mutex * mutex, Uint32 ms)
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
int retval;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
diff --git a/src/thread/generic/SDL_syssem.c b/src/thread/generic/SDL_syssem.c
index c21ff19..797ede4 100644
--- a/src/thread/generic/SDL_syssem.c
+++ b/src/thread/generic/SDL_syssem.c
@@ -87,7 +87,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
SDL_sem *sem;
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
- if (!sem) {
+ if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -131,7 +131,7 @@ SDL_SemTryWait(SDL_sem * sem)
{
int retval;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -151,7 +151,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
{
int retval;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -199,7 +199,7 @@ SDL_SemValue(SDL_sem * sem)
int
SDL_SemPost(SDL_sem * sem)
{
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
diff --git a/src/thread/generic/SDL_systhread.c b/src/thread/generic/SDL_systhread.c
index e36bf4c..1f8f042 100644
--- a/src/thread/generic/SDL_systhread.c
+++ b/src/thread/generic/SDL_systhread.c
@@ -47,13 +47,13 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
- return (0);
+ return 0;
}
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
- return (0);
+ return 0;
}
void
diff --git a/src/thread/n3ds/SDL_syscond.c b/src/thread/n3ds/SDL_syscond.c
index 9c671f5..e825d6a 100644
--- a/src/thread/n3ds/SDL_syscond.c
+++ b/src/thread/n3ds/SDL_syscond.c
@@ -57,8 +57,8 @@ SDL_DestroyCond(SDL_cond *cond)
int
SDL_CondSignal(SDL_cond *cond)
{
- if (!cond) {
- return SDL_SetError("Passed a NULL condition variable");
+ if (cond == NULL) {
+ return SDL_InvalidParamError("cond");
}
CondVar_Signal(&cond->cond_variable);
@@ -69,8 +69,8 @@ SDL_CondSignal(SDL_cond *cond)
int
SDL_CondBroadcast(SDL_cond *cond)
{
- if (!cond) {
- return SDL_SetError("Passed a NULL condition variable");
+ if (cond == NULL) {
+ return SDL_InvalidParamError("cond");
}
CondVar_Broadcast(&cond->cond_variable);
@@ -103,11 +103,11 @@ SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
{
Result res;
- if (!cond) {
- return SDL_SetError("Passed a NULL condition variable");
+ if (cond == NULL) {
+ return SDL_InvalidParamError("cond");
}
- if (!mutex) {
- return SDL_SetError("Passed a NULL mutex");
+ if (mutex == NULL) {
+ return SDL_InvalidParamError("mutex");
}
res = 0;
diff --git a/src/thread/n3ds/SDL_syssem.c b/src/thread/n3ds/SDL_syssem.c
index 08fbb6f..ee0b49f 100644
--- a/src/thread/n3ds/SDL_syssem.c
+++ b/src/thread/n3ds/SDL_syssem.c
@@ -44,7 +44,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
}
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
- if (!sem) {
+ if (sem == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -68,8 +68,8 @@ SDL_DestroySemaphore(SDL_sem *sem)
int
SDL_SemTryWait(SDL_sem *sem)
{
- if (!sem) {
- return SDL_SetError("Passed a NULL semaphore");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
return SDL_SemWaitTimeout(sem, 0);
@@ -80,8 +80,8 @@ SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
{
int retval;
- if (!sem) {
- return SDL_SetError("Passed a NULL semaphore");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
if (timeout == SDL_MUTEX_MAXWAIT) {
@@ -113,8 +113,8 @@ SDL_SemWait(SDL_sem *sem)
Uint32
SDL_SemValue(SDL_sem *sem)
{
- if (!sem) {
- return SDL_SetError("Passed a NULL semaphore");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
return sem->semaphore.current_count;
}
@@ -122,8 +122,8 @@ SDL_SemValue(SDL_sem *sem)
int
SDL_SemPost(SDL_sem *sem)
{
- if (!sem) {
- return SDL_SetError("Passed a NULL semaphore");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
LightSemaphore_Release(&sem->semaphore, 1);
return 0;
diff --git a/src/thread/ngage/SDL_sysmutex.cpp b/src/thread/ngage/SDL_sysmutex.cpp
index 6893fc6..e6f5bfb 100644
--- a/src/thread/ngage/SDL_sysmutex.cpp
+++ b/src/thread/ngage/SDL_sysmutex.cpp
@@ -36,7 +36,7 @@ extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*,
static TInt NewMutex(const TDesC& aName, TAny* aPtr1, TAny*)
{
- return ((RMutex*)aPtr1)->CreateGlobal(aName);
+ return ((RMutex *)aPtr1)->CreateGlobal(aName);
}
/* Create a mutex */
@@ -46,21 +46,19 @@ SDL_CreateMutex(void)
RMutex rmutex;
TInt status = CreateUnique(NewMutex, &rmutex, NULL);
- if(status != KErrNone)
- {
+ if (status != KErrNone) {
SDL_SetError("Couldn't create mutex.");
}
SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
mutex->handle = rmutex.Handle();
- return(mutex);
+ return mutex;
}
/* Free the mutex */
void
SDL_DestroyMutex(SDL_mutex * mutex)
{
- if (mutex)
- {
+ if (mutex) {
RMutex rmutex;
rmutex.SetHandle(mutex->handle);
rmutex.Signal();
@@ -90,32 +88,30 @@ SDL_TryLockMutex(SDL_mutex * mutex)
int
SDL_LockMutex(SDL_mutex * mutex)
{
- if (mutex == NULL)
- {
- return SDL_SetError("Passed a NULL mutex.");
+ if (mutex == NULL) {
+ return SDL_InvalidParamError("mutex");
}
RMutex rmutex;
rmutex.SetHandle(mutex->handle);
rmutex.Wait();
- return(0);
+ return 0;
}
/* Unlock the mutex */
int
SDL_UnlockMutex(SDL_mutex * mutex)
{
- if ( mutex == NULL )
- {
- return SDL_SetError("Passed a NULL mutex.");
+ if (mutex == NULL) {
+ return SDL_InvalidParamError("mutex");
}
RMutex rmutex;
rmutex.SetHandle(mutex->handle);
rmutex.Signal();
- return(0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/ngage/SDL_syssem.cpp b/src/thread/ngage/SDL_syssem.cpp
index 622d623..be3b53d 100644
--- a/src/thread/ngage/SDL_syssem.cpp
+++ b/src/thread/ngage/SDL_syssem.cpp
@@ -60,18 +60,13 @@ static TBool RunThread(TAny* aInfo)
static TInt
NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
{
- return ((RThread*)(aPtr1))->Create
- (aName,
- RunThread,
- KDefaultStackSize,
- NULL,
- aPtr2);
+ return ((RThread *)(aPtr1))->Create(aName, RunThread, KDefaultStackSize, NULL, aPtr2);
}
static TInt NewSema(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
{
TInt value = *((TInt*) aPtr2);
- return ((RSemaphore*)aPtr1)->CreateGlobal(aName, value);
+ return ((RSemaphore *)aPtr1)->CreateGlobal(aName, value);
}
static void WaitAll(SDL_sem *sem)
@@ -79,8 +74,7 @@ static void WaitAll(SDL_sem *sem)
RSemaphore sema;
sema.SetHandle(sem->handle);
sema.Wait();
- while(sem->count < 0)
- {
+ while(sem->count < 0) {
sema.Wait();
}
}
@@ -90,21 +84,19 @@ SDL_CreateSemaphore(Uint32 initial_value)
{
RSemaphore s;
TInt status = CreateUnique(NewSema, &s, &initial_value);
- if(status != KErrNone)
- {
+ if (status != KErrNone) {
SDL_SetError("Couldn't create semaphore");
}
SDL_semaphore* sem = new /*(ELeave)*/ SDL_semaphore;
sem->handle = s.Handle();
sem->count = initial_value;
- return(sem);
+ return sem;
}
void
SDL_DestroySemaphore(SDL_sem * sem)
{
- if (sem)
- {
+ if (sem) {
RSemaphore sema;
sema.SetHandle(sem->handle);
sema.Signal(sema.Count());
@@ -117,13 +109,11 @@ SDL_DestroySemaphore(SDL_sem * sem)
int
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
{
- if (! sem)
- {
- return SDL_SetError("Passed a NULL sem");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
- if (timeout == SDL_MUTEX_MAXWAIT)
- {
+ if (timeout == SDL_MUTEX_MAXWAIT) {
WaitAll(sem);
return SDL_MUTEX_MAXWAIT;
}
@@ -132,16 +122,14 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
TInfo* info = new (ELeave)TInfo(timeout, sem->handle);
TInt status = CreateUnique(NewThread, &thread, info);
- if(status != KErrNone)
- {
+ if (status != KErrNone) {
return status;
}
thread.Resume();
WaitAll(sem);
- if(thread.ExitType() == EExitPending)
- {
+ if (thread.ExitType() == EExitPending) {
thread.Kill(SDL_MUTEX_TIMEOUT);
}
@@ -152,8 +140,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
int
SDL_SemTryWait(SDL_sem *sem)
{
- if(sem->count > 0)
- {
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
+ }
+
+ if (sem->count > 0) {
sem->count--;
}
return SDL_MUTEX_TIMEOUT;
@@ -168,9 +159,8 @@ SDL_SemWait(SDL_sem * sem)
Uint32
SDL_SemValue(SDL_sem * sem)
{
- if (! sem)
- {
- SDL_SetError("Passed a NULL sem.");
+ if (sem == NULL) {
+ SDL_InvalidParamError("sem");
return 0;
}
return sem->count;
@@ -179,9 +169,8 @@ SDL_SemValue(SDL_sem * sem)
int
SDL_SemPost(SDL_sem * sem)
{
- if (! sem)
- {
- return SDL_SetError("Passed a NULL sem.");
+ if (sem == NULL) {
+ return SDL_InvalidParamError("sem");
}
sem->count++;
RSemaphore sema;
diff --git a/src/thread/ngage/SDL_systhread.cpp b/src/thread/ngage/SDL_systhread.cpp
index f2c30f7..dcb870d 100644
--- a/src/thread/ngage/SDL_systhread.cpp
+++ b/src/thread/ngage/SDL_systhread.cpp
@@ -40,18 +40,13 @@ static int
RunThread(TAny* data)
{
SDL_RunThread((SDL_Thread*)data);
- return(0);
+ return 0;
}
static TInt
NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2)
{
- return ((RThread*)(aPtr1))->Create
- (aName,
- RunThread,
- KDefaultStackSize,
- NULL,
- aPtr2);
+ return ((RThread *)(aPtr1))->Create(aName, RunThread, KDefaultStackSize, NULL, aPtr2);
}
int
@@ -75,17 +70,16 @@ SDL_SYS_CreateThread(SDL_Thread *thread)
RThread rthread;
TInt status = CreateUnique(NewThread, &rthread, thread);
- if (status != KErrNone)
- {
+ if (status != KErrNone) {
delete(((RThread*)(thread->handle)));
thread->handle = NULL;
SDL_SetError("Not enough resources to create thread");
- return(-1);
+ return -1;
}
rthread.Resume();
thread->handle = rthread.Handle();
- return(0);
+ return 0;
}
void
@@ -105,7 +99,7 @@ SDL_ThreadID(void)
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
- return (0);
+ return 0;
}
void
@@ -113,8 +107,7 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
{
RThread t;
t.Open(thread->threadid);
- if(t.ExitReason() == EExitPending)
- {
+ if (t.ExitReason() == EExitPending) {
TRequestStatus status;
t.Logon(status);
User::WaitForRequest(status);
diff --git a/src/thread/ps2/SDL_syssem.c b/src/thread/ps2/SDL_syssem.c
index e6b0aee..a4c7de8 100644
--- a/src/thread/ps2/SDL_syssem.c
+++ b/src/thread/ps2/SDL_syssem.c
@@ -105,8 +105,9 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
ret = WaitSema(sem->semid);
StopTimerAlarm(&alarm);
- if (ret < 0)
+ if (ret < 0) {
return SDL_MUTEX_TIMEDOUT;
+ }
return 0; //Wait condition satisfied.
}
diff --git a/src/thread/psp/SDL_syscond.c b/src/thread/psp/SDL_syscond.c
index 02307ed..32dcbd1 100644
--- a/src/thread/psp/SDL_syscond.c
+++ b/src/thread/psp/SDL_syscond.c
@@ -58,7 +58,7 @@ SDL_CreateCond(void)
} else {
SDL_OutOfMemory();
}
- return (cond);
+ return cond;
}
/* Destroy a condition variable */
@@ -83,7 +83,7 @@ SDL_DestroyCond(SDL_cond * cond)
int
SDL_CondSignal(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -107,7 +107,7 @@ SDL_CondSignal(SDL_cond * cond)
int
SDL_CondBroadcast(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -163,7 +163,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
{
int retval;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
diff --git a/src/thread/pthread/SDL_syscond.c b/src/thread/pthread/SDL_syscond.c
index c84ec7a..b7d7643 100644
--- a/src/thread/pthread/SDL_syscond.c
+++ b/src/thread/pthread/SDL_syscond.c
@@ -48,7 +48,7 @@ SDL_CreateCond(void)
cond = NULL;
}
}
- return (cond);
+ return cond;
}
/* Destroy a condition variable */
@@ -67,7 +67,7 @@ SDL_CondSignal(SDL_cond * cond)
{
int retval;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -84,7 +84,7 @@ SDL_CondBroadcast(SDL_cond * cond)
{
int retval;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -104,7 +104,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
#endif
struct timespec abstime;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -147,7 +147,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
int
SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
} else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
return SDL_SetError("pthread_cond_wait() failed");
diff --git a/src/thread/pthread/SDL_sysmutex.c b/src/thread/pthread/SDL_sysmutex.c
index c26982a..09a00ce 100644
--- a/src/thread/pthread/SDL_sysmutex.c
+++ b/src/thread/pthread/SDL_sysmutex.c
@@ -64,7 +64,7 @@ SDL_CreateMutex(void)
} else {
SDL_OutOfMemory();
}
- return (mutex);
+ return mutex;
}
void
diff --git a/src/thread/pthread/SDL_syssem.c b/src/thread/pthread/SDL_syssem.c
index 9a0c888..8321807 100644
--- a/src/thread/pthread/SDL_syssem.c
+++ b/src/thread/pthread/SDL_syssem.c
@@ -72,7 +72,7 @@ SDL_SemTryWait(SDL_sem * sem)
{
int retval;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
retval = SDL_MUTEX_TIMEDOUT;
@@ -87,7 +87,7 @@ SDL_SemWait(SDL_sem * sem)
{
int retval;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -114,7 +114,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
Uint32 end;
#endif
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -194,7 +194,7 @@ SDL_SemPost(SDL_sem * sem)
{
int retval;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c
index 3b3f40f..b873f3d 100644
--- a/src/thread/pthread/SDL_systhread.c
+++ b/src/thread/pthread/SDL_systhread.c
@@ -187,7 +187,7 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
- return ((SDL_threadID) pthread_self());
+ return (SDL_threadID)pthread_self();
}
int
diff --git a/src/thread/stdcpp/SDL_syscond.cpp b/src/thread/stdcpp/SDL_syscond.cpp
index 90c38ad..95e82d0 100644
--- a/src/thread/stdcpp/SDL_syscond.cpp
+++ b/src/thread/stdcpp/SDL_syscond.cpp
@@ -69,7 +69,7 @@ extern "C"
int
SDL_CondSignal(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -82,7 +82,7 @@ extern "C"
int
SDL_CondBroadcast(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -132,7 +132,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
cpp_lock.release();
return 0;
} else {
- auto wait_result = cond->cpp_cond.wait_for(
+ auto wait_result = cond->cpp_cond.wait_for (
cpp_lock,
std::chrono::duration<Uint32, std::milli>(ms)
);
diff --git a/src/thread/stdcpp/SDL_systhread.cpp b/src/thread/stdcpp/SDL_systhread.cpp
index 3d818ac..0d17565 100644
--- a/src/thread/stdcpp/SDL_systhread.cpp
+++ b/src/thread/stdcpp/SDL_systhread.cpp
@@ -98,16 +98,13 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
if (priority == SDL_THREAD_PRIORITY_LOW) {
value = THREAD_PRIORITY_LOWEST;
- }
- else if (priority == SDL_THREAD_PRIORITY_HIGH) {
+ } else if (priority == SDL_THREAD_PRIORITY_HIGH) {
value = THREAD_PRIORITY_HIGHEST;
- }
- else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
+ } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
// FIXME: WinRT does not support TIME_CRITICAL! -flibit
SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, "TIME_CRITICAL unsupported, falling back to HIGHEST");
value = THREAD_PRIORITY_HIGHEST;
- }
- else {
+ } else {
value = THREAD_PRIORITY_NORMAL;
}
if (!SetThreadPriority(GetCurrentThread(), value)) {
diff --git a/src/thread/vita/SDL_syscond.c b/src/thread/vita/SDL_syscond.c
index c6e46c4..7a2dfe6 100644
--- a/src/thread/vita/SDL_syscond.c
+++ b/src/thread/vita/SDL_syscond.c
@@ -58,7 +58,7 @@ SDL_CreateCond(void)
} else {
SDL_OutOfMemory();
}
- return (cond);
+ return cond;
}
/* Destroy a condition variable */
@@ -83,7 +83,7 @@ SDL_DestroyCond(SDL_cond * cond)
int
SDL_CondSignal(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -107,7 +107,7 @@ SDL_CondSignal(SDL_cond * cond)
int
SDL_CondBroadcast(SDL_cond * cond)
{
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -163,7 +163,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
{
int retval;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
diff --git a/src/thread/windows/SDL_syscond_cv.c b/src/thread/windows/SDL_syscond_cv.c
index 9c0ceb3..99ff9ca 100644
--- a/src/thread/windows/SDL_syscond_cv.c
+++ b/src/thread/windows/SDL_syscond_cv.c
@@ -88,7 +88,7 @@ SDL_CreateCond_cv(void)
/* Relies on CONDITION_VARIABLE_INIT == 0. */
cond = (SDL_cond_cv *) SDL_calloc(1, sizeof(*cond));
- if (!cond) {
+ if (cond == NULL) {
SDL_OutOfMemory();
}
@@ -108,7 +108,7 @@ static int
SDL_CondSignal_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -121,7 +121,7 @@ static int
SDL_CondBroadcast_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -137,10 +137,10 @@ SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms)
DWORD timeout;
int ret;
- if (!cond) {
+ if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
- if (!_mutex) {
+ if (_mutex == NULL) {
return SDL_InvalidParamError("mutex");
}
@@ -234,7 +234,7 @@ SDL_CreateCond(void)
if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) {
/* The mutex implementation isn't decided yet, trigger it */
SDL_mutex *mutex = SDL_CreateMutex();
- if (!mutex) {
+ if (mutex == NULL) {
return NULL;
}
SDL_DestroyMutex(mutex);
diff --git a/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c
index 3974b33..2477384 100644
--- a/src/thread/windows/SDL_sysmutex.c
+++ b/src/thread/windows/SDL_sysmutex.c
@@ -65,7 +65,7 @@ SDL_CreateMutex_srw(void)
/* Relies on SRWLOCK_INIT == 0. */
mutex = (SDL_mutex_srw *) SDL_calloc(1, sizeof(*mutex));
- if (!mutex) {
+ if (mutex == NULL) {
SDL_OutOfMemory();
}
diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c
index 629f2a9..e80d256 100644
--- a/src/thread/windows/SDL_syssem.c
+++ b/src/thread/windows/SDL_syssem.c
@@ -121,7 +121,7 @@ SDL_SemTryWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -143,7 +143,7 @@ SDL_SemWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -175,7 +175,7 @@ SDL_SemWaitTimeout_atom(SDL_sem * _sem, Uint32 timeout)
return SDL_SemWait_atom(_sem);
}
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -218,7 +218,7 @@ SDL_SemValue_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
- if (!sem) {
+ if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -231,7 +231,7 @@ SDL_SemPost_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -312,7 +312,7 @@ SDL_SemWaitTimeout_kern(SDL_sem * _sem, Uint32 timeout)
int retval;
DWORD dwMilliseconds;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -353,7 +353,7 @@ static Uint32
SDL_SemValue_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
- if (!sem) {
+ if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -364,7 +364,7 @@ static int
SDL_SemPost_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
- if (!sem) {
+ if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
/* Increase the counter in the first place, because
@@ -421,7 +421,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
pWaitOnAddress = (pfnWaitOnAddress) GetProcAddress(synch120, "WaitOnAddress");
pWakeByAddressSingle = (pfnWakeByAddressSingle) GetProcAddress(synch120, "WakeByAddressSingle");
- if(pWaitOnAddress && pWakeByAddressSingle) {
+ if (pWaitOnAddress && pWakeByAddressSingle) {
impl = &SDL_sem_impl_atom;
}
}
diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c
index 8f44e47..dbd6654 100644
--- a/src/thread/windows/SDL_systhread.c
+++ b/src/thread/windows/SDL_systhread.c
@@ -95,7 +95,7 @@ RunThreadViaCreateThread(LPVOID data)
static unsigned __stdcall
RunThreadViaBeginThreadEx(void *data)
{
- return (unsigned) RunThread(data);
+ return (unsigned)RunThread(data);
}
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
@@ -206,7 +206,7 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
- return ((SDL_threadID) GetCurrentThreadId());
+ return (SDL_threadID)GetCurrentThreadId();
}
int
diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c
index 6741e97..3a5828b 100644
--- a/src/timer/SDL_timer.c
+++ b/src/timer/SDL_timer.c
@@ -174,7 +174,7 @@ SDL_TimerThread(void *_data)
current->scheduled = tick + interval;
SDL_AddTimerInternal(data, current);
} else {
- if (!freelist_head) {
+ if (freelist_head == NULL) {
freelist_head = current;
}
if (freelist_tail) {
@@ -302,7 +302,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
SDL_RemoveTimer(timer->timerID);
} else {
timer = (SDL_Timer *)SDL_malloc(sizeof(*timer));
- if (!timer) {
+ if (timer == NULL) {
SDL_OutOfMemory();
return 0;
}
@@ -315,7 +315,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
SDL_AtomicSet(&timer->canceled, 0);
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
- if (!entry) {
+ if (entry == NULL) {
SDL_free(timer);
SDL_OutOfMemory();
return 0;
@@ -432,7 +432,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
SDL_TimerMap *entry;
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
- if (!entry) {
+ if (entry == NULL) {
SDL_OutOfMemory();
return 0;
}
diff --git a/src/timer/ngage/SDL_systimer.cpp b/src/timer/ngage/SDL_systimer.cpp
index 543d849..bb56d23 100644
--- a/src/timer/ngage/SDL_systimer.cpp
+++ b/src/timer/ngage/SDL_systimer.cpp
@@ -38,8 +38,7 @@ extern "C" {
void
SDL_TicksInit(void)
{
- if (ticks_started)
- {
+ if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
@@ -62,8 +61,7 @@ SDL_TicksQuit(void)
Uint64
SDL_GetTicks64(void)
{
- if (! ticks_started)
- {
+ if (! ticks_started) {
SDL_TicksInit();
}
diff --git a/src/timer/psp/SDL_systimer.c b/src/timer/psp/SDL_systimer.c
index df6225f..0609958 100644
--- a/src/timer/psp/SDL_systimer.c
+++ b/src/timer/psp/SDL_systimer.c
@@ -79,8 +79,9 @@ SDL_GetPerformanceFrequency(void)
void SDL_Delay(Uint32 ms)
{
const Uint32 max_delay = 0xffffffffUL / 1000;
- if(ms > max_delay)
+ if (ms > max_delay) {
ms = max_delay;
+ }
sceKernelDelayThreadCB(ms * 1000);
}
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index 406bd48..c7696c3 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -117,7 +117,7 @@ SDL_GetTicks64(void)
return (Uint64)(((Sint64)(now.tv_sec - start_ts.tv_sec) * 1000) + ((now.tv_nsec - start_ts.tv_nsec) / 1000000));
#elif defined(__APPLE__)
const uint64_t now = mach_absolute_time();
- return ((((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000);
+ return (((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000;
#else
SDL_assert(SDL_FALSE);
return 0;
@@ -159,7 +159,7 @@ SDL_GetPerformanceCounter(void)
ticks *= 1000000;
ticks += now.tv_usec;
}
- return (ticks);
+ return ticks;
}
Uint64
diff --git a/src/timer/vita/SDL_systimer.c b/src/timer/vita/SDL_systimer.c
index db38237..899d6bf 100644
--- a/src/timer/vita/SDL_systimer.c
+++ b/src/timer/vita/SDL_systimer.c
@@ -79,8 +79,9 @@ SDL_GetPerformanceFrequency(void)
void SDL_Delay(Uint32 ms)
{
const Uint32 max_delay = 0xffffffffUL / 1000;
- if(ms > max_delay)
+ if (ms > max_delay) {
ms = max_delay;
+ }
sceKernelDelayThreadCB(ms * 1000);
}
diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c
index b67b765..d9eaa49 100644
--- a/src/video/SDL_RLEaccel.c
+++ b/src/video/SDL_RLEaccel.c
@@ -139,7 +139,7 @@
Uint16 *src = (Uint16 *)(from); \
Uint16 *dst = (Uint16 *)(to); \
Uint32 ALPHA = alpha >> 3; \
- for(i = 0; i < (int)(length); i++) { \
+ for (i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
s = (s | s << 16) & 0x07e0f81f; \
@@ -148,7 +148,7 @@
d &= 0x07e0f81f; \
*dst++ = (Uint16)(d | d >> 16); \
} \
- } while(0)
+ } while (0)
#define ALPHA_BLIT16_555(to, from, length, bpp, alpha) \
do { \
@@ -156,7 +156,7 @@
Uint16 *src = (Uint16 *)(from); \
Uint16 *dst = (Uint16 *)(to); \
Uint32 ALPHA = alpha >> 3; \
- for(i = 0; i < (int)(length); i++) { \
+ for (i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
s = (s | s << 16) & 0x03e07c1f; \
@@ -165,7 +165,7 @@
d &= 0x03e07c1f; \
*dst++ = (Uint16)(d | d >> 16); \
} \
- } while(0)
+ } while (0)
/*
* The general slow catch-all function, for remaining depths and formats
@@ -225,7 +225,7 @@
src += bpp; \
dst += bpp; \
} \
- } while(0)
+ } while (0)
/*
* Special case: 50% alpha (alpha=128)
@@ -240,13 +240,13 @@
int i; \
Uint32 *src = (Uint32 *)(from); \
Uint32 *dst = (Uint32 *)(to); \
- for(i = 0; i < (int)(length); i++) { \
+ for (i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
*dst++ = (((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) \
+ (s & d & 0x00010101); \
} \
- } while(0)
+ } while (0)
/*
* For 16bpp, we can actually blend two pixels in parallel, if we take
@@ -260,7 +260,7 @@
Uint32 d = *dst; \
*dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
(s & d & (~mask & 0xffff))); \
- } while(0)
+ } while (0)
/* basic 16bpp blender. mask is the pixels to keep when adding. */
#define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \
@@ -290,7 +290,7 @@
if (n) \
BLEND16_50(dst, src, mask); /* last odd pixel */ \
} \
- } while(0)
+ } while (0)
#define ALPHA_BLIT16_565_50(to, from, length, bpp, alpha) \
ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7deU)
@@ -324,8 +324,9 @@
} else { \
blitter(2, Uint8, ALPHA_BLIT16_565); \
} \
- } else \
+ } else { \
goto general16; \
+ } \
break; \
\
case 0x7fff: \
@@ -338,8 +339,9 @@
blitter(2, Uint8, ALPHA_BLIT16_555); \
} \
break; \
- } else \
+ } else { \
goto general16; \
+ } \
break; \
\
default: \
@@ -361,12 +363,13 @@
} else { \
blitter(4, Uint16, ALPHA_BLIT32_888); \
} \
- } else \
+ } else { \
blitter(4, Uint16, ALPHA_BLIT_ANY); \
+ } \
break; \
} \
} \
- } while(0)
+ } while (0)
/*
* Set a pixel value using the given format, except that the alpha value is
@@ -384,12 +387,6 @@
* This takes care of the case when the surface is clipped on the left and/or
* right. Top clipping has already been taken care of.
*/
-static void
-RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
- Uint8 * dstbuf, SDL_Rect * srcrect, unsigned alpha)
-{
- SDL_PixelFormat *fmt = surf_dst->format;
-
#define RLECLIPBLIT(bpp, Type, do_blit) \
do { \
int linecount = srcrect->h; \
@@ -423,24 +420,31 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
nocopy ## bpp ## do_blit: \
srcbuf += run * bpp; \
ofs += run; \
- } else if (!ofs) \
+ } else if (!ofs) { \
break; \
+ } \
\
if (ofs == w) { \
ofs = 0; \
dstbuf += surf_dst->pitch; \
- if (!--linecount) \
+ if (!--linecount) { \
break; \
+ } \
} \
} \
- } while(0)
+ } while (0)
- CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
-#undef RLECLIPBLIT
+static void
+RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
+ Uint8 * dstbuf, SDL_Rect * srcrect, unsigned alpha)
+{
+ SDL_PixelFormat *fmt = surf_dst->format;
+ CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
}
+#undef RLECLIPBLIT
/* blit a colorkeyed RLE surface */
static int SDLCALL
@@ -456,7 +460,7 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
/* Lock the destination if necessary */
if (SDL_MUSTLOCK(surf_dst)) {
if (SDL_LockSurface(surf_dst) < 0) {
- return (-1);
+ return -1;
}
}
@@ -474,19 +478,19 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
if (vskip) {
#define RLESKIP(bpp, Type) \
- for(;;) { \
+ for (;;) { \
int run; \
ofs += *(Type *)srcbuf; \
run = ((Type *)srcbuf)[1]; \
srcbuf += sizeof(Type) * 2; \
- if(run) { \
+ if (run) { \
srcbuf += run * bpp; \
ofs += run; \
- } else if(!ofs) \
+ } else if (!ofs) \
goto done; \
- if(ofs == w) { \
+ if (ofs == w) { \
ofs = 0; \
- if(!--vskip) \
+ if (!--vskip) \
break; \
} \
}
@@ -522,25 +526,25 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
do { \
int linecount = srcrect->h; \
int ofs = 0; \
- for(;;) { \
+ for (;;) { \
unsigned run; \
ofs += *(Type *)srcbuf; \
run = ((Type *)srcbuf)[1]; \
srcbuf += 2 * sizeof(Type); \
- if(run) { \
+ if (run) { \
do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
srcbuf += run * bpp; \
ofs += run; \
- } else if(!ofs) \
+ } else if (!ofs) \
break; \
- if(ofs == w) { \
+ if (ofs == w) { \
ofs = 0; \
dstbuf += surf_dst->pitch; \
- if(!--linecount) \
+ if (!--linecount) \
break; \
} \
} \
- } while(0)
+ } while (0)
CHOOSE_BLIT(RLEBLIT, alpha, fmt);
@@ -552,7 +556,7 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
if (SDL_MUSTLOCK(surf_dst)) {
SDL_UnlockSurface(surf_dst);
}
- return (0);
+ return 0;
}
#undef OPAQUE_BLIT
@@ -578,7 +582,7 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
d &= 0xff00; \
d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
dst = d1 | d | 0xff000000; \
- } while(0)
+ } while (0)
/*
* For 16bpp pixels, we have stored the 5 most significant alpha bits in
@@ -594,7 +598,7 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
d += (s - d) * alpha >> 5; \
d &= 0x07e0f81f; \
dst = (Uint16)(d | d >> 16); \
- } while(0)
+ } while (0)
#define BLIT_TRANSL_555(src, dst) \
do { \
@@ -606,7 +610,7 @@ SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
d += (s - d) * alpha >> 5; \
d &= 0x03e07c1f; \
dst = (Uint16)(d | d >> 16); \
- } while(0)
+ } while (0)
/* used to save the destination format in the encoding. Designed to be
macro-compatible with SDL_PixelFormat but without the unneeded fields */
@@ -653,27 +657,27 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
ofs += ((Ctype *)srcbuf)[0]; \
run = ((Ctype *)srcbuf)[1]; \
srcbuf += 2 * sizeof(Ctype); \
- if(run) { \
+ if (run) { \
/* clip to left and right borders */ \
int cofs = ofs; \
int crun = run; \
- if(left - cofs > 0) { \
+ if (left - cofs > 0) { \
crun -= left - cofs; \
cofs = left; \
} \
- if(crun > right - cofs) \
+ if (crun > right - cofs) \
crun = right - cofs; \
- if(crun > 0) \
+ if (crun > 0) \
PIXEL_COPY(dstbuf + cofs * sizeof(Ptype), \
srcbuf + (cofs - ofs) * sizeof(Ptype), \
(unsigned)crun, sizeof(Ptype)); \
srcbuf += run * sizeof(Ptype); \
ofs += run; \
- } else if(!ofs) \
+ } else if (!ofs) \
return; \
- } while(ofs < w); \
+ } while (ofs < w); \
/* skip padding if necessary */ \
- if(sizeof(Ptype) == 2) \
+ if (sizeof(Ptype) == 2) \
srcbuf += (uintptr_t)srcbuf & 2; \
/* blit translucent pixels on the same line */ \
ofs = 0; \
@@ -682,30 +686,30 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
ofs += ((Uint16 *)srcbuf)[0]; \
run = ((Uint16 *)srcbuf)[1]; \
srcbuf += 4; \
- if(run) { \
+ if (run) { \
/* clip to left and right borders */ \
int cofs = ofs; \
int crun = run; \
- if(left - cofs > 0) { \
+ if (left - cofs > 0) { \
crun -= left - cofs; \
cofs = left; \
} \
- if(crun > right - cofs) \
+ if (crun > right - cofs) \
crun = right - cofs; \
- if(crun > 0) { \
+ if (crun > 0) { \
Ptype *dst = (Ptype *)dstbuf + cofs; \
Uint32 *src = (Uint32 *)srcbuf + (cofs - ofs); \
int i; \
- for(i = 0; i < crun; i++) \
+ for (i = 0; i < crun; i++) \
do_blend(src[i], dst[i]); \
} \
srcbuf += run * 4; \
ofs += run; \
} \
- } while(ofs < w); \
+ } while (ofs < w); \
dstbuf += surf_dst->pitch; \
- } while(--linecount); \
- } while(0)
+ } while (--linecount); \
+ } while (0)
switch (df->BytesPerPixel) {
case 2:
@@ -819,16 +823,16 @@ SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
ofs += ((Ctype *)srcbuf)[0]; \
run = ((Ctype *)srcbuf)[1]; \
srcbuf += 2 * sizeof(Ctype); \
- if(run) { \
+ if (run) { \
PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
run, sizeof(Ptype)); \
srcbuf += run * sizeof(Ptype); \
ofs += run; \
- } else if(!ofs) \
+ } else if (!ofs) \
goto done; \
- } while(ofs < w); \
+ } while (ofs < w); \
/* skip padding if necessary */ \
- if(sizeof(Ptype) == 2) \
+ if (sizeof(Ptype) == 2) \
srcbuf += (uintptr_t)srcbuf & 2; \
/* blit translucent pixels on the same line */ \
ofs = 0; \
@@ -837,10 +841,10 @@ SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
ofs += ((Uint16 *)srcbuf)[0]; \
run = ((Uint16 *)srcbuf)[1]; \
srcbuf += 4; \
- if(run) { \
+ if (run) { \
Ptype *dst = (Ptype *)dstbuf + ofs; \
unsigned i; \
- for(i = 0; i < run; i++) { \
+ for (i = 0; i < run; i++) { \
Uint32 src = *(Uint32 *)srcbuf; \
do_blend(src, *dst); \
srcbuf += 4; \
@@ -848,10 +852,10 @@ SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
} \
ofs += run; \
} \
- } while(ofs < w); \
+ } while (ofs < w); \
dstbuf += surf_dst->pitch; \
- } while(--linecount); \
- } while(0)
+ } while (--linecount); \
+ } while (0)
switch (df->BytesPerPixel) {
case 2:
@@ -1036,11 +1040,13 @@ RLEAlphaSurface(SDL_Surface * surface)
SDL_PixelFormat *, SDL_PixelFormat *);
dest = surface->map->dst;
- if (!dest)
+ if (dest == NULL) {
return -1;
+ }
df = dest->format;
- if (surface->format->BitsPerPixel != 32)
- return -1; /* only 32bpp source supported */
+ if (surface->format->BitsPerPixel != 32) {
+ return -1; /* only 32bpp source supported */
+ }
/* find out whether the destination is one we support,
and determine the max size of the encoded result */
@@ -1090,7 +1096,7 @@ RLEAlphaSurface(SDL_Surface * surface)
maxsize += sizeof(RLEDestFormat);
rlebuf = (Uint8 *) SDL_malloc(maxsize);
- if (!rlebuf) {
+ if (rlebuf == NULL) {
return SDL_OutOfMemory();
}
{
@@ -1122,7 +1128,7 @@ RLEAlphaSurface(SDL_Surface * surface)
/* opaque counts are 8 or 16 bits, depending on target depth */
#define ADD_OPAQUE_COUNTS(n, m) \
- if(df->BytesPerPixel == 4) { \
+ if (df->BytesPerPixel == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
@@ -1150,8 +1156,9 @@ RLEAlphaSurface(SDL_Surface * surface)
while (x < w && ISOPAQUE(src[x], sf))
x++;
skip = runstart - skipstart;
- if (skip == w)
+ if (skip == w) {
blankline = 1;
+ }
run = x - runstart;
while (skip > max_opaque_run) {
ADD_OPAQUE_COUNTS(max_opaque_run, 0);
@@ -1203,8 +1210,9 @@ RLEAlphaSurface(SDL_Surface * surface)
runstart += len;
run -= len;
}
- if (!blankline)
+ if (!blankline) {
lastline = dst;
+ }
} while (x < w);
src += surface->pitch >> 2;
@@ -1230,8 +1238,9 @@ RLEAlphaSurface(SDL_Surface * surface)
/* reallocate the buffer to release unused memory */
{
Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
- if (!p)
+ if (p == NULL) {
p = rlebuf;
+ }
surface->map->data = p;
}
@@ -1247,7 +1256,7 @@ getpix_8(const Uint8 * srcbuf)
static Uint32
getpix_16(const Uint8 * srcbuf)
{
- return *(const Uint16 *) srcbuf;
+ return *(const Uint16 *)srcbuf;
}
static Uint32
@@ -1263,7 +1272,7 @@ getpix_24(const Uint8 * srcbuf)
static Uint32
getpix_32(const Uint8 * srcbuf)
{
- return *(const Uint32 *) srcbuf;
+ return *(const Uint32 *)srcbuf;
}
typedef Uint32(*getpix_func) (const Uint8 *);
@@ -1325,7 +1334,7 @@ RLEColorkeySurface(SDL_Surface * surface)
h = surface->h;
#define ADD_COUNTS(n, m) \
- if(bpp == 4) { \
+ if (bpp == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
@@ -1350,8 +1359,9 @@ RLEColorkeySurface(SDL_Surface * surface)
while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) != ckey)
x++;
skip = runstart - skipstart;
- if (skip == w)
+ if (skip == w) {
blankline = 1;
+ }
run = x - runstart;
/* encode segment */
@@ -1373,8 +1383,9 @@ RLEColorkeySurface(SDL_Surface * surface)
runstart += len;
run -= len;
}
- if (!blankline)
+ if (!blankline) {
lastline = dst;
+ }
} while (x < w);
srcbuf += surface->pitch;
@@ -1399,8 +1410,9 @@ RLEColorkeySurface(SDL_Surface * surface)
{
/* If SDL_realloc returns NULL, the original block is left intact */
Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
- if (!p)
+ if (p == NULL) {
p = rlebuf;
+ }
surface->map->data = p;
}
@@ -1466,7 +1478,7 @@ SDL_RLESurface(SDL_Surface * surface)
/* The surface is now accelerated */
surface->flags |= SDL_RLEACCEL;
- return (0);
+ return 0;
}
/*
@@ -1498,7 +1510,7 @@ UnRLEAlpha(SDL_Surface * surface)
surface->pixels = SDL_SIMDAlloc(surface->h * surface->pitch);
if (!surface->pixels) {
- return (SDL_FALSE);
+ return SDL_FALSE;
}
surface->flags |= SDL_SIMD_ALIGNED;
/* fill background with transparent pixels */
@@ -1529,8 +1541,9 @@ UnRLEAlpha(SDL_Surface * surface)
} while (ofs < w);
/* skip padding if needed */
- if (bpp == 2)
- srcbuf += (uintptr_t) srcbuf & 2;
+ if (bpp == 2) {
+ srcbuf += (uintptr_t)srcbuf & 2;
+ }
/* copy translucent pixels */
ofs = 0;
@@ -1548,7 +1561,7 @@ UnRLEAlpha(SDL_Surface * surface)
}
end_function:
- return (SDL_TRUE);
+ return SDL_TRUE;
}
void
diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c
index fa6492f..70a66ca 100644
--- a/src/video/SDL_blit.c
+++ b/src/video/SDL_blit.c
@@ -96,7 +96,7 @@ SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_UnlockSurface(src);
}
/* Blit is done! */
- return (okay ? 0 : -1);
+ return okay ? 0 : -1;
}
#if SDL_HAVE_BLIT_AUTO
diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 56ba024..1a181ab 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -1190,8 +1190,8 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info)
compositioning used (>>8 instead of /255) doesn't handle
it correctly. Also special-case alpha=0 for speed?
Benchmark this! */
- if(alpha) {
- if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+ if (alpha) {
+ if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
} else {
Uint32 d = *dstp;
@@ -1237,8 +1237,8 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info)
compositioning used (>>8 instead of /255) doesn't handle
it correctly. Also special-case alpha=0 for speed?
Benchmark this! */
- if(alpha) {
- if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+ if (alpha) {
+ if (alpha == (SDL_ALPHA_OPAQUE >> 3)) {
*dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
} else {
Uint32 d = *dstp;
@@ -1327,7 +1327,7 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info)
DUFFS_LOOP4(
{
RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
- if(sA && Pixel != ckey) {
+ if (sA && Pixel != ckey) {
RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
@@ -1370,7 +1370,7 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info)
DUFFS_LOOP4(
{
DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
- if(sA) {
+ if (sA) {
DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
@@ -1412,12 +1412,14 @@ SDL_CalculateBlitA(SDL_Surface * surface)
|| (sf->Bmask == 0xff && df->Bmask == 0x1f)))
{
#if SDL_ARM_NEON_BLITTERS
- if (SDL_HasNEON())
+ if (SDL_HasNEON()) {
return BlitARGBto565PixelAlphaARMNEON;
+ }
#endif
#if SDL_ARM_SIMD_BLITTERS
- if (SDL_HasARMSIMD())
+ if (SDL_HasARMSIMD()) {
return BlitARGBto565PixelAlphaARMSIMD;
+ }
#endif
}
#endif
@@ -1425,10 +1427,11 @@ SDL_CalculateBlitA(SDL_Surface * surface)
&& sf->Gmask == 0xff00
&& ((sf->Rmask == 0xff && df->Rmask == 0x1f)
|| (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
- if (df->Gmask == 0x7e0)
+ if (df->Gmask == 0x7e0) {
return BlitARGBto565PixelAlpha;
- else if (df->Gmask == 0x3e0)
+ } else if (df->Gmask == 0x3e0) {
return BlitARGBto555PixelAlpha;
+ }
}
return BlitNtoNPixelAlpha;
@@ -1442,23 +1445,27 @@ SDL_CalculateBlitA(SDL_Surface * surface)
&& sf->Bshift % 8 == 0
&& sf->Ashift % 8 == 0 && sf->Aloss == 0) {
#ifdef __3dNOW__
- if (SDL_Has3DNow())
+ if (SDL_Has3DNow()) {
return BlitRGBtoRGBPixelAlphaMMX3DNOW;
+ }
#endif
#ifdef __MMX__
- if (SDL_HasMMX())
+ if (SDL_HasMMX()) {
return BlitRGBtoRGBPixelAlphaMMX;
+ }
#endif
}
#endif /* __MMX__ || __3dNOW__ */
if (sf->Amask == 0xff000000) {
#if SDL_ARM_NEON_BLITTERS
- if (SDL_HasNEON())
+ if (SDL_HasNEON()) {
return BlitRGBtoRGBPixelAlphaARMNEON;
+ }
#endif
#if SDL_ARM_SIMD_BLITTERS
- if (SDL_HasARMSIMD())
+ if (SDL_HasARMSIMD()) {
return BlitRGBtoRGBPixelAlphaARMSIMD;
+ }
#endif
return BlitRGBtoRGBPixelAlpha;
}
@@ -1514,10 +1521,9 @@ SDL_CalculateBlitA(SDL_Surface * surface)
&& sf->Gmask == df->Gmask
&& sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
#ifdef __MMX__
- if (sf->Rshift % 8 == 0
- && sf->Gshift % 8 == 0
- && sf->Bshift % 8 == 0 && SDL_HasMMX())
+ if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) {
return BlitRGBtoRGBSurfaceAlphaMMX;
+ }
#endif
if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
return BlitRGBtoRGBSurfaceAlpha;
diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c
index 3efa917..458b284 100644
--- a/src/video/SDL_blit_N.c
+++ b/src/video/SDL_blit_N.c
@@ -63,8 +63,9 @@ GetL3CacheSize(void)
int err = sysctlbyname(key, &result, &typeSize, NULL, 0);
- if (0 != err)
+ if (0 != err) {
return 0;
+ }
return result;
}
@@ -762,7 +763,7 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
while ((UNALIGNED_PTR(dst)) && (width)) {
bits = *(src++);
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
- if(!srcfmt->Amask)
+ if (!srcfmt->Amask)
a = info->a;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
width--;
@@ -795,7 +796,7 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
while (extrawidth) {
bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
- if(!srcfmt->Amask)
+ if (!srcfmt->Amask)
a = info->a;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
extrawidth--;
@@ -853,7 +854,7 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
DST_CHAN_DEST);
bits = *(src++);
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
- if(!srcfmt->Amask)
+ if (!srcfmt->Amask)
a = info->a;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
width--;
@@ -890,7 +891,7 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
while (extrawidth) {
bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
- if(!srcfmt->Amask)
+ if (!srcfmt->Amask)
a = info->a;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
extrawidth--;
@@ -2307,10 +2308,18 @@ get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#else
if (srcbpp == 3 && dstbpp == 4) {
- if (p0 != 1) p0--;
- if (p1 != 1) p1--;
- if (p2 != 1) p2--;
- if (p3 != 1) p3--;
+ if (p0 != 1) {
+ p0--;
+ }
+ if (p1 != 1) {
+ p1--;
+ }
+ if (p2 != 1) {
+ p2--;
+ }
+ if (p3 != 1) {
+ p3--;
+ }
} else if (srcbpp == 4 && dstbpp == 3) {
p0 = p1;
p1 = p2;
@@ -3377,7 +3386,7 @@ SDL_CalculateBlitN(SDL_Surface * surface)
/* We don't support destinations less than 8-bits */
if (dstfmt->BitsPerPixel < 8) {
- return (NULL);
+ return NULL;
}
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
@@ -3400,8 +3409,9 @@ SDL_CalculateBlitN(SDL_Surface * surface)
} else {
/* Now the meat, choose the blitter we want */
Uint32 a_need = NO_ALPHA;
- if (dstfmt->Amask)
+ if (dstfmt->Amask) {
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
+ }
table = normal_blit[srcfmt->BytesPerPixel - 1];
for (which = 0; table[which].dstbpp; ++which) {
if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
@@ -3413,8 +3423,9 @@ SDL_CalculateBlitN(SDL_Surface * surface)
dstfmt->BytesPerPixel == table[which].dstbpp &&
(a_need & table[which].alpha) == a_need &&
((table[which].blit_features & GetBlitFeatures()) ==
- table[which].blit_features))
+ table[which].blit_features)) {
break;
+ }
}
blitfun = table[which].blitfunc;
@@ -3444,7 +3455,7 @@ SDL_CalculateBlitN(SDL_Surface * surface)
}
}
}
- return (blitfun);
+ return blitfun;
case SDL_COPY_COLORKEY:
/* colorkey blit: Here we don't have too many options, mostly
diff --git a/src/video/SDL_blit_auto.c b/src/video/SDL_blit_auto.c
index f15a436..ed121e1 100644
--- a/src/video/SDL_blit_auto.c
+++ b/src/video/SDL_blit_auto.c
@@ -82,9 +82,15 @@ static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -143,9 +149,15 @@ static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -284,9 +296,15 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -294,9 +312,15 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -363,9 +387,15 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -373,9 +403,15 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -446,9 +482,15 @@ static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -507,9 +549,15 @@ static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -648,9 +696,15 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -658,9 +712,15 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -727,9 +787,15 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -737,9 +803,15 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -810,9 +882,15 @@ static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = 0xFF;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -873,9 +951,15 @@ static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = 0xFF;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1020,9 +1104,15 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1030,10 +1120,18 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -1101,9 +1199,15 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1111,10 +1215,18 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -1185,9 +1297,15 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1246,9 +1364,15 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1387,9 +1511,15 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1397,9 +1527,15 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -1466,9 +1602,15 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1476,9 +1618,15 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -1544,9 +1692,15 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1605,9 +1759,15 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1746,9 +1906,15 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1756,9 +1922,15 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -1825,9 +1997,15 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1835,9 +2013,15 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -1910,9 +2094,15 @@ static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = 0xFF;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -1973,9 +2163,15 @@ static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = 0xFF;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2120,9 +2316,15 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2130,10 +2332,18 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -2201,9 +2411,15 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2211,10 +2427,18 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -2291,9 +2515,15 @@ static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2301,9 +2531,15 @@ static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -2360,9 +2596,15 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2370,9 +2612,15 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -2503,9 +2751,15 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2513,9 +2767,15 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -2584,9 +2844,15 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2594,9 +2860,15 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -2675,9 +2947,15 @@ static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2685,9 +2963,15 @@ static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -2744,9 +3028,15 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2754,9 +3044,15 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -2887,9 +3183,15 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2897,9 +3199,15 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -2968,9 +3276,15 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -2978,9 +3292,15 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -3055,9 +3375,15 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3065,10 +3391,18 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -3126,9 +3460,15 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3136,10 +3476,18 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -3279,9 +3627,15 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3289,10 +3643,18 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -3362,9 +3724,15 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3372,10 +3740,18 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -3452,9 +3828,15 @@ static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3462,9 +3844,15 @@ static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -3521,9 +3909,15 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3531,9 +3925,15 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -3664,9 +4064,15 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3674,9 +4080,15 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -3745,9 +4157,15 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3755,9 +4173,15 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -3836,9 +4260,15 @@ static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3846,9 +4276,15 @@ static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -3905,9 +4341,15 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -3915,9 +4357,15 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -4048,9 +4496,15 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4058,9 +4512,15 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -4129,9 +4589,15 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4139,9 +4605,15 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -4219,9 +4691,15 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4229,10 +4707,18 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -4290,9 +4776,15 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4300,10 +4792,18 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -4443,9 +4943,15 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4453,10 +4959,18 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -4526,9 +5040,15 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4536,10 +5056,18 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -4618,9 +5146,15 @@ static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4628,9 +5162,15 @@ static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -4687,9 +5227,15 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4697,9 +5243,15 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -4830,9 +5382,15 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4840,9 +5398,15 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -4911,9 +5475,15 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -4921,9 +5491,15 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -5000,9 +5576,15 @@ static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5010,9 +5592,15 @@ static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -5069,9 +5657,15 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5079,9 +5673,15 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -5212,9 +5812,15 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5222,9 +5828,15 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -5293,9 +5905,15 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5303,9 +5921,15 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -5385,9 +6009,15 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5395,10 +6025,18 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -5456,9 +6094,15 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5466,10 +6110,18 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -5609,9 +6261,15 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5619,10 +6277,18 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -5692,9 +6358,15 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5702,10 +6374,18 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -5784,9 +6464,15 @@ static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5794,9 +6480,15 @@ static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -5853,9 +6545,15 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -5863,9 +6561,15 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -5996,9 +6700,15 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6006,9 +6716,15 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -6077,9 +6793,15 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6087,9 +6809,15 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstR << 16) | (dstG << 8) | dstB;
@@ -6166,9 +6894,15 @@ static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6176,9 +6910,15 @@ static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -6235,9 +6975,15 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6245,9 +6991,15 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -6378,9 +7130,15 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6388,9 +7146,15 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -6459,9 +7223,15 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = srcB + ((255 - srcA) * dstB) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6469,9 +7239,15 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
break;
}
dstpixel = (dstB << 16) | (dstG << 8) | dstR;
@@ -6551,9 +7327,15 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6561,10 +7343,18 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -6622,9 +7412,15 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6632,10 +7428,18 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -6775,9 +7579,15 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6785,10 +7595,18 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
@@ -6858,9 +7676,15 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstA = srcA + ((255 - srcA) * dstA) / 255;
break;
case SDL_COPY_ADD:
- dstR = srcR + dstR; if (dstR > 255) dstR = 255;
- dstG = srcG + dstG; if (dstG > 255) dstG = 255;
- dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ dstR = srcR + dstR; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = srcG + dstG; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = srcB + dstB; if (dstB > 255) {
+ dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -6868,10 +7692,18 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
dstB = (srcB * dstB) / 255;
break;
case SDL_COPY_MUL:
- dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) dstR = 255;
- dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) dstG = 255;
- dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) dstB = 255;
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) dstA = 255;
+ dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255; if (dstR > 255) {
+ dstR = 255;
+ }
+ dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255; if (dstG > 255) {
+ dstG = 255;
+ }
+ dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255; if (dstB > 255) {
+ dstB = 255;
+ }
+ dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255; if (dstA > 255) {
+ dstA = 255;
+ }
break;
}
dstpixel = (dstA << 24) | (dstR << 16) | (dstG << 8) | dstB;
diff --git a/src/video/SDL_blit_copy.c b/src/video/SDL_blit_copy.c
index 0223d9a..91e2de9 100644
--- a/src/video/SDL_blit_copy.c
+++ b/src/video/SDL_blit_copy.c
@@ -47,8 +47,9 @@ SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
dst += 64;
}
- if (len & 63)
+ if (len & 63) {
SDL_memcpy(dst, src, len & 63);
+ }
}
#endif /* __SSE__ */
@@ -65,7 +66,7 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
__m64* d64 = (__m64*)dst;
__m64* s64 = (__m64*)src;
- for(i= len / 64; i--;) {
+ for (i= len / 64; i--;) {
d64[0] = s64[0];
d64[1] = s64[1];
d64[2] = s64[2];
@@ -79,8 +80,7 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
s64 += 8;
}
- if (remain)
- {
+ if (remain) {
const int skip = len - remain;
SDL_memcpy(dst + skip, src + skip, remain);
}
diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c
index ed9c692..ebcb825 100644
--- a/src/video/SDL_blit_slow.c
+++ b/src/video/SDL_blit_slow.c
@@ -148,14 +148,17 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
break;
case SDL_COPY_ADD:
dstR = srcR + dstR;
- if (dstR > 255)
+ if (dstR > 255) {
dstR = 255;
+ }
dstG = srcG + dstG;
- if (dstG > 255)
+ if (dstG > 255) {
dstG = 255;
+ }
dstB = srcB + dstB;
- if (dstB > 255)
+ if (dstB > 255) {
dstB = 255;
+ }
break;
case SDL_COPY_MOD:
dstR = (srcR * dstR) / 255;
@@ -164,17 +167,21 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
break;
case SDL_COPY_MUL:
dstR = ((srcR * dstR) + (dstR * (255 - srcA))) / 255;
- if (dstR > 255)
+ if (dstR > 255) {
dstR = 255;
+ }
dstG = ((srcG * dstG) + (dstG * (255 - srcA))) / 255;
- if (dstG > 255)
+ if (dstG > 255) {
dstG = 255;
+ }
dstB = ((srcB * dstB) + (dstB * (255 - srcA))) / 255;
- if (dstB > 255)
+ if (dstB > 255) {
dstB = 255;
+ }
dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255;
- if (dstA > 255)
+ if (dstA > 255) {
dstA = 255;
+ }
break;
}
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c
index 369b925..884580d 100644
--- a/src/video/SDL_bmp.c
+++ b/src/video/SDL_bmp.c
@@ -67,17 +67,21 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8
Uint8 ch;
Uint8 needsPad;
-#define COPY_PIXEL(x) spot = &bits[ofs++]; if(spot >= start && spot < end) *spot = (x)
+#define COPY_PIXEL(x) spot = &bits[ofs++]; if (spot >= start && spot < end) *spot = (x)
for (;;) {
- if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &ch, 1, 1)) {
+ return SDL_TRUE;
+ }
/*
| encoded mode starts with a run length, and then a byte
| with two colour indexes to alternate between for the run
*/
if (ch) {
Uint8 pixel;
- if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &pixel, 1, 1)) {
+ return SDL_TRUE;
+ }
if (isRle8) { /* 256-color bitmap, compressed */
do {
COPY_PIXEL(pixel);
@@ -87,9 +91,13 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8
Uint8 pixel1 = pixel & 0x0F;
for (;;) {
COPY_PIXEL(pixel0); /* even count, high nibble */
- if (!--ch) break;
+ if (!--ch) {
+ break;
+ }
COPY_PIXEL(pixel1); /* odd count, low nibble */
- if (!--ch) break;
+ if (!--ch) {
+ break;
+ }
}
}
} else {
@@ -98,7 +106,9 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8
| a cursor move, or some absolute data.
| zero tag may be absolute mode or an escape
*/
- if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &ch, 1, 1)) {
+ return SDL_TRUE;
+ }
switch (ch) {
case 0: /* end of line */
ofs = 0;
@@ -107,9 +117,13 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8
case 1: /* end of bitmap */
return SDL_FALSE; /* success! */
case 2: /* delta */
- if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &ch, 1, 1)) {
+ return SDL_TRUE;
+ }
ofs += ch;
- if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &ch, 1, 1)) {
+ return SDL_TRUE;
+ }
bits -= (ch * pitch);
break;
default: /* no compression */
@@ -117,22 +131,32 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8
needsPad = (ch & 1);
do {
Uint8 pixel;
- if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &pixel, 1, 1)) {
+ return SDL_TRUE;
+ }
COPY_PIXEL(pixel);
} while (--ch);
} else {
needsPad = (((ch+1)>>1) & 1); /* (ch+1)>>1: bytes size */
for (;;) {
Uint8 pixel;
- if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE;
+ if (!SDL_RWread(src, &pixel, 1, 1)) {
+ return SDL_TRUE;
+ }
COPY_PIXEL(pixel >> 4);
- if (!--ch) break;
+ if (!--ch) {
+ break;
+ }
COPY_PIXEL(pixel & 0x0F);
- if (!--ch) break;
+ if (!--ch) {
+ break;
+ }
}
}
/* pad at even boundary */
- if (needsPad && !SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE;
+ if (needsPad && !SDL_RWread(src, &ch, 1, 1)) {
+ return SDL_TRUE;
+ }
break;
}
}
@@ -463,7 +487,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
}
if ((biCompression == BI_RLE4) || (biCompression == BI_RLE8)) {
was_error = readRlePixels(surface, src, biCompression == BI_RLE8);
- if (was_error) SDL_Error(SDL_EFREAD);
+ if (was_error) {
+ SDL_Error(SDL_EFREAD);
+ }
goto done;
}
top = (Uint8 *)surface->pixels;
@@ -538,15 +564,17 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
case 15:
case 16:{
Uint16 *pix = (Uint16 *) bits;
- for (i = 0; i < surface->w; i++)
+ for (i = 0; i < surface->w; i++) {
pix[i] = SDL_Swap16(pix[i]);
+ }
break;
}
case 32:{
Uint32 *pix = (Uint32 *) bits;
- for (i = 0; i < surface->w; i++)
+ for (i = 0; i < surface->w; i++) {
pix[i] = SDL_Swap32(pix[i]);
+ }
break;
}
}
@@ -580,7 +608,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
if (freesrc && src) {
SDL_RWclose(src);
}
- return (surface);
+ return surface;
}
int
@@ -665,7 +693,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
SDL_InitFormat(&format, SDL_PIXELFORMAT_BGR24);
}
surface = SDL_ConvertSurface(saveme, &format, 0);
- if (!surface) {
+ if (surface == NULL) {
SDL_SetError("Couldn't convert image to %d bpp",
format.BitsPerPixel);
}
@@ -820,7 +848,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
if (freedst && dst) {
SDL_RWclose(dst);
}
- return ((SDL_strcmp(SDL_GetError(), "") == 0) ? 0 : -1);
+ return (SDL_strcmp(SDL_GetError(), "") == 0) ? 0 : -1;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c
index b5ea5ed..f1ce892 100644
--- a/src/video/SDL_clipboard.c
+++ b/src/video/SDL_clipboard.c
@@ -29,11 +29,11 @@ SDL_SetClipboardText(const char *text)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
return SDL_SetError("Video subsystem must be initialized to set clipboard text");
}
- if (!text) {
+ if (text == NULL) {
text = "";
}
if (_this->SetClipboardText) {
@@ -50,11 +50,11 @@ SDL_SetPrimarySelectionText(const char *text)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
return SDL_SetError("Video subsystem must be initialized to set primary selection text");
}
- if (!text) {
+ if (text == NULL) {
text = "";
}
if (_this->SetPrimarySelectionText) {
@@ -71,7 +71,7 @@ SDL_GetClipboardText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
SDL_SetError("Video subsystem must be initialized to get clipboard text");
return SDL_strdup("");
}
@@ -80,7 +80,7 @@ SDL_GetClipboardText(void)
return _this->GetClipboardText(_this);
} else {
const char *text = _this->clipboard_text;
- if (!text) {
+ if (text == NULL) {
text = "";
}
return SDL_strdup(text);
@@ -92,7 +92,7 @@ SDL_GetPrimarySelectionText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
SDL_SetError("Video subsystem must be initialized to get primary selection text");
return SDL_strdup("");
}
@@ -101,7 +101,7 @@ SDL_GetPrimarySelectionText(void)
return _this->GetPrimarySelectionText(_this);
} else {
const char *text = _this->primary_selection_text;
- if (!text) {
+ if (text == NULL) {
text = "";
}
return SDL_strdup(text);
@@ -113,7 +113,7 @@ SDL_HasClipboardText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
SDL_SetError("Video subsystem must be initialized to check clipboard text");
return SDL_FALSE;
}
@@ -134,7 +134,7 @@ SDL_HasPrimarySelectionText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- if (!_this) {
+ if (_this == NULL) {
SDL_SetError("Video subsystem must be initialized to check primary selection text");
return SDL_FALSE;
}
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 41ae6ec..d6385e0 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -250,19 +250,19 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc)
const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32) 1) << 16) | 5);
/* EGL 1.5 can use eglGetProcAddress() for any symbol. 1.4 and earlier can't use it for core entry points. */
- if (!retval && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
+ if (retval == NULL && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
retval = _this->egl_data->eglGetProcAddress(proc);
}
#if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */
/* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */
- if (!retval) {
+ if (retval == NULL) {
retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc);
}
#endif
/* Try eglGetProcAddress if we're on <= 1.4 and still searching... */
- if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
+ if (retval == NULL && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
retval = _this->egl_data->eglGetProcAddress(proc);
}
}
@@ -611,8 +611,7 @@ SDL_EGL_InitializeOffscreen(_THIS, int device)
if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
return SDL_SetError("Could not initialize EGL");
}
- }
- else {
+ } else {
int i;
SDL_bool found = SDL_FALSE;
EGLDisplay attempted_egl_display;
@@ -818,8 +817,7 @@ SDL_EGL_PrivateChooseConfig(_THIS, SDL_bool set_config_caveat_none)
}
/* first ensure that a found config has a matching format, or the function will fall through. */
- if (_this->egl_data->egl_required_visual_id)
- {
+ if (_this->egl_data->egl_required_visual_id) {
for (i = 0; i < found_configs; i++ ) {
EGLint format;
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c
index 222d69e..748b61a 100644
--- a/src/video/SDL_fillrect.c
+++ b/src/video/SDL_fillrect.c
@@ -237,12 +237,12 @@ SDL_FillRect4(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
int
SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
{
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_FillRect(): dst");
}
/* If 'rect' == NULL, then fill the whole surface */
- if (!rect) {
+ if (rect == NULL) {
rect = &dst->clip_rect;
/* Don't attempt to fill if the surface's clip_rect is empty */
if (SDL_RectEmpty(rect)) {
@@ -305,7 +305,7 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
void (*fill_function)(Uint8 * pixels, int pitch, Uint32 color, int w, int h) = NULL;
int i;
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("SDL_FillRects(): dst");
}
@@ -319,7 +319,7 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
return SDL_SetError("SDL_FillRects(): You must lock the surface");
}
- if (!rects) {
+ if (rects == NULL) {
return SDL_InvalidParamError("SDL_FillRects(): rects");
}
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index 6544532..e4dc0cc 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -83,11 +83,12 @@ Uint8* SDL_expand_byte[9] = {
/* Helper functions */
+#define CASE(X) case X: return #X;
const char*
SDL_GetPixelFormatName(Uint32 format)
{
switch (format) {
-#define CASE(X) case X: return #X;
+
CASE(SDL_PIXELFORMAT_INDEX1LSB)
CASE(SDL_PIXELFORMAT_INDEX1MSB)
CASE(SDL_PIXELFORMAT_INDEX4LSB)
@@ -127,11 +128,12 @@ SDL_GetPixelFormatName(Uint32 format)
CASE(SDL_PIXELFORMAT_NV12)
CASE(SDL_PIXELFORMAT_NV21)
CASE(SDL_PIXELFORMAT_EXTERNAL_OES)
-#undef CASE
+
default:
return "SDL_PIXELFORMAT_UNKNOWN";
}
}
+#undef CASE
SDL_bool
SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
@@ -565,8 +567,9 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
format->Rshift = 0;
format->Rloss = 8;
if (Rmask) {
- for (mask = Rmask; !(mask & 0x01); mask >>= 1)
+ for (mask = Rmask; !(mask & 0x01); mask >>= 1) {
++format->Rshift;
+ }
for (; (mask & 0x01); mask >>= 1)
--format->Rloss;
}
@@ -575,8 +578,9 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
format->Gshift = 0;
format->Gloss = 8;
if (Gmask) {
- for (mask = Gmask; !(mask & 0x01); mask >>= 1)
+ for (mask = Gmask; !(mask & 0x01); mask >>= 1) {
++format->Gshift;
+ }
for (; (mask & 0x01); mask >>= 1)
--format->Gloss;
}
@@ -585,8 +589,9 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
format->Bshift = 0;
format->Bloss = 8;
if (Bmask) {
- for (mask = Bmask; !(mask & 0x01); mask >>= 1)
+ for (mask = Bmask; !(mask & 0x01); mask >>= 1) {
++format->Bshift;
+ }
for (; (mask & 0x01); mask >>= 1)
--format->Bloss;
}
@@ -595,8 +600,9 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
format->Ashift = 0;
format->Aloss = 8;
if (Amask) {
- for (mask = Amask; !(mask & 0x01); mask >>= 1)
+ for (mask = Amask; !(mask & 0x01); mask >>= 1) {
++format->Ashift;
+ }
for (; (mask & 0x01); mask >>= 1)
--format->Aloss;
}
@@ -613,7 +619,7 @@ SDL_FreeFormat(SDL_PixelFormat *format)
{
SDL_PixelFormat *prev;
- if (!format) {
+ if (format == NULL) {
SDL_InvalidParamError("format");
return;
}
@@ -657,7 +663,7 @@ SDL_AllocPalette(int ncolors)
}
palette = (SDL_Palette *) SDL_malloc(sizeof(*palette));
- if (!palette) {
+ if (palette == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -679,7 +685,7 @@ SDL_AllocPalette(int ncolors)
int
SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette)
{
- if (!format) {
+ if (format == NULL) {
return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format");
}
@@ -711,7 +717,7 @@ SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors,
int status = 0;
/* Verify the parameters */
- if (!palette) {
+ if (palette == NULL) {
return -1;
}
if (ncolors > (palette->ncolors - firstcolor)) {
@@ -734,7 +740,7 @@ SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors,
void
SDL_FreePalette(SDL_Palette * palette)
{
- if (!palette) {
+ if (palette == NULL) {
SDL_InvalidParamError("palette");
return;
}
@@ -752,8 +758,9 @@ void
SDL_DitherColors(SDL_Color * colors, int bpp)
{
int i;
- if (bpp != 8)
- return; /* only 8bpp supported right now */
+ if (bpp != 8) {
+ return; /* only 8bpp supported right now */
+ }
for (i = 0; i < 256; i++) {
int r, g, b;
@@ -801,7 +808,7 @@ SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
smallest = distance;
}
}
- return (pixel);
+ return pixel;
}
/* Tell whether palette is opaque, and if it has an alpha_channel */
@@ -857,9 +864,7 @@ Uint32
SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)
{
if (format->palette == NULL) {
- return (r >> format->Rloss) << format->Rshift
- | (g >> format->Gloss) << format->Gshift
- | (b >> format->Bloss) << format->Bshift | format->Amask;
+ return (r >> format->Rloss) << format->Rshift | (g >> format->Gloss) << format->Gshift | (b >> format->Bloss) << format->Bshift | format->Amask;
} else {
return SDL_FindColor(format->palette, r, g, b, SDL_ALPHA_OPAQUE);
}
@@ -871,10 +876,7 @@ SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b,
Uint8 a)
{
if (format->palette == NULL) {
- return (r >> format->Rloss) << format->Rshift
- | (g >> format->Gloss) << format->Gshift
- | (b >> format->Bloss) << format->Bshift
- | ((Uint32)(a >> format->Aloss) << format->Ashift & format->Amask);
+ return (r >> format->Rloss) << format->Rshift | (g >> format->Gloss) << format->Gshift | (b >> format->Bloss) << format->Bshift | ((Uint32)(a >> format->Aloss) << format->Ashift & format->Amask);
} else {
return SDL_FindColor(format->palette, r, g, b, a);
}
@@ -945,7 +947,7 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
(src->colors, dst->colors,
src->ncolors * sizeof(SDL_Color)) == 0)) {
*identical = 1;
- return (NULL);
+ return NULL;
}
}
*identical = 0;
@@ -953,14 +955,14 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
map = (Uint8 *) SDL_calloc(256, sizeof(Uint8));
if (map == NULL) {
SDL_OutOfMemory();
- return (NULL);
+ return NULL;
}
for (i = 0; i < src->ncolors; ++i) {
map[i] = SDL_FindColor(dst,
src->colors[i].r, src->colors[i].g,
src->colors[i].b, src->colors[i].a);
}
- return (map);
+ return map;
}
/* Map from Palette to BitField */
@@ -977,7 +979,7 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
map = (Uint8 *) SDL_calloc(256, bpp);
if (map == NULL) {
SDL_OutOfMemory();
- return (NULL);
+ return NULL;
}
/* We memory copy to the pixel map so the endianness is preserved */
@@ -988,7 +990,7 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
Uint8 A = (Uint8) ((pal->colors[i].a * Amod) / 255);
ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, (Uint32)R, (Uint32)G, (Uint32)B, (Uint32)A);
}
- return (map);
+ return map;
}
/* Map from BitField to Dithered-Palette to Palette */
@@ -1003,7 +1005,7 @@ MapNto1(SDL_PixelFormat * src, SDL_PixelFormat * dst, int *identical)
dithered.ncolors = 256;
SDL_DitherColors(colors, 8);
dithered.colors = colors;
- return (Map1to1(&dithered, pal, identical));
+ return Map1to1(&dithered, pal, identical);
}
SDL_BlitMap *
@@ -1015,7 +1017,7 @@ SDL_AllocBlitMap(void)
map = (SDL_BlitMap *) SDL_calloc(1, sizeof(*map));
if (map == NULL) {
SDL_OutOfMemory();
- return (NULL);
+ return NULL;
}
map->info.r = 0xFF;
map->info.g = 0xFF;
@@ -1023,7 +1025,7 @@ SDL_AllocBlitMap(void)
map->info.a = 0xFF;
/* It's ready to go */
- return (map);
+ return map;
}
@@ -1045,7 +1047,7 @@ SDL_InvalidateAllBlitMap(SDL_Surface *surface)
void
SDL_InvalidateMap(SDL_BlitMap * map)
{
- if (!map) {
+ if (map == NULL) {
return;
}
if (map->dst) {
@@ -1086,18 +1088,19 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
Map1to1(srcfmt->palette, dstfmt->palette, &map->identity);
if (!map->identity) {
if (map->info.table == NULL) {
- return (-1);
+ return -1;
}
}
- if (srcfmt->BitsPerPixel != dstfmt->BitsPerPixel)
+ if (srcfmt->BitsPerPixel != dstfmt->BitsPerPixel) {
map->identity = 0;
+ }
} else {
/* Palette --> BitField */
map->info.table =
Map1toN(srcfmt, src->map->info.r, src->map->info.g,
src->map->info.b, src->map->info.a, dstfmt);
if (map->info.table == NULL) {
- return (-1);
+ return -1;
}
}
} else {
@@ -1106,7 +1109,7 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
map->info.table = MapNto1(srcfmt, dstfmt, &map->identity);
if (!map->identity) {
if (map->info.table == NULL) {
- return (-1);
+ return -1;
}
}
map->identity = 0; /* Don't optimize to copy */
@@ -1138,7 +1141,7 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
}
/* Choose your blitters wisely */
- return (SDL_CalculateBlit(src));
+ return SDL_CalculateBlit(src);
}
void
diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c
index dfa9390..26eb3ce 100644
--- a/src/video/SDL_rect.c
+++ b/src/video/SDL_rect.c
@@ -39,10 +39,10 @@ SDL_GetSpanEnclosingRect(int width, int height,
} else if (height < 1) {
SDL_InvalidParamError("height");
return SDL_FALSE;
- } else if (!rects) {
+ } else if (rects == NULL) {
SDL_InvalidParamError("rects");
return SDL_FALSE;
- } else if (!span) {
+ } else if (span == NULL) {
SDL_InvalidParamError("span");
return SDL_FALSE;
} else if (numrects < 1) {
diff --git a/src/video/SDL_rect_impl.h b/src/video/SDL_rect_impl.h
index 26a5448..0e2513c 100644
--- a/src/video/SDL_rect_impl.h
+++ b/src/video/SDL_rect_impl.h
@@ -26,10 +26,10 @@ SDL_HASINTERSECTION(const RECTTYPE * A, const RECTTYPE * B)
{
SCALARTYPE Amin, Amax, Bmin, Bmax;
- if (!A) {
+ if (A == NULL) {
SDL_InvalidParamError("A");
return SDL_FALSE;
- } else if (!B) {
+ } else if (B == NULL) {
SDL_InvalidParamError("B");
return SDL_FALSE;
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) {
@@ -72,13 +72,13 @@ SDL_INTERSECTRECT(const RECTTYPE * A, const RECTTYPE * B, RECTTYPE * result)
{
SCALARTYPE Amin, Amax, Bmin, Bmax;
- if (!A) {
+ if (A == NULL) {
SDL_InvalidParamError("A");
return SDL_FALSE;
- } else if (!B) {
+ } else if (B == NULL) {
SDL_InvalidParamError("B");
return SDL_FALSE;
- } else if (!result) {
+ } else if (result == NULL) {
SDL_InvalidParamError("result");
return SDL_FALSE;
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { /* Special cases for empty rects */
@@ -123,13 +123,13 @@ SDL_UNIONRECT(const RECTTYPE * A, const RECTTYPE * B, RECTTYPE * result)
{
SCALARTYPE Amin, Amax, Bmin, Bmax;
- if (!A) {
+ if (A == NULL) {
SDL_InvalidParamError("A");
return;
- } else if (!B) {
+ } else if (B == NULL) {
SDL_InvalidParamError("B");
return;
- } else if (!result) {
+ } else if (result == NULL) {
SDL_InvalidParamError("result");
return;
} else if (SDL_RECTEMPTY(A)) { /* Special cases for empty Rects */
@@ -183,7 +183,7 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE * points, int count, const RECTTYPE *
SCALARTYPE x, y;
int i;
- if (!points) {
+ if (points == NULL) {
SDL_InvalidParamError("points");
return SDL_FALSE;
} else if (count < 1) {
@@ -305,19 +305,19 @@ SDL_INTERSECTRECTANDLINE(const RECTTYPE * rect, SCALARTYPE *X1, SCALARTYPE *Y1,
SCALARTYPE recty2;
int outcode1, outcode2;
- if (!rect) {
+ if (rect == NULL) {
SDL_InvalidParamError("rect");
return SDL_FALSE;
- } else if (!X1) {
+ } else if (X1 == NULL) {
SDL_InvalidParamError("X1");
return SDL_FALSE;
- } else if (!Y1) {
+ } else if (Y1 == NULL) {
SDL_InvalidParamError("Y1");
return SDL_FALSE;
- } else if (!X2) {
+ } else if (X2 == NULL) {
SDL_InvalidParamError("X2");
return SDL_FALSE;
- } else if (!Y2) {
+ } else if (Y2 == NULL) {
SDL_InvalidParamError("Y2");
return SDL_FALSE;
} else if (SDL_RECTEMPTY(rect)) {
diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c
index 6c95164..f45dc25 100644
--- a/src/video/SDL_shape.c
+++ b/src/video/SDL_shape.c
@@ -33,33 +33,31 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
{
SDL_Window *result = NULL;
result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */);
- if(result != NULL) {
+ if (result != NULL) {
if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) {
SDL_DestroyWindow(result);
return NULL;
}
result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
- if(result->shaper != NULL) {
+ if (result->shaper != NULL) {
result->shaper->userx = x;
result->shaper->usery = y;
result->shaper->mode.mode = ShapeModeDefault;
result->shaper->mode.parameters.binarizationCutoff = 1;
result->shaper->hasshape = SDL_FALSE;
return result;
- }
- else {
+ } else {
SDL_DestroyWindow(result);
return NULL;
}
- }
- else
+ } else
return NULL;
}
SDL_bool
SDL_IsShapedWindow(const SDL_Window *window)
{
- if(window == NULL)
+ if (window == NULL)
return SDL_FALSE;
else
return (SDL_bool)(window->shaper != NULL);
@@ -78,14 +76,15 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
Uint8 *bitmap_scanline;
SDL_Color key;
- if(SDL_MUSTLOCK(shape))
+ if (SDL_MUSTLOCK(shape)) {
SDL_LockSurface(shape);
+ }
SDL_memset(bitmap, 0, shape->h * bytes_per_scanline);
- for(y = 0;y<shape->h;y++) {
+ for (y = 0;y<shape->h;y++) {
bitmap_scanline = bitmap + y * bytes_per_scanline;
- for(x=0;x<shape->w;x++) {
+ for (x=0;x<shape->w;x++) {
alpha = 0;
pixel_value = 0;
pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
@@ -123,8 +122,9 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
}
}
- if(SDL_MUSTLOCK(shape))
+ if (SDL_MUSTLOCK(shape)) {
SDL_UnlockSurface(shape);
+ }
}
static SDL_ShapeTree*
@@ -139,8 +139,8 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
SDL_ShapeTree* result = (SDL_ShapeTree*)SDL_malloc(sizeof(SDL_ShapeTree));
SDL_Rect next = {0,0,0,0};
- for(y=dimensions.y;y<dimensions.y + dimensions.h;y++) {
- for(x=dimensions.x;x<dimensions.x + dimensions.w;x++) {
+ for (y=dimensions.y;y<dimensions.y + dimensions.h;y++) {
+ for (x=dimensions.x;x<dimensions.x + dimensions.w;x++) {
pixel_value = 0;
pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
switch(mask->format->BytesPerPixel) {
@@ -173,9 +173,10 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
pixel_opaque = ((key.r != r || key.g != g || key.b != b) ? SDL_TRUE : SDL_FALSE);
break;
}
- if(last_opaque == -1)
+ if (last_opaque == -1) {
last_opaque = pixel_opaque;
- if(last_opaque != pixel_opaque) {
+ }
+ if (last_opaque != pixel_opaque) {
const int halfwidth = dimensions.w / 2;
const int halfheight = dimensions.h / 2;
@@ -224,11 +225,13 @@ SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape)
dimensions.w = shape->w;
dimensions.h = shape->h;
- if(SDL_MUSTLOCK(shape))
+ if (SDL_MUSTLOCK(shape)) {
SDL_LockSurface(shape);
+ }
result = RecursivelyCalculateShapeTree(mode,shape,dimensions);
- if(SDL_MUSTLOCK(shape))
+ if (SDL_MUSTLOCK(shape)) {
SDL_UnlockSurface(shape);
+ }
return result;
}
@@ -236,20 +239,19 @@ void
SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure)
{
SDL_assert(tree != NULL);
- if(tree->kind == QuadShape) {
+ if (tree->kind == QuadShape) {
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure);
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright,function,closure);
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downleft,function,closure);
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downright,function,closure);
- }
- else
+ } else
function(tree,closure);
}
void
SDL_FreeShapeTree(SDL_ShapeTree** shape_tree)
{
- if((*shape_tree)->kind == QuadShape) {
+ if ((*shape_tree)->kind == QuadShape) {
SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upleft);
SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upright);
SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downleft);
@@ -318,29 +320,28 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh
static SDL_bool
SDL_WindowHasAShape(SDL_Window *window)
{
- if (window == NULL || !SDL_IsShapedWindow(window))
+ if (window == NULL || !SDL_IsShapedWindow(window)) {
return SDL_FALSE;
+ }
return window->shaper->hasshape;
}
int
SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode)
{
- if(window != NULL && SDL_IsShapedWindow(window)) {
- if(shape_mode == NULL) {
- if(SDL_WindowHasAShape(window))
+ if (window != NULL && SDL_IsShapedWindow(window)) {
+ if (shape_mode == NULL) {
+ if (SDL_WindowHasAShape(window))
/* The window given has a shape. */
return 0;
else
/* The window given is shapeable but lacks a shape. */
return SDL_WINDOW_LACKS_SHAPE;
- }
- else {
+ } else {
*shape_mode = window->shaper->mode;
return 0;
}
- }
- else
+ } else
/* The window given is not a valid shapeable window. */
return SDL_NONSHAPEABLE_WINDOW;
}
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 5930e40..129debe 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -121,7 +121,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
SDL_Palette *palette =
SDL_AllocPalette((1 << surface->format->BitsPerPixel));
- if (!palette) {
+ if (palette == NULL) {
SDL_FreeSurface(surface);
return NULL;
}
@@ -292,7 +292,7 @@ SDL_CreateRGBSurfaceWithFormatFrom(void *pixels,
int
SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette)
{
- if (!surface) {
+ if (surface == NULL) {
return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface");
}
if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) {
@@ -308,7 +308,7 @@ SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
{
int flags;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -327,7 +327,7 @@ SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
SDL_bool
SDL_HasSurfaceRLE(SDL_Surface * surface)
{
- if (!surface) {
+ if (surface == NULL) {
return SDL_FALSE;
}
@@ -343,7 +343,7 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
{
int flags;
- if (!surface) {
+ if (surface == NULL) {
return SDL_InvalidParamError("surface");
}
@@ -372,7 +372,7 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
SDL_bool
SDL_HasColorKey(SDL_Surface * surface)
{
- if (!surface) {
+ if (surface == NULL) {
return SDL_FALSE;
}
@@ -386,7 +386,7 @@ SDL_HasColorKey(SDL_Surface * surface)
int
SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
{
- if (!surface) {
+ if (surface == NULL) {
return SDL_InvalidParamError("surface");
}
@@ -407,7 +407,7 @@ SDL_ConvertColorkeyToAlpha(SDL_Surface * surface, SDL_bool ignore_alpha)
{
int x, y, bpp;
- if (!surface) {
+ if (surface == NULL) {
return;
}
@@ -497,7 +497,7 @@ SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
{
int flags;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -521,7 +521,7 @@ SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
int
SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b)
{
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -542,7 +542,7 @@ SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha)
{
int flags;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -563,7 +563,7 @@ SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha)
int
SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha)
{
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -578,7 +578,7 @@ SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode)
{
int flags, status;
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -616,11 +616,11 @@ SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode)
int
SDL_GetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode *blendMode)
{
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
- if (!blendMode) {
+ if (blendMode == NULL) {
return 0;
}
@@ -651,7 +651,7 @@ SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect)
SDL_Rect full_rect;
/* Don't do anything if there's no surface to act on */
- if (!surface) {
+ if (surface == NULL) {
return SDL_FALSE;
}
@@ -662,7 +662,7 @@ SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect)
full_rect.h = surface->h;
/* Set the clipping rectangle */
- if (!rect) {
+ if (rect == NULL) {
surface->clip_rect = full_rect;
return SDL_TRUE;
}
@@ -699,7 +699,7 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
(src->format->palette &&
src->map->src_palette_version != src->format->palette->version)) {
if (SDL_MapSurface(src, dst) < 0) {
- return (-1);
+ return -1;
}
/* just here for debugging */
/* printf */
@@ -707,7 +707,7 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
/* src, dst->flags, src->map->info.flags, dst, dst->flags, */
/* dst->map->info.flags, src->map->blit); */
}
- return (src->map->blit(src, srcrect, dst, dstrect));
+ return src->map->blit(src, srcrect, dst, dstrect);
}
@@ -719,7 +719,7 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
int srcx, srcy, w, h;
/* Make sure the surfaces aren't locked */
- if (!src || !dst) {
+ if (src == NULL || dst == NULL) {
return SDL_InvalidParamError("SDL_UpperBlit(): src/dst");
}
if (src->locked || dst->locked) {
@@ -746,8 +746,9 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
srcx = 0;
}
maxw = src->w - srcx;
- if (maxw < w)
+ if (maxw < w) {
w = maxw;
+ }
srcy = srcrect->y;
h = srcrect->h;
@@ -757,8 +758,9 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
srcy = 0;
}
maxh = src->h - srcy;
- if (maxh < h)
+ if (maxh < h) {
h = maxh;
+ }
} else {
srcx = srcy = 0;
@@ -778,8 +780,9 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
srcx += dx;
}
dx = dstrect->x + w - clip->x - clip->w;
- if (dx > 0)
+ if (dx > 0) {
w -= dx;
+ }
dy = clip->y - dstrect->y;
if (dy > 0) {
@@ -788,8 +791,9 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
srcy += dy;
}
dy = dstrect->y + h - clip->y - clip->h;
- if (dy > 0)
+ if (dy > 0) {
h -= dy;
+ }
}
/* Switch back to a fast blit if we were previously stretching */
@@ -830,14 +834,14 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
int dst_w, dst_h;
/* Make sure the surfaces aren't locked */
- if (!src || !dst) {
+ if (src == NULL || dst == NULL) {
return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst");
}
if (src->locked || dst->locked) {
return SDL_SetError("Surfaces must not be locked during blit");
}
- if (NULL == srcrect) {
+ if (srcrect == NULL) {
src_w = src->w;
src_h = src->h;
} else {
@@ -845,7 +849,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
src_h = srcrect->h;
}
- if (NULL == dstrect) {
+ if (dstrect == NULL) {
dst_w = dst->w;
dst_h = dst->h;
} else {
@@ -861,7 +865,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
scaling_w = (double)dst_w / src_w;
scaling_h = (double)dst_h / src_h;
- if (NULL == dstrect) {
+ if (dstrect == NULL) {
dst_x0 = 0;
dst_y0 = 0;
dst_x1 = dst_w;
@@ -873,7 +877,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
dst_y1 = dst_y0 + dst_h;
}
- if (NULL == srcrect) {
+ if (srcrect == NULL) {
src_x0 = 0;
src_y0 = 0;
src_x1 = src_w;
@@ -1012,9 +1016,9 @@ SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
if ( !(src->map->info.flags & complex_copy_flags) &&
src->format->format == dst->format->format &&
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
- return SDL_SoftStretch( src, srcrect, dst, dstrect );
+ return SDL_SoftStretch(src, srcrect, dst, dstrect);
} else {
- return SDL_LowerBlit( src, srcrect, dst, dstrect );
+ return SDL_LowerBlit(src, srcrect, dst, dstrect);
}
} else {
if ( !(src->map->info.flags & complex_copy_flags) &&
@@ -1118,7 +1122,7 @@ SDL_LockSurface(SDL_Surface * surface)
++surface->locked;
/* Ready to go.. */
- return (0);
+ return 0;
}
/*
@@ -1168,11 +1172,11 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
Uint8 *palette_saved_alpha = NULL;
int palette_saved_alpha_ncolors = 0;
- if (!surface) {
+ if (surface == NULL) {
SDL_InvalidParamError("surface");
return NULL;
}
- if (!format) {
+ if (format == NULL) {
SDL_InvalidParamError("format");
return NULL;
}
@@ -1181,14 +1185,13 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
if (format->palette != NULL) {
int i;
for (i = 0; i < format->palette->ncolors; ++i) {
- if ((format->palette->colors[i].r != 0xFF) ||
- (format->palette->colors[i].g != 0xFF) ||
- (format->palette->colors[i].b != 0xFF))
+ if ((format->palette->colors[i].r != 0xFF) || (format->palette->colors[i].g != 0xFF) || (format->palette->colors[i].b != 0xFF)) {
break;
+ }
}
if (i == format->palette->ncolors) {
SDL_SetError("Empty destination palette");
- return (NULL);
+ return NULL;
}
}
@@ -1198,7 +1201,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
format->Gmask, format->Bmask,
format->Amask);
if (convert == NULL) {
- return (NULL);
+ return NULL;
}
/* Copy the palette if any */
@@ -1384,7 +1387,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
}
/* We're ready to go! */
- return (convert);
+ return convert;
}
SDL_Surface *
@@ -1455,13 +1458,13 @@ int SDL_ConvertPixels(int width, int height,
void *nonconst_src = (void *) src;
int ret;
- if (!src) {
+ if (src == NULL) {
return SDL_InvalidParamError("src");
}
if (!src_pitch) {
return SDL_InvalidParamError("src_pitch");
}
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("dst");
}
if (!dst_pitch) {
@@ -1537,13 +1540,13 @@ int SDL_PremultiplyAlpha(int width, int height,
Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA;
- if (!src) {
+ if (src == NULL) {
return SDL_InvalidParamError("src");
}
if (!src_pitch) {
return SDL_InvalidParamError("src_pitch");
}
- if (!dst) {
+ if (dst == NULL) {
return SDL_InvalidParamError("dst");
}
if (!dst_pitch) {
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 0804c9c..636cff9 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -225,7 +225,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo
SDL_WindowTextureData *data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
int i;
- if (!data) {
+ if (data == NULL) {
SDL_Renderer *renderer = NULL;
const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);
const SDL_bool specific_accelerated_renderer = (
@@ -244,7 +244,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo
break;
}
}
- if (!renderer || (SDL_GetRendererInfo(renderer, &info) == -1)) {
+ if (renderer == NULL || (SDL_GetRendererInfo(renderer, &info) == -1)) {
if (renderer) { SDL_DestroyRenderer(renderer); }
return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available");
}
@@ -263,7 +263,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo
}
}
}
- if (!renderer) {
+ if (renderer == NULL) {
return SDL_SetError("No hardware accelerated renderers available");
}
}
@@ -272,7 +272,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo
/* Create the data after we successfully create the renderer (bug #1116) */
data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
SDL_DestroyRenderer(renderer);
return SDL_OutOfMemory();
}
@@ -345,7 +345,7 @@ SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, const SDL_
void *src;
data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
- if (!data || !data->texture) {
+ if (data == NULL || !data->texture) {
return SDL_SetError("No window texture data");
}
@@ -373,7 +373,7 @@ SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window * window)
SDL_WindowTextureData *data;
data = SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, NULL);
- if (!data) {
+ if (data == NULL) {
return;
}
if (data->texture) {
@@ -475,7 +475,7 @@ SDL_VideoInit(const char *driver_name)
}
if (driver_name != NULL && *driver_name != 0) {
const char *driver_attempt = driver_name;
- while(driver_attempt != NULL && *driver_attempt != 0 && video == NULL) {
+ while (driver_attempt != NULL && *driver_attempt != 0 && video == NULL) {
const char* driver_attempt_end = SDL_strchr(driver_attempt, ',');
size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
: SDL_strlen(driver_attempt);
@@ -579,7 +579,7 @@ pre_driver_error:
const char *
SDL_GetCurrentVideoDriver()
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -663,7 +663,7 @@ SDL_DelVideoDisplay(int index)
int
SDL_GetNumVideoDisplays(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return 0;
}
@@ -714,7 +714,7 @@ SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
CHECK_DISPLAY_INDEX(displayIndex, -1);
- if (!rect) {
+ if (rect == NULL) {
return SDL_InvalidParamError("rect");
}
@@ -753,7 +753,7 @@ SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
CHECK_DISPLAY_INDEX(displayIndex, -1);
- if (!rect) {
+ if (rect == NULL) {
return SDL_InvalidParamError("rect");
}
@@ -824,7 +824,7 @@ SDL_AddDisplayMode(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
modes =
SDL_realloc(modes,
(display->max_display_modes + 32) * sizeof(*modes));
- if (!modes) {
+ if (modes == NULL) {
return SDL_FALSE;
}
display->display_modes = modes;
@@ -899,8 +899,7 @@ SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode)
display = &_this->displays[displayIndex];
if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
- return SDL_SetError("index must be in the range of 0 - %d",
- SDL_GetNumDisplayModesForDisplay(display) - 1);
+ return SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumDisplayModesForDisplay(display) - 1);
}
if (mode) {
*mode = display->display_modes[index];
@@ -946,7 +945,7 @@ SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
int i;
SDL_DisplayMode *current, *match;
- if (!mode || !closest) {
+ if (mode == NULL || closest == NULL) {
SDL_InvalidParamError("mode/closest");
return NULL;
}
@@ -983,7 +982,7 @@ SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
modes may still follow. */
continue;
}
- if (!match || current->w < match->w || current->h < match->h) {
+ if (match == NULL || current->w < match->w || current->h < match->h) {
match = current;
continue;
}
@@ -1087,8 +1086,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode *
/* Get a good video mode, the closest one possible */
if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
- return SDL_SetError("No video mode large enough for %dx%d",
- display_mode.w, display_mode.h);
+ return SDL_SetError("No video mode large enough for %dx%d", display_mode.w, display_mode.h);
}
} else {
display_mode = display->desktop_mode;
@@ -1294,7 +1292,7 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
CHECK_WINDOW_MAGIC(window, -1);
- if (!mode) {
+ if (mode == NULL) {
return SDL_InvalidParamError("mode");
}
@@ -1377,8 +1375,9 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
do nothing, or else we may trigger an ugly double-transition
*/
if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
- if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
+ if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
return 0;
+ }
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
@@ -1597,9 +1596,8 @@ SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
static int
SDL_ContextNotSupported(const char *name)
{
- return SDL_SetError("%s support is either not configured in SDL "
- "or not available in current SDL video driver "
- "(%s) or platform", name, _this->name);
+ return SDL_SetError("%s support is either not configured in SDL " "or not available in current SDL video driver " "(%s) or platform", name,
+ _this->name);
}
static int
@@ -1614,7 +1612,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
SDL_Window *window;
Uint32 type_flags, graphics_flags;
- if (!_this) {
+ if (_this == NULL) {
/* Initialize the video system if needed */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
return NULL;
@@ -1691,7 +1689,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
- if (!window) {
+ if (window == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1807,7 +1805,7 @@ SDL_CreateWindowFrom(const void *data)
SDL_Window *window;
Uint32 flags = SDL_WINDOW_FOREIGN;
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -1843,7 +1841,7 @@ SDL_CreateWindowFrom(const void *data)
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
- if (!window) {
+ if (window == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -2014,7 +2012,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
SDL_bool
SDL_HasWindows(void)
{
- return (_this && _this->windows != NULL);
+ return _this && _this->windows != NULL;
}
Uint32
@@ -2030,7 +2028,7 @@ SDL_GetWindowFromID(Uint32 id)
{
SDL_Window *window;
- if (!_this) {
+ if (_this == NULL) {
return NULL;
}
for (window = _this->windows; window; window = window->next) {
@@ -2079,7 +2077,7 @@ SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon)
{
CHECK_WINDOW_MAGIC(window,);
- if (!icon) {
+ if (icon == NULL) {
return;
}
@@ -2372,10 +2370,10 @@ SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom,
{
int dummy = 0;
- if (!top) { top = &dummy; }
- if (!left) { left = &dummy; }
- if (!right) { right = &dummy; }
- if (!bottom) { bottom = &dummy; }
+ if (top == NULL) { top = &dummy; }
+ if (left == NULL) { left = &dummy; }
+ if (right == NULL) { right = &dummy; }
+ if (bottom == NULL) { bottom = &dummy; }
/* Always initialize, so applications don't have to care */
*top = *left = *bottom = *right = 0;
@@ -3027,23 +3025,21 @@ SDL_SetWindowMouseGrab(SDL_Window * window, SDL_bool grabbed)
SDL_bool
SDL_GetWindowGrab(SDL_Window * window)
{
- return (SDL_GetWindowKeyboardGrab(window) || SDL_GetWindowMouseGrab(window));
+ return SDL_GetWindowKeyboardGrab(window) || SDL_GetWindowMouseGrab(window);
}
SDL_bool
SDL_GetWindowKeyboardGrab(SDL_Window * window)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
- return window == _this->grabbed_window &&
- ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0);
+ return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0);
}
SDL_bool
SDL_GetWindowMouseGrab(SDL_Window * window)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
- return window == _this->grabbed_window &&
- ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0);
+ return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0);
}
SDL_Window *
@@ -3221,7 +3217,7 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window)
/* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */
hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS);
- if (!hint || !*hint || SDL_strcasecmp(hint, "auto") == 0) {
+ if (hint == NULL || !*hint || SDL_strcasecmp(hint, "auto") == 0) {
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP ||
DisableDisplayModeSwitching(_this) == SDL_TRUE) {
return SDL_FALSE;
@@ -3253,7 +3249,7 @@ SDL_GetFocusWindow(void)
{
SDL_Window *window;
- if (!_this) {
+ if (_this == NULL) {
return NULL;
}
for (window = _this->windows; window; window = window->next) {
@@ -3350,7 +3346,7 @@ SDL_DestroyWindow(SDL_Window * window)
SDL_bool
SDL_IsScreenSaverEnabled()
{
- if (!_this) {
+ if (_this == NULL) {
return SDL_TRUE;
}
return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE;
@@ -3359,7 +3355,7 @@ SDL_IsScreenSaverEnabled()
void
SDL_EnableScreenSaver()
{
- if (!_this) {
+ if (_this == NULL) {
return;
}
if (!_this->suspend_screensaver) {
@@ -3374,7 +3370,7 @@ SDL_EnableScreenSaver()
void
SDL_DisableScreenSaver()
{
- if (!_this) {
+ if (_this == NULL) {
return;
}
if (_this->suspend_screensaver) {
@@ -3391,7 +3387,7 @@ SDL_VideoQuit(void)
{
int i;
- if (!_this) {
+ if (_this == NULL) {
return;
}
@@ -3436,7 +3432,7 @@ SDL_GL_LoadLibrary(const char *path)
{
int retval;
- if (!_this) {
+ if (_this == NULL) {
return SDL_UninitializedVideo();
}
if (_this->gl_config.driver_loaded) {
@@ -3457,7 +3453,7 @@ SDL_GL_LoadLibrary(const char *path)
_this->GL_UnloadLibrary(_this);
}
}
- return (retval);
+ return retval;
}
void *
@@ -3465,7 +3461,7 @@ SDL_GL_GetProcAddress(const char *proc)
{
void *func;
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -3485,7 +3481,7 @@ SDL_GL_GetProcAddress(const char *proc)
void
SDL_GL_UnloadLibrary(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return;
}
@@ -3503,7 +3499,7 @@ SDL_GL_UnloadLibrary(void)
static SDL_INLINE SDL_bool
isAtLeastGL3(const char *verstr)
{
- return (verstr && (SDL_atoi(verstr) >= 3));
+ return verstr && (SDL_atoi(verstr) >= 3);
}
#endif
@@ -3530,7 +3526,7 @@ SDL_GL_ExtensionSupported(const char *extension)
/* Lookup the available extensions */
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
- if (!glGetStringFunc) {
+ if (glGetStringFunc == NULL) {
return SDL_FALSE;
}
@@ -3542,7 +3538,7 @@ SDL_GL_ExtensionSupported(const char *extension)
glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
- if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
+ if ((glGetStringiFunc == NULL) || (glGetIntegervFunc == NULL)) {
return SDL_FALSE;
}
@@ -3563,7 +3559,7 @@ SDL_GL_ExtensionSupported(const char *extension)
/* Try the old way with glGetString(GL_EXTENSIONS) ... */
extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
- if (!extensions) {
+ if (extensions == NULL) {
return SDL_FALSE;
}
/*
@@ -3575,13 +3571,16 @@ SDL_GL_ExtensionSupported(const char *extension)
for (;;) {
where = SDL_strstr(start, extension);
- if (!where)
+ if (where == NULL) {
break;
+ }
terminator = where + SDL_strlen(extension);
- if (where == extensions || *(where - 1) == ' ')
- if (*terminator == ' ' || *terminator == '\0')
+ if (where == extensions || *(where - 1) == ' ') {
+ if (*terminator == ' ' || *terminator == '\0') {
return SDL_TRUE;
+ }
+ }
start = terminator;
}
@@ -3625,7 +3624,7 @@ SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor)
void
SDL_GL_ResetAttributes()
{
- if (!_this) {
+ if (_this == NULL) {
return;
}
@@ -3683,7 +3682,7 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
int retval;
- if (!_this) {
+ if (_this == NULL) {
return SDL_UninitializedVideo();
}
retval = 0;
@@ -3822,14 +3821,14 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
GLenum attachmentattrib = 0;
#endif
- if (!value) {
+ if (value == NULL) {
return SDL_InvalidParamError("value");
}
/* Clear value in any case */
*value = 0;
- if (!_this) {
+ if (_this == NULL) {
return SDL_UninitializedVideo();
}
@@ -3969,8 +3968,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
{
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
*value = 1;
- }
- else {
+ } else {
*value = 0;
}
return 0;
@@ -4006,7 +4004,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
#if SDL_VIDEO_OPENGL
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
- if (!glGetStringFunc) {
+ if (glGetStringFunc == NULL) {
return -1;
}
@@ -4044,7 +4042,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
}
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
- if (!glGetErrorFunc) {
+ if (glGetErrorFunc == NULL) {
return -1;
}
@@ -4093,7 +4091,7 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
{
int retval;
- if (!_this) {
+ if (_this == NULL) {
return SDL_UninitializedVideo();
}
@@ -4128,7 +4126,7 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
SDL_Window *
SDL_GL_GetCurrentWindow(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -4138,7 +4136,7 @@ SDL_GL_GetCurrentWindow(void)
SDL_GLContext
SDL_GL_GetCurrentContext(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -4159,7 +4157,7 @@ void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h)
int
SDL_GL_SetSwapInterval(int interval)
{
- if (!_this) {
+ if (_this == NULL) {
return SDL_UninitializedVideo();
} else if (SDL_GL_GetCurrentContext() == NULL) {
return SDL_SetError("No OpenGL context has been made current");
@@ -4173,7 +4171,7 @@ SDL_GL_SetSwapInterval(int interval)
int
SDL_GL_GetSwapInterval(void)
{
- if (!_this) {
+ if (_this == NULL) {
return 0;
} else if (SDL_GL_GetCurrentContext() == NULL) {
return 0;
@@ -4209,7 +4207,7 @@ SDL_GL_SwapWindow(SDL_Window * window)
void
SDL_GL_DeleteContext(SDL_GLContext context)
{
- if (!_this || !context) {
+ if (_this == NULL || !context) {
return;
}
@@ -4379,7 +4377,7 @@ SDL_IsTextInputShown(void)
SDL_bool
SDL_IsTextInputActive(void)
{
- return (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE);
+ return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE;
}
void
@@ -4498,7 +4496,7 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
SDL_Window *current_window;
SDL_MessageBoxData mbdata;
- if (!messageboxdata) {
+ if (messageboxdata == NULL) {
return SDL_InvalidParamError("messageboxdata");
} else if (messageboxdata->numbuttons < 0) {
return SDL_SetError("Invalid number of buttons");
@@ -4513,13 +4511,17 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
show_cursor_prev = SDL_ShowCursor(1);
SDL_ResetKeyboard();
- if (!buttonid) {
+ if (buttonid == NULL) {
buttonid = &dummybutton;
}
SDL_memcpy(&mbdata, messageboxdata, sizeof(*messageboxdata));
- if (!mbdata.title) mbdata.title = "";
- if (!mbdata.message) mbdata.message = "";
+ if (!mbdata.title) {
+ mbdata.title = "";
+ }
+ if (!mbdata.message) {
+ mbdata.message = "";
+ }
messageboxdata = &mbdata;
SDL_ClearError();
@@ -4633,8 +4635,12 @@ SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, S
/* Web browsers don't (currently) have an API for a custom message box
that can block, but for the most common case (SDL_ShowSimpleMessageBox),
we can use the standard Javascript alert() function. */
- if (!title) title = "";
- if (!message) message = "";
+ if (title == NULL) {
+ title = "";
+ }
+ if (message == NULL) {
+ message = "";
+ }
EM_ASM_({
alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1));
}, title, message);
@@ -4691,8 +4697,7 @@ SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
return 0.0f;
}
- return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
- SDL_sqrt((double)den2));
+ return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / SDL_sqrt((double)den2));
}
/*
@@ -4748,7 +4753,7 @@ void SDL_OnApplicationDidBecomeActive(void)
int SDL_Vulkan_LoadLibrary(const char *path)
{
int retval;
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return -1;
}
@@ -4771,7 +4776,7 @@ int SDL_Vulkan_LoadLibrary(const char *path)
void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return NULL;
}
@@ -4784,7 +4789,7 @@ void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
void SDL_Vulkan_UnloadLibrary(void)
{
- if (!_this) {
+ if (_this == NULL) {
SDL_UninitializedVideo();
return;
}
@@ -4803,14 +4808,13 @@ SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, c
if (window) {
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
- if (!(window->flags & SDL_WINDOW_VULKAN))
- {
+ if (!(window->flags & SDL_WINDOW_VULKAN)) {
SDL_SetError(NOT_A_VULKAN_WINDOW);
return SDL_FALSE;
}
}
- if (!count) {
+ if (count == NULL) {
SDL_InvalidParamError("count");
return SDL_FALSE;
}
@@ -4834,7 +4838,7 @@ SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
return SDL_FALSE;
}
- if (!surface) {
+ if (surface == NULL) {
SDL_InvalidParamError("surface");
return SDL_FALSE;
}
diff --git a/src/video/SDL_vulkan_utils.c b/src/video/SDL_vulkan_utils.c
index 33761a5..c7176e3 100644
--- a/src/video/SDL_vulkan_utils.c
+++ b/src/video/SDL_vulkan_utils.c
@@ -149,7 +149,7 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
retval = SDL_calloc(count, sizeof(VkExtensionProperties));
}
- if (!retval) {
+ if (retval == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -249,7 +249,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
}
physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount);
- if (!physicalDevices) {
+ if (physicalDevices == NULL) {
SDL_OutOfMemory();
goto error;
}
@@ -292,7 +292,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
}
displayProperties = SDL_malloc(sizeof(VkDisplayPropertiesKHR) * displayPropertiesCount);
- if (!displayProperties) {
+ if (displayProperties == NULL) {
SDL_OutOfMemory();
goto error;
}
@@ -314,15 +314,14 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
/* Get display mode properties for the chosen display */
result = vkGetDisplayModePropertiesKHR(physicalDevice, display, &displayModePropertiesCount, NULL);
- if (result != VK_SUCCESS || displayModePropertiesCount == 0)
- {
+ if (result != VK_SUCCESS || displayModePropertiesCount == 0) {
SDL_SetError("Error enumerating display modes");
goto error;
}
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display modes: %u", displayModePropertiesCount);
displayModeProperties = SDL_malloc(sizeof(VkDisplayModePropertiesKHR) * displayModePropertiesCount);
- if (!displayModeProperties) {
+ if (displayModeProperties == NULL) {
SDL_OutOfMemory();
goto error;
}
@@ -369,7 +368,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display planes: %u", displayPlanePropertiesCount);
displayPlaneProperties = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * displayPlanePropertiesCount);
- if (!displayPlaneProperties) {
+ if (displayPlaneProperties == NULL) {
SDL_OutOfMemory();
goto error;
}
@@ -400,7 +399,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of supported displays for plane %u: %u", i, planeSupportedDisplaysCount);
planeSupportedDisplays = SDL_malloc(sizeof(VkDisplayKHR) * planeSupportedDisplaysCount);
- if (!planeSupportedDisplays) {
+ if (planeSupportedDisplays == NULL) {
SDL_free(displayPlaneProperties);
SDL_OutOfMemory();
goto error;
@@ -414,8 +413,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
goto error;
}
- for (j = 0; j < planeSupportedDisplaysCount && planeSupportedDisplays[j] != display; ++j)
- {
+ for (j = 0; j < planeSupportedDisplaysCount && planeSupportedDisplays[j] != display; ++j) {
}
SDL_free(planeSupportedDisplays);
diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c
index 38cf9e7..be3ee0c 100644
--- a/src/video/SDL_yuv.c
+++ b/src/video/SDL_yuv.c
@@ -78,17 +78,12 @@ static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type)
static SDL_bool IsPlanar2x2Format(Uint32 format)
{
- return (format == SDL_PIXELFORMAT_YV12 ||
- format == SDL_PIXELFORMAT_IYUV ||
- format == SDL_PIXELFORMAT_NV12 ||
- format == SDL_PIXELFORMAT_NV21);
+ return format == SDL_PIXELFORMAT_YV12 || format == SDL_PIXELFORMAT_IYUV || format == SDL_PIXELFORMAT_NV12 || format == SDL_PIXELFORMAT_NV21;
}
static SDL_bool IsPacked4Format(Uint32 format)
{
- return (format == SDL_PIXELFORMAT_YUY2 ||
- format == SDL_PIXELFORMAT_UYVY ||
- format == SDL_PIXELFORMAT_YVYU);
+ return format == SDL_PIXELFORMAT_YUY2 || format == SDL_PIXELFORMAT_UYVY || format == SDL_PIXELFORMAT_YVYU;
}
static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch,
@@ -629,8 +624,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
next_row = (const Uint8*)src;
next_row += src_pitch;
- if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV)
- {
+ if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV) {
/* Write UV planes, not interleaved */
uv_skip = (uv_stride - (width + 1)/2);
for (j = 0; j < height_half; j++) {
@@ -663,9 +657,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
plane_u += uv_skip;
plane_v += uv_skip;
}
- }
- else if (dst_format == SDL_PIXELFORMAT_NV12)
- {
+ } else if (dst_format == SDL_PIXELFORMAT_NV12) {
uv_skip = (uv_stride - ((width + 1)/2)*2);
for (j = 0; j < height_half; j++) {
for (i = 0; i < width_half; i++) {
@@ -694,9 +686,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
*plane_interleaved_uv++ = MAKE_V(r, g, b);
}
}
- }
- else /* dst_format == SDL_PIXELFORMAT_NV21 */
- {
+ } else /* dst_format == SDL_PIXELFORMAT_NV21 */ {
uv_skip = (uv_stride - ((width + 1)/2)*2);
for (j = 0; j < height_half; j++) {
for (i = 0; i < width_half; i++) {
@@ -744,8 +734,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
plane_skip = (dst_pitch - row_size);
/* Write YUV plane, packed */
- if (dst_format == SDL_PIXELFORMAT_YUY2)
- {
+ if (dst_format == SDL_PIXELFORMAT_YUY2) {
for (j = 0; j < height; j++) {
for (i = 0; i < width_half; i++) {
READ_TWO_RGB_PIXELS;
@@ -766,9 +755,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
plane += plane_skip;
curr_row += src_pitch;
}
- }
- else if (dst_format == SDL_PIXELFORMAT_UYVY)
- {
+ } else if (dst_format == SDL_PIXELFORMAT_UYVY) {
for (j = 0; j < height; j++) {
for (i = 0; i < width_half; i++) {
READ_TWO_RGB_PIXELS;
@@ -789,9 +776,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
plane += plane_skip;
curr_row += src_pitch;
}
- }
- else if (dst_format == SDL_PIXELFORMAT_YVYU)
- {
+ } else if (dst_format == SDL_PIXELFORMAT_YVYU) {
for (j = 0; j < height; j++) {
for (i = 0; i < width_half; i++) {
READ_TWO_RGB_PIXELS;
@@ -962,7 +947,7 @@ SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_p
/* Allocate a temporary row for the swap */
tmp = (Uint8 *)SDL_malloc(UVwidth);
- if (!tmp) {
+ if (tmp == NULL) {
return SDL_OutOfMemory();
}
for (y = 0; y < UVheight; ++y) {
@@ -1023,7 +1008,7 @@ SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int
if (src == dst) {
/* Need to make a copy of the buffer so we don't clobber it while converting */
tmp = (Uint8 *)SDL_malloc(2*UVheight*srcUVPitch);
- if (!tmp) {
+ if (tmp == NULL) {
return SDL_OutOfMemory();
}
SDL_memcpy(tmp, src, 2*UVheight*srcUVPitch);
@@ -1097,7 +1082,7 @@ SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, in
if (src == dst) {
/* Need to make a copy of the buffer so we don't clobber it while converting */
tmp = (Uint8 *)SDL_malloc(UVheight*srcUVPitch);
- if (!tmp) {
+ if (tmp == NULL) {
return SDL_OutOfMemory();
}
SDL_memcpy(tmp, src, UVheight*srcUVPitch);
@@ -1269,7 +1254,8 @@ SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height,
default:
break;
}
- return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+ return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format),
+ SDL_GetPixelFormatName(dst_format));
}
#ifdef __SSE2__
@@ -1582,7 +1568,8 @@ SDL_ConvertPixels_Packed4_to_Packed4(int width, int height,
default:
break;
}
- return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+ return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format),
+ SDL_GetPixelFormatName(dst_format));
}
static int
@@ -1885,7 +1872,8 @@ SDL_ConvertPixels_YUV_to_YUV(int width, int height,
} else if (IsPacked4Format(src_format) && IsPlanar2x2Format(dst_format)) {
return SDL_ConvertPixels_Packed4_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
} else {
- return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+ return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format),
+ SDL_GetPixelFormatName(dst_format));
}
#else
return SDL_SetError("SDL not built with YUV support");
diff --git a/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c
index 3a05eb4..07f9672 100644
--- a/src/video/android/SDL_androidkeyboard.c
+++ b/src/video/android/SDL_androidkeyboard.c
@@ -369,7 +369,7 @@ Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
- if (!rect) {
+ if (rect == NULL) {
SDL_InvalidParamError("rect");
return;
}
diff --git a/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c
index 38953fa..139a734 100644
--- a/src/video/android/SDL_androidmouse.c
+++ b/src/video/android/SDL_androidmouse.c
@@ -92,7 +92,7 @@ Android_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
SDL_Surface *converted;
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
- if (!converted) {
+ if (converted == NULL) {
return NULL;
}
custom_cursor = Android_JNI_CreateCustomCursor(converted, hot_x, hot_y);
@@ -124,7 +124,7 @@ Android_FreeCursor(SDL_Cursor * cursor)
static SDL_Cursor *
Android_CreateEmptyCursor()
{
- if (!empty_cursor) {
+ if (empty_cursor == NULL) {
SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888);
if (empty_surface) {
SDL_memset(empty_surface->pixels, 0, empty_surface->h * empty_surface->pitch);
@@ -147,7 +147,7 @@ Android_DestroyEmptyCursor()
static int
Android_ShowCursor(SDL_Cursor *cursor)
{
- if (!cursor) {
+ if (cursor == NULL) {
cursor = Android_CreateEmptyCursor();
}
if (cursor) {
@@ -229,7 +229,7 @@ Android_OnMouse(SDL_Window *window, int state, int action, float x, float y, SDL
int changes;
Uint8 button;
- if (!window) {
+ if (window == NULL) {
return;
}
diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c
index 24d985b..02c5035 100644
--- a/src/video/android/SDL_androidtouch.c
+++ b/src/video/android/SDL_androidtouch.c
@@ -54,7 +54,7 @@ void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_fin
SDL_TouchID touchDeviceId = 0;
SDL_FingerID fingerId = 0;
- if (!window) {
+ if (window == NULL) {
return;
}
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index 3ed828f..62354fe 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -92,13 +92,13 @@ Android_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (!data) {
+ if (data == NULL) {
SDL_OutOfMemory();
SDL_free(device);
return NULL;
@@ -283,8 +283,7 @@ void Android_SendResize(SDL_Window *window)
which can happen after VideoInit().
*/
SDL_VideoDevice *device = SDL_GetVideoDevice();
- if (device && device->num_displays > 0)
- {
+ if (device && device->num_displays > 0) {
SDL_VideoDisplay *display = &device->displays[0];
display->desktop_mode.format = Android_ScreenFormat;
display->desktop_mode.w = Android_DeviceWidth;
diff --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c
index 058165f..09c44b1 100644
--- a/src/video/android/SDL_androidvulkan.c
+++ b/src/video/android/SDL_androidvulkan.c
@@ -42,51 +42,56 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasAndroidSurfaceExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan loader library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
+ }
+ if (path == NULL) {
path = "libvulkan.so";
+ }
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
- for(i = 0; i < extensionCount; i++)
+ }
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasAndroidSurfaceExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else if(!hasAndroidSurfaceExtension)
- {
+ } else if (!hasAndroidSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "extension");
goto fail;
@@ -101,8 +106,7 @@ fail:
void Android_Vulkan_UnloadLibrary(_THIS)
{
- if(_this->vulkan_config.loader_handle)
- {
+ if (_this->vulkan_config.loader_handle) {
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -116,8 +120,7 @@ SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
static const char *const extensionsForAndroid[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
};
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
@@ -141,14 +144,12 @@ SDL_bool Android_Vulkan_CreateSurface(_THIS,
VkAndroidSurfaceCreateInfoKHR createInfo;
VkResult result;
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
- if(!vkCreateAndroidSurfaceKHR)
- {
+ if (!vkCreateAndroidSurfaceKHR) {
SDL_SetError(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
@@ -160,8 +161,7 @@ SDL_bool Android_Vulkan_CreateSurface(_THIS,
createInfo.window = windowData->native_window;
result = vkCreateAndroidSurfaceKHR(instance, &createInfo,
NULL, surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateAndroidSurfaceKHR failed: %s",
SDL_Vulkan_GetResultString(result));
return SDL_FALSE;
diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c
index 21bedca..b94c38d 100644
--- a/src/video/android/SDL_androidwindow.c
+++ b/src/video/android/SDL_androidwindow.c
@@ -66,7 +66,7 @@ Android_CreateWindow(_THIS, SDL_Window * window)
SDL_SetKeyboardFocus(window);
data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
retval = SDL_OutOfMemory();
goto endfunction;
}
@@ -135,7 +135,7 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display
}
data = (SDL_WindowData *)window->driverdata;
- if (!data || !data->native_window) {
+ if (data == NULL || !data->native_window) {
if (data && !data->native_window) {
SDL_SetError("Missing native window");
}
diff --git a/src/video/dummy/SDL_nullframebuffer.c b/src/video/dummy/SDL_nullframebuffer.c
index dd7cbbd..16b5db8 100644
--- a/src/video/dummy/SDL_nullframebuffer.c
+++ b/src/video/dummy/SDL_nullframebuffer.c
@@ -40,7 +40,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format);
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -58,7 +58,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect
SDL_Surface *surface;
surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE);
- if (!surface) {
+ if (surface == NULL) {
return SDL_SetError("Couldn't find dummy surface for window");
}
diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c
index df6c769..e941735 100644
--- a/src/video/dummy/SDL_nullvideo.c
+++ b/src/video/dummy/SDL_nullvideo.c
@@ -93,14 +93,14 @@ DUMMY_CreateDevice(void)
SDL_VideoDevice *device;
if (!DUMMY_Available()) {
- return (0);
+ return 0;
}
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
device->is_dummy = SDL_TRUE;
diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index deb12b4..cba2ae5 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -773,8 +773,9 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo
SDL_FingerID id;
float x, y;
- if (!touchEvent->touches[i].isChanged)
+ if (!touchEvent->touches[i].isChanged) {
continue;
+ }
id = touchEvent->touches[i].identifier;
x = touchEvent->touches[i].targetX / client_w;
@@ -858,14 +859,11 @@ Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChang
SDL_WindowData *window_data = userData;
SDL_VideoDisplay *display;
- if(fullscreenChangeEvent->isFullscreen)
- {
+ if (fullscreenChangeEvent->isFullscreen) {
window_data->window->flags |= window_data->requested_fullscreen_mode;
window_data->requested_fullscreen_mode = 0;
- }
- else
- {
+ } else {
window_data->window->flags &= ~FULLSCREEN_MASK;
/* reset fullscreen window if the browser left fullscreen */
@@ -893,15 +891,13 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u
}
}
- if(!(window_data->window->flags & FULLSCREEN_MASK))
- {
+ if (!(window_data->window->flags & FULLSCREEN_MASK)) {
/* this will only work if the canvas size is set through css */
- if(window_data->window->flags & SDL_WINDOW_RESIZABLE)
- {
+ if (window_data->window->flags & SDL_WINDOW_RESIZABLE) {
double w = window_data->window->w;
double h = window_data->window->h;
- if(window_data->external_size) {
+ if (window_data->external_size) {
emscripten_get_element_css_size(window_data->canvas_id, &w, &h);
}
@@ -931,8 +927,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat
/*this is used during fullscreen changes*/
SDL_WindowData *window_data = userData;
- if(window_data->fullscreen_resize)
- {
+ if (window_data->fullscreen_resize) {
double css_w, css_h;
emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h);
SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, css_w, css_h);
@@ -987,7 +982,9 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data)
/* Keyboard events are awkward */
keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
- if (!keyElement) keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW;
+ if (keyElement == NULL) {
+ keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW;
+ }
emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey);
emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey);
@@ -1029,7 +1026,7 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL);
target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
- if (!target) {
+ if (target == NULL) {
target = EMSCRIPTEN_EVENT_TARGET_WINDOW;
}
diff --git a/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/video/emscripten/SDL_emscriptenframebuffer.c
index 03fea04..cb07a38 100644
--- a/src/video/emscripten/SDL_emscriptenframebuffer.c
+++ b/src/video/emscripten/SDL_emscriptenframebuffer.c
@@ -47,7 +47,7 @@ int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * form
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -65,7 +65,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
surface = data->surface;
- if (!surface) {
+ if (surface == NULL) {
return SDL_SetError("Couldn't find framebuffer surface for window");
}
diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c
index 38e394a..b172b99 100644
--- a/src/video/emscripten/SDL_emscriptenmouse.c
+++ b/src/video/emscripten/SDL_emscriptenmouse.c
@@ -40,7 +40,7 @@ Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom)
cursor = SDL_calloc(1, sizeof(SDL_Cursor));
if (cursor) {
curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
- if (!curdata) {
+ if (curdata == NULL) {
SDL_OutOfMemory();
SDL_free(cursor);
return NULL;
@@ -49,8 +49,7 @@ Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom)
curdata->system_cursor = cursor_str;
curdata->is_custom = is_custom;
cursor->driverdata = curdata;
- }
- else {
+ } else {
SDL_OutOfMemory();
}
@@ -72,7 +71,7 @@ Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0);
- if (!conv_surf) {
+ if (conv_surf == NULL) {
return NULL;
}
@@ -204,18 +203,17 @@ Emscripten_ShowCursor(SDL_Cursor* cursor)
{
Emscripten_CursorData *curdata;
if (SDL_GetMouseFocus() != NULL) {
- if(cursor && cursor->driverdata) {
+ if (cursor && cursor->driverdata) {
curdata = (Emscripten_CursorData *) cursor->driverdata;
- if(curdata->system_cursor) {
+ if (curdata->system_cursor) {
MAIN_THREAD_EM_ASM({
if (Module['canvas']) {
Module['canvas'].style['cursor'] = UTF8ToString($0);
}
}, curdata->system_cursor);
}
- }
- else {
+ } else {
MAIN_THREAD_EM_ASM(
if (Module['canvas']) {
Module['canvas'].style['cursor'] = 'none';
@@ -239,7 +237,7 @@ Emscripten_SetRelativeMouseMode(SDL_bool enabled)
SDL_WindowData *window_data;
/* TODO: pointer lock isn't actually enabled yet */
- if(enabled) {
+ if (enabled) {
window = SDL_GetMouseFocus();
if (window == NULL) {
return -1;
@@ -247,11 +245,11 @@ Emscripten_SetRelativeMouseMode(SDL_bool enabled)
window_data = (SDL_WindowData *) window->driverdata;
- if(emscripten_request_pointerlock(window_data->canvas_id, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
+ if (emscripten_request_pointerlock(window_data->canvas_id, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
return 0;
}
} else {
- if(emscripten_exit_pointerlock() >= EMSCRIPTEN_RESULT_SUCCESS) {
+ if (emscripten_exit_pointerlock() >= EMSCRIPTEN_RESULT_SUCCESS) {
return 0;
}
}
diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c
index 550031d..04c4fac 100644
--- a/src/video/emscripten/SDL_emscriptenvideo.c
+++ b/src/video/emscripten/SDL_emscriptenvideo.c
@@ -69,9 +69,9 @@ Emscripten_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
/* Firefox sends blur event which would otherwise prevent full screen
@@ -325,7 +325,7 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data;
- if(window->driverdata) {
+ if (window->driverdata) {
data = (SDL_WindowData *) window->driverdata;
Emscripten_UnregisterEventHandlers(data);
@@ -349,19 +349,19 @@ static void
Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
{
SDL_WindowData *data;
- if(window->driverdata) {
+ if (window->driverdata) {
data = (SDL_WindowData *) window->driverdata;
- if(fullscreen) {
+ if (fullscreen) {
EmscriptenFullscreenStrategy strategy;
SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
int res;
strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
- if(!is_desktop_fullscreen) {
+ if (!is_desktop_fullscreen) {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE;
- } else if(window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ } else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
} else {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
@@ -376,12 +376,11 @@ Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * di
data->fullscreen_resize = is_desktop_fullscreen;
res = emscripten_request_fullscreen_strategy(data->canvas_id, 1, &strategy);
- if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
+ if (res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
/* unset flags, fullscreen failed */
window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
}
- }
- else
+ } else
emscripten_exit_fullscreen();
}
}
diff --git a/src/video/haiku/SDL_bclipboard.cc b/src/video/haiku/SDL_bclipboard.cc
index 37cec38..c032869 100644
--- a/src/video/haiku/SDL_bclipboard.cc
+++ b/src/video/haiku/SDL_bclipboard.cc
@@ -37,12 +37,12 @@ extern "C" {
int HAIKU_SetClipboardText(_THIS, const char *text) {
BMessage *clip = NULL;
- if(be_clipboard->Lock()) {
+ if (be_clipboard->Lock()) {
be_clipboard->Clear();
- if((clip = be_clipboard->Data())) {
+ if ((clip = be_clipboard->Data())) {
/* Presumably the string of characters is ascii-format */
ssize_t asciiLength = 0;
- for(; text[asciiLength] != 0; ++asciiLength) {}
+ for (; text[asciiLength] != 0; ++asciiLength) {}
clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
be_clipboard->Commit();
}
@@ -56,8 +56,8 @@ char *HAIKU_GetClipboardText(_THIS) {
const char *text = NULL;
ssize_t length;
char *result;
- if(be_clipboard->Lock()) {
- if((clip = be_clipboard->Data())) {
+ if (be_clipboard->Lock()) {
+ if ((clip = be_clipboard->Data())) {
/* Presumably the string of characters is ascii-format */
clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
&length);
@@ -65,7 +65,7 @@ char *HAIKU_GetClipboardText(_THIS) {
be_clipboard->Unlock();
}
- if (!text) {
+ if (text == NULL) {
result = SDL_strdup("");
} else {
/* Copy the data and pass on to SDL */
diff --git a/src/video/haiku/SDL_bframebuffer.cc b/src/video/haiku/SDL_bframebuffer.cc
index f303177..361f620 100644
--- a/src/video/haiku/SDL_bframebuffer.cc
+++ b/src/video/haiku/SDL_bframebuffer.cc
@@ -36,11 +36,11 @@ extern "C" {
#endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
- return ((SDL_BWin*)(window->driverdata));
+ return (SDL_BWin *)(window->driverdata);
}
static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+ return (SDL_BApp *)be_app;
}
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
@@ -48,7 +48,7 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
void ** pixels, int *pitch) {
SDL_BWin *bwin = _ToBeWin(window);
BScreen bscreen;
- if(!bscreen.IsValid()) {
+ if (!bscreen.IsValid()) {
return -1;
}
@@ -65,14 +65,14 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
/* Create the new bitmap object */
BBitmap *bitmap = bwin->GetBitmap();
- if(bitmap) {
+ if (bitmap) {
delete bitmap;
}
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
false, /* Views not accepted */
true); /* Contiguous memory required */
- if(bitmap->InitCheck() != B_OK) {
+ if (bitmap->InitCheck() != B_OK) {
delete bitmap;
return SDL_SetError("Could not initialize back buffer!");
}
@@ -94,8 +94,9 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
const SDL_Rect * rects, int numrects) {
- if(!window)
+ if (window == NULL) {
return 0;
+ }
SDL_BWin *bwin = _ToBeWin(window);
diff --git a/src/video/haiku/SDL_bkeyboard.cc b/src/video/haiku/SDL_bkeyboard.cc
index a4aea4d..bdede08 100644
--- a/src/video/haiku/SDL_bkeyboard.cc
+++ b/src/video/haiku/SDL_bkeyboard.cc
@@ -42,11 +42,11 @@ static SDL_Scancode keymap[KEYMAP_SIZE];
static int8 keystate[KEYMAP_SIZE];
void HAIKU_InitOSKeymap(void) {
- for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
+ for ( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
keymap[i] = SDL_SCANCODE_UNKNOWN;
}
- for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
+ for ( uint i = 0; i < KEYMAP_SIZE; ++i ) {
keystate[i] = SDL_RELEASED;
}
@@ -160,7 +160,7 @@ void HAIKU_InitOSKeymap(void) {
}
SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
- if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
+ if (bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
return keymap[bkey];
} else {
return SDL_SCANCODE_UNKNOWN;
@@ -168,7 +168,7 @@ SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
}
int8 HAIKU_GetKeyState(int32 bkey) {
- if(bkey > 0 && bkey < KEYMAP_SIZE) {
+ if (bkey > 0 && bkey < KEYMAP_SIZE) {
return keystate[bkey];
} else {
return SDL_RELEASED;
@@ -176,7 +176,7 @@ int8 HAIKU_GetKeyState(int32 bkey) {
}
void HAIKU_SetKeyState(int32 bkey, int8 state) {
- if(bkey > 0 && bkey < KEYMAP_SIZE) {
+ if (bkey > 0 && bkey < KEYMAP_SIZE) {
keystate[bkey] = state;
}
}
diff --git a/src/video/haiku/SDL_bmessagebox.cc b/src/video/haiku/SDL_bmessagebox.cc
index d777ed8..7ff5acb 100644
--- a/src/video/haiku/SDL_bmessagebox.cc
+++ b/src/video/haiku/SDL_bmessagebox.cc
@@ -131,25 +131,20 @@ class HAIKU_SDL_MessageBox : public BAlert
void
ParseSdlMessageBoxData(const SDL_MessageBoxData *aMessageBoxData)
{
- if (aMessageBoxData == NULL)
- {
+ if (aMessageBoxData == NULL) {
SetTitle(HAIKU_SDL_DefTitle);
SetMessageText(HAIKU_SDL_DefMessage);
AddButton(HAIKU_SDL_DefButton);
return;
}
- if (aMessageBoxData->numbuttons <= 0)
- {
+ if (aMessageBoxData->numbuttons <= 0) {
AddButton(HAIKU_SDL_DefButton);
- }
- else
- {
+ } else {
AddSdlButtons(aMessageBoxData->buttons, aMessageBoxData->numbuttons);
}
- if (aMessageBoxData->colorScheme != NULL)
- {
+ if (aMessageBoxData->colorScheme != NULL) {
fCustomColorScheme = true;
ApplyAndParseColorScheme(aMessageBoxData->colorScheme);
}
@@ -179,11 +174,9 @@ class HAIKU_SDL_MessageBox : public BAlert
const SDL_MessageBoxColor *aTextColor,
const SDL_MessageBoxColor *aSelectedColor)
{
- if (fCustomColorScheme)
- {
+ if (fCustomColorScheme) {
int32 countButtons = CountButtons();
- for (int i = 0; i < countButtons; ++i)
- {
+ for (int i = 0; i < countButtons; ++i) {
ButtonAt(i)->SetViewColor(ConvertColorType(aBorderColor));
ButtonAt(i)->SetLowColor(ConvertColorType(aBackgroundColor));
@@ -218,15 +211,12 @@ class HAIKU_SDL_MessageBox : public BAlert
BString message = aMessage;
int32 length = message.CountChars();
- for (int i = 0, c = 0; i < length; ++i)
- {
+ for (int i = 0, c = 0; i < length; ++i) {
c++;
- if (*(message.CharAt(i)) == '\n')
- {
+ if (*(message.CharAt(i)) == '\n') {
c = 0;
}
- if (c > final)
- {
+ if (c > final) {
final = c;
}
}
@@ -238,20 +228,17 @@ class HAIKU_SDL_MessageBox : public BAlert
SetMessageText(const char *aMessage)
{
fThereIsLongLine = CheckLongLines(aMessage);
- if (fThereIsLongLine)
- {
+ if (fThereIsLongLine) {
fMessageBoxTextView->SetWordWrap(true);
}
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
- if (fCustomColorScheme)
- {
+ if (fCustomColorScheme) {
textColor = fTextColor;
}
/*
- if (fNoTitledWindow)
- {
+ if (fNoTitledWindow) {
fMessageBoxTextView->SetFontAndColor(be_bold_font);
fMessageBoxTextView->Insert(fTitle);
fMessageBoxTextView->Insert("\n\n");
@@ -269,16 +256,14 @@ class HAIKU_SDL_MessageBox : public BAlert
void
AddSdlButtons(const SDL_MessageBoxButtonData *aButtons, int aNumButtons)
{
- for (int i = 0; i < aNumButtons; ++i)
- {
+ for (int i = 0; i < aNumButtons; ++i) {
fButtons.push_back(&aButtons[i]);
}
std::sort(fButtons.begin(), fButtons.end(), &HAIKU_SDL_MessageBox::SortButtonsPredicate);
size_t countButtons = fButtons.size();
- for (size_t i = 0; i < countButtons; ++i)
- {
+ for (size_t i = 0; i < countButtons; ++i) {
switch (fButtons[i]->flags)
{
case SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT:
@@ -342,12 +327,9 @@ protected:
virtual void
FrameResized(float aNewWidth, float aNewHeight)
{
- if (fComputedMessageBoxWidth > aNewWidth)
- {
+ if (fComputedMessageBoxWidth > aNewWidth) {
ResizeTo(fComputedMessageBoxWidth, aNewHeight);
- }
- else
- {
+ } else {
BAlert::FrameResized(aNewWidth, aNewHeight);
}
}
@@ -375,38 +357,32 @@ HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
// "You need a valid BApplication object before interacting with the app_server."
// "2 BApplication objects were created. Only one is allowed."
BApplication *application = NULL;
- if (be_app == NULL)
- {
+ if (be_app == NULL) {
application = new(std::nothrow) BApplication(signature);
- if (application == NULL)
- {
+ if (application == NULL) {
return SDL_SetError("Cannot create the BApplication object. Lack of memory?");
}
}
HAIKU_SDL_MessageBox *SDL_MessageBox = new(std::nothrow) HAIKU_SDL_MessageBox(messageboxdata);
- if (SDL_MessageBox == NULL)
- {
+ if (SDL_MessageBox == NULL) {
return SDL_SetError("Cannot create the HAIKU_SDL_MessageBox (BAlert inheritor) object. Lack of memory?");
}
const int closeButton = SDL_MessageBox->GetCloseButtonId();
int pushedButton = SDL_MessageBox->Go();
// The close button is equivalent to pressing Escape.
- if (closeButton != G_CLOSE_BUTTON_ID && pushedButton == G_CLOSE_BUTTON_ID)
- {
+ if (closeButton != G_CLOSE_BUTTON_ID && pushedButton == G_CLOSE_BUTTON_ID) {
pushedButton = closeButton;
}
// It's deleted by itself after the "Go()" method was executed.
/*
- if (messageBox != NULL)
- {
+ if (messageBox != NULL) {
delete messageBox;
}
*/
- if (application != NULL)
- {
+ if (application != NULL) {
delete application;
}
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 5e51647..8fc6bfd 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -49,18 +49,18 @@ struct SDL_DisplayModeData {
#endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
- return ((SDL_BWin*)(window->driverdata));
+ return (SDL_BWin *)(window->driverdata);
}
static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+ return (SDL_BApp *)be_app;
}
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
#if WRAP_BMODE
- return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
+ return ((SDL_DisplayModeData *)mode->driverdata)->bmode;
#else
- return (display_mode*)(mode->driverdata);
+ return (display_mode *)(mode->driverdata);
#endif
}
@@ -80,24 +80,24 @@ void _SpoutModeData(display_mode *bmode) {
printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
printf("\th,v = (%i,%i)\n", bmode->h_display_start,
bmode->v_display_start);
- if(bmode->flags) {
+ if (bmode->flags) {
printf("\tFlags:\n");
- if(bmode->flags & B_SCROLL) {
+ if (bmode->flags & B_SCROLL) {
printf("\t\tB_SCROLL\n");
}
- if(bmode->flags & B_8_BIT_DAC) {
+ if (bmode->flags & B_8_BIT_DAC) {
printf("\t\tB_8_BIT_DAC\n");
}
- if(bmode->flags & B_HARDWARE_CURSOR) {
+ if (bmode->flags & B_HARDWARE_CURSOR) {
printf("\t\tB_HARDWARE_CURSOR\n");
}
- if(bmode->flags & B_PARALLEL_ACCESS) {
+ if (bmode->flags & B_PARALLEL_ACCESS) {
printf("\t\tB_PARALLEL_ACCESS\n");
}
- if(bmode->flags & B_DPMS) {
+ if (bmode->flags & B_DPMS) {
printf("\t\tB_DPMS\n");
}
- if(bmode->flags & B_IO_FB_NA) {
+ if (bmode->flags & B_IO_FB_NA) {
printf("\t\tB_IO_FB_NA\n");
}
}
@@ -109,21 +109,21 @@ void _SpoutModeData(display_mode *bmode) {
printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
bmode->timing.v_display, bmode->timing.v_sync_start,
bmode->timing.v_sync_end, bmode->timing.v_total);
- if(bmode->timing.flags) {
+ if (bmode->timing.flags) {
printf("\t\tFlags:\n");
- if(bmode->timing.flags & B_BLANK_PEDESTAL) {
+ if (bmode->timing.flags & B_BLANK_PEDESTAL) {
printf("\t\t\tB_BLANK_PEDESTAL\n");
}
- if(bmode->timing.flags & B_TIMING_INTERLACED) {
+ if (bmode->timing.flags & B_TIMING_INTERLACED) {
printf("\t\t\tB_TIMING_INTERLACED\n");
}
- if(bmode->timing.flags & B_POSITIVE_HSYNC) {
+ if (bmode->timing.flags & B_POSITIVE_HSYNC) {
printf("\t\t\tB_POSITIVE_HSYNC\n");
}
- if(bmode->timing.flags & B_POSITIVE_VSYNC) {
+ if (bmode->timing.flags & B_POSITIVE_VSYNC) {
printf("\t\t\tB_POSITIVE_VSYNC\n");
}
- if(bmode->timing.flags & B_SYNC_ON_GREEN) {
+ if (bmode->timing.flags & B_SYNC_ON_GREEN) {
printf("\t\t\tB_SYNC_ON_GREEN\n");
}
}
@@ -247,7 +247,7 @@ void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
bscreen.GetModeList(&bmodes, &count);
bscreen.GetMode(&this_bmode);
- for(i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i) {
// FIXME: Apparently there are errors with colorspace changes
if (bmodes[i].space == this_bmode.space) {
_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
@@ -258,10 +258,10 @@ void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
}
-int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
+int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) {
/* Get the current screen */
BScreen bscreen;
- if(!bscreen.IsValid()) {
+ if (!bscreen.IsValid()) {
printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
}
@@ -273,8 +273,8 @@ int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode
uint32 c = 0, i;
display_mode *bmode_list;
bscreen.GetModeList(&bmode_list, &c);
- for(i = 0; i < c; ++i) {
- if( bmode_list[i].space == bmode->space &&
+ for (i = 0; i < c; ++i) {
+ if ( bmode_list[i].space == bmode->space &&
bmode_list[i].virtual_width == bmode->virtual_width &&
bmode_list[i].virtual_height == bmode->virtual_height ) {
bmode = &bmode_list[i];
@@ -282,7 +282,7 @@ int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode
}
}
- if(bscreen.SetMode(bmode) != B_OK) {
+ if (bscreen.SetMode(bmode) != B_OK) {
return SDL_SetError("Bad video mode");
}
diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc
index 72bdb77..76751a6 100644
--- a/src/video/haiku/SDL_bopengl.cc
+++ b/src/video/haiku/SDL_bopengl.cc
@@ -36,11 +36,11 @@ extern "C" {
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
- return ((SDL_BWin*)(window->driverdata));
+ return (SDL_BWin *)(window->driverdata);
}
static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+ return (SDL_BApp *)be_app;
}
/* Passing a NULL path means load pointers from the application */
@@ -51,7 +51,7 @@ int HAIKU_GL_LoadLibrary(_THIS, const char *path)
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK) {
void *location = NULL;
- if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
+ if ( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
&location) == B_OK) {
_this->gl_config.dll_handle = (void *) (addr_t) info.id;
@@ -175,9 +175,9 @@ void HAIKU_GL_UnloadLibrary(_THIS) {
currently in use. */
void HAIKU_GL_RebootContexts(_THIS) {
SDL_Window *window = _this->windows;
- while(window) {
+ while (window) {
SDL_BWin *bwin = _ToBeWin(window);
- if(bwin->GetGLView()) {
+ if (bwin->GetGLView()) {
bwin->LockLooper();
bwin->RemoveGLView();
bwin->CreateGLView(bwin->GetGLType());
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index e409f3c..337175d 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -41,7 +41,7 @@ extern "C" {
#include "SDL_bevents.h"
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
- return ((SDL_BWin*)(window->driverdata));
+ return (SDL_BWin *)(window->driverdata);
}
/* FIXME: Undefined functions */
@@ -198,7 +198,7 @@ HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
SDL_Surface *converted;
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
- if (!converted) {
+ if (converted == NULL) {
return NULL;
}
@@ -220,8 +220,9 @@ static int HAIKU_ShowCursor(SDL_Cursor *cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
- if (!mouse)
+ if (mouse == NULL) {
return 0;
+ }
if (cursor) {
BCursor *hCursor = (BCursor*)cursor->driverdata;
@@ -239,7 +240,7 @@ static int
HAIKU_SetRelativeMouseMode(SDL_bool enabled)
{
SDL_Window *window = SDL_GetMouseFocus();
- if (!window) {
+ if (window == NULL) {
return 0;
}
@@ -259,8 +260,9 @@ HAIKU_SetRelativeMouseMode(SDL_bool enabled)
static void HAIKU_MouseInit(_THIS)
{
SDL_Mouse *mouse = SDL_GetMouse();
- if (!mouse)
+ if (mouse == NULL) {
return;
+ }
mouse->CreateCursor = HAIKU_CreateCursor;
mouse->CreateSystemCursor = HAIKU_CreateSystemCursor;
mouse->ShowCursor = HAIKU_ShowCursor;
@@ -292,7 +294,7 @@ int HAIKU_VideoInit(_THIS)
#endif
/* We're done! */
- return (0);
+ return 0;
}
void HAIKU_VideoQuit(_THIS)
@@ -309,7 +311,7 @@ int HAIKU_OpenURL(const char *url)
{
BUrl burl(url);
const status_t rc = burl.OpenWithPreferredApplication(false);
- return (rc == B_NO_ERROR) ? 0 : SDL_SetError("URL open failed (err=%d)", (int) rc);
+ return (rc == B_NO_ERROR) ? 0 : SDL_SetError("URL open failed (err=%d)", (int)rc);
}
#ifdef __cplusplus
diff --git a/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc
index 2462533..39da73a 100644
--- a/src/video/haiku/SDL_bwindow.cc
+++ b/src/video/haiku/SDL_bwindow.cc
@@ -34,11 +34,11 @@ extern "C" {
#endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
- return ((SDL_BWin*)(window->driverdata));
+ return (SDL_BWin *)(window->driverdata);
}
static SDL_INLINE SDL_BApp *_GetBeApp() {
- return ((SDL_BApp*)be_app);
+ return (SDL_BApp *)be_app;
}
static int _InitWindow(_THIS, SDL_Window *window) {
@@ -52,23 +52,24 @@ static int _InitWindow(_THIS, SDL_Window *window) {
window->y + window->h - 1
);
- if(window->flags & SDL_WINDOW_FULLSCREEN) {
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* TODO: Add support for this flag */
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
}
- if(window->flags & SDL_WINDOW_OPENGL) {
+ if (window->flags & SDL_WINDOW_OPENGL) {
/* TODO: Add support for this flag */
}
- if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
}
- if(window->flags & SDL_WINDOW_BORDERLESS) {
+ if (window->flags & SDL_WINDOW_BORDERLESS) {
look = B_NO_BORDER_WINDOW_LOOK;
}
SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags);
- if(bwin == NULL)
+ if (bwin == NULL) {
return -1;
+ }
window->driverdata = bwin;
int32 winID = _GetBeApp()->GetID(window);
@@ -90,8 +91,9 @@ int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
SDL_BWin *otherBWin = (SDL_BWin*)data;
- if(!otherBWin->LockLooper())
+ if (!otherBWin->LockLooper()) {
return -1;
+ }
/* Create the new window and initialize its members */
window->x = (int)otherBWin->Frame().left;
@@ -100,7 +102,7 @@ int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
window->h = (int)otherBWin->Frame().Height();
/* Set SDL flags */
- if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
+ if (!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
window->flags |= SDL_WINDOW_RESIZABLE;
}
@@ -205,7 +207,7 @@ int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
}
-void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window * window){
+void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window * window) {
BMessage msg(BWIN_MINIMUM_SIZE_WINDOW);
msg.AddInt32("window-w", window->w -1);
msg.AddInt32("window-h", window->h -1);
diff --git a/src/video/kmsdrm/SDL_kmsdrmdyn.c b/src/video/kmsdrm/SDL_kmsdrmdyn.c
index bf3ff2e..de8c2e4 100644
--- a/src/video/kmsdrm/SDL_kmsdrmdyn.c
+++ b/src/video/kmsdrm/SDL_kmsdrmdyn.c
@@ -58,8 +58,9 @@ KMSDRM_GetSym(const char *fnname, int *pHasModule)
for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) {
if (kmsdrmlibs[i].lib != NULL) {
fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname);
- if (fn != NULL)
+ if (fn != NULL) {
break;
+ }
}
}
@@ -70,8 +71,9 @@ KMSDRM_GetSym(const char *fnname, int *pHasModule)
SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname);
#endif
- if (fn == NULL)
- *pHasModule = 0; /* kill this module. */
+ if (fn == NULL) {
+ *pHasModule = 0; /* kill this module. */
+ }
return fn;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c
index 5722e04..08cf26c 100644
--- a/src/video/kmsdrm/SDL_kmsdrmmouse.c
+++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c
@@ -158,7 +158,7 @@ KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
int i;
int ret;
- if (!curdata || !dispdata->cursor_bo) {
+ if (curdata == NULL || !dispdata->cursor_bo) {
return SDL_SetError("Cursor or display not initialized properly.");
}
@@ -169,7 +169,7 @@ KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
ready_buffer = (uint8_t*)SDL_calloc(1, bufsize);
- if (!ready_buffer) {
+ if (ready_buffer == NULL) {
ret = SDL_OutOfMemory();
goto cleanup;
}
@@ -249,12 +249,12 @@ KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
ret = NULL;
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
- if (!cursor) {
+ if (cursor == NULL) {
SDL_OutOfMemory();
goto cleanup;
}
curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata));
- if (!curdata) {
+ if (curdata == NULL) {
SDL_OutOfMemory();
goto cleanup;
}
@@ -319,13 +319,13 @@ KMSDRM_ShowCursor(SDL_Cursor * cursor)
/* Get the mouse focused window, if any. */
mouse = SDL_GetMouse();
- if (!mouse) {
+ if (mouse == NULL) {
return SDL_SetError("No mouse.");
}
window = mouse->focus;
- if (!window || !cursor) {
+ if (window == NULL || cursor == NULL) {
/* If no window is focused by mouse or cursor is NULL,
since we have no window (no mouse->focus) and hence
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 253e34e..6657da4 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -136,7 +136,7 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
/* Get an actual usable fb for the next front buffer. */
fb_info = KMSDRM_FBFromBO(_this, windata->next_bo);
- if (!fb_info) {
+ if (fb_info == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
return 0;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 6c05bbd..db1b942 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -90,7 +90,7 @@ get_driindex(void)
SDL_strlcpy(device, kmsdrm_dri_path, sizeof(device));
folder = opendir(device);
- if (!folder) {
+ if (folder == NULL) {
SDL_SetError("Failed to open directory '%s'", device);
return -ENOENT;
}
@@ -128,7 +128,7 @@ get_driindex(void)
KMSDRM_drmModeGetConnector(
drm_fd, resources->connectors[i]);
- if (!conn) {
+ if (conn == NULL) {
continue;
}
@@ -245,13 +245,13 @@ KMSDRM_CreateDevice(void)
}
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
return NULL;
}
viddata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (!viddata) {
+ if (viddata == NULL) {
SDL_OutOfMemory();
goto cleanup;
}
@@ -310,8 +310,9 @@ KMSDRM_CreateDevice(void)
cleanup:
SDL_free(device);
- if (viddata)
+ if (viddata) {
SDL_free(viddata);
+ }
return NULL;
}
@@ -353,7 +354,7 @@ KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
when the backing buffer is destroyed */
fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo));
- if (!fb_info) {
+ if (fb_info == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -477,7 +478,7 @@ KMSDRM_WaitPageflip(_THIS, SDL_WindowData *windata) {
because it's ordered, while the list on the connector is mostly random.*/
static drmModeModeInfo*
KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay * display,
-uint32_t width, uint32_t height, uint32_t refresh_rate){
+uint32_t width, uint32_t height, uint32_t refresh_rate) {
SDL_DisplayData *dispdata = (SDL_DisplayData *) display->driverdata;
drmModeConnector *connector = dispdata->connector;
@@ -545,11 +546,13 @@ KMSDRM_CrtcGetPropId(uint32_t drm_fd,
drmModePropertyPtr drm_prop =
KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
- if (!drm_prop)
+ if (!drm_prop) {
continue;
+ }
- if (strcmp(drm_prop->name, name) == 0)
+ if (SDL_strcmp(drm_prop->name, name) == 0) {
prop_id = drm_prop->prop_id;
+ }
KMSDRM_drmModeFreeProperty(drm_prop);
}
@@ -564,8 +567,9 @@ static SDL_bool KMSDRM_VrrPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *vr
crtc_id,
DRM_MODE_OBJECT_CRTC);
- if (!drm_props)
+ if (!drm_props) {
return SDL_FALSE;
+ }
*vrr_prop_id = KMSDRM_CrtcGetPropId(drm_fd,
drm_props,
@@ -590,24 +594,27 @@ KMSDRM_ConnectorCheckVrrCapable(uint32_t drm_fd,
output_id,
DRM_MODE_OBJECT_CONNECTOR);
- if(!props)
+ if (!props) {
return SDL_FALSE;
+ }
for (i = 0; !found && i < props->count_props; ++i) {
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
- if (!drm_prop)
+ if (!drm_prop) {
continue;
+ }
- if (strcasecmp(drm_prop->name, name) == 0) {
+ if (SDL_strcasecmp(drm_prop->name, name) == 0) {
prop_value = props->prop_values[i];
found = SDL_TRUE;
}
KMSDRM_drmModeFreeProperty(drm_prop);
}
- if(found)
- return prop_value ? SDL_TRUE: SDL_FALSE;
+ if (found) {
+ return prop_value ? SDL_TRUE : SDL_FALSE;
+ }
return SDL_FALSE;
}
@@ -616,8 +623,9 @@ void
KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, SDL_bool enabled)
{
uint32_t vrr_prop_id;
- if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id))
+ if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id)) {
return;
+ }
KMSDRM_drmModeObjectSetProperty(drm_fd,
crtc_id,
@@ -634,22 +642,25 @@ KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id)
SDL_bool object_prop_value;
int i;
- if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id))
+ if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id)) {
return SDL_FALSE;
+ }
props = KMSDRM_drmModeObjectGetProperties(drm_fd,
crtc_id,
DRM_MODE_OBJECT_CRTC);
- if(!props)
+ if (!props) {
return SDL_FALSE;
+ }
for (i = 0; i < props->count_props; ++i) {
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
- if (!drm_prop)
+ if (!drm_prop) {
continue;
+ }
object_prop_id = drm_prop->prop_id;
object_prop_value = props->prop_values[i] ? SDL_TRUE : SDL_FALSE;
@@ -680,7 +691,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
/* Reserve memory for the new display's driverdata. */
dispdata = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
- if (!dispdata) {
+ if (dispdata == NULL) {
ret = SDL_OutOfMemory();
goto cleanup;
}
@@ -701,7 +712,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
for (i = 0; i < resources->count_encoders; i++) {
encoder = KMSDRM_drmModeGetEncoder(viddata->drm_fd, resources->encoders[i]);
- if (!encoder) {
+ if (encoder == NULL) {
continue;
}
@@ -713,13 +724,13 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
encoder = NULL;
}
- if (!encoder) {
+ if (encoder == NULL) {
/* No encoder was connected, find the first supported one */
for (i = 0; i < resources->count_encoders; i++) {
encoder = KMSDRM_drmModeGetEncoder(viddata->drm_fd,
resources->encoders[i]);
- if (!encoder) {
+ if (encoder == NULL) {
continue;
}
@@ -738,7 +749,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
}
}
- if (!encoder) {
+ if (encoder == NULL) {
ret = SDL_SetError("No connected encoder found for connector.");
goto cleanup;
}
@@ -748,7 +759,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
/* If no CRTC was connected to the encoder, find the first CRTC
that is supported by the encoder, and use that. */
- if (!crtc) {
+ if (crtc == NULL) {
for (i = 0; i < resources->count_crtcs; i++) {
if (encoder->possible_crtcs & (1 << i)) {
encoder->crtc_id = resources->crtcs[i];
@@ -758,7 +769,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
}
}
- if (!crtc) {
+ if (crtc == NULL) {
ret = SDL_SetError("No CRTC found for connector.");
goto cleanup;
}
@@ -830,7 +841,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
/* save previous vrr state */
dispdata->saved_vrr = KMSDRM_CrtcGetVrr(viddata->drm_fd, crtc->crtc_id);
/* try to enable vrr */
- if(KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id, "VRR_CAPABLE")) {
+ if (KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id, "VRR_CAPABLE")) {
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Enabling VRR");
KMSDRM_CrtcSetVrr(viddata->drm_fd, crtc->crtc_id, SDL_TRUE);
}
@@ -843,7 +854,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
There's no problem with it being still incomplete. */
modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
- if (!modedata) {
+ if (modedata == NULL) {
ret = SDL_OutOfMemory();
goto cleanup;
}
@@ -862,8 +873,9 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
SDL_AddVideoDisplay(&display, SDL_FALSE);
cleanup:
- if (encoder)
+ if (encoder) {
KMSDRM_drmModeFreeEncoder(encoder);
+ }
if (ret) {
/* Error (complete) cleanup */
if (dispdata) {
@@ -912,7 +924,7 @@ KMSDRM_InitDisplays (_THIS) {
/* Get all of the available connectors / devices / crtcs */
resources = KMSDRM_drmModeGetResources(viddata->drm_fd);
- if (!resources) {
+ if (resources == NULL) {
ret = SDL_SetError("drmModeGetResources(%d) failed", viddata->drm_fd);
goto cleanup;
}
@@ -923,7 +935,7 @@ KMSDRM_InitDisplays (_THIS) {
drmModeConnector *connector = KMSDRM_drmModeGetConnector(viddata->drm_fd,
resources->connectors[i]);
- if (!connector) {
+ if (connector == NULL) {
continue;
}
@@ -933,8 +945,7 @@ KMSDRM_InitDisplays (_THIS) {
so if it fails (no encoder for connector, no valid video mode for
connector etc...) we can keep looking for connected connectors. */
KMSDRM_AddDisplay(_this, connector, resources);
- }
- else {
+ } else {
/* If it's not, free it now. */
KMSDRM_drmModeFreeConnector(connector);
}
@@ -963,8 +974,9 @@ KMSDRM_InitDisplays (_THIS) {
viddata->drm_fd = -1;
cleanup:
- if (resources)
+ if (resources) {
KMSDRM_drmModeFreeResources(resources);
+ }
if (ret) {
if (viddata->drm_fd >= 0) {
close(viddata->drm_fd);
@@ -1056,7 +1068,7 @@ KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
&dispdata->original_mode);
}
- if(ret) {
+ if (ret) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not restore CRTC");
}
@@ -1310,7 +1322,7 @@ KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
return 0;
}
- if (!modedata) {
+ if (modedata == NULL) {
return SDL_SetError("Mode doesn't have an associated index");
}
@@ -1334,7 +1346,7 @@ KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
unsigned int i, j;
- if (!windata) {
+ if (windata == NULL) {
return;
}
@@ -1419,8 +1431,8 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
/* Allocate window internal data */
windata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
- if (!windata) {
- return(SDL_OutOfMemory());
+ if (windata == NULL) {
+ return SDL_OutOfMemory();
}
/* Setup driver data for this window */
@@ -1452,7 +1464,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
but only when we come here for the first time,
and only if it's not a VK window. */
if ((ret = KMSDRM_GBMInit(_this, dispdata))) {
- return (SDL_SetError("Can't init GBM on window creation."));
+ return SDL_SetError("Can't init GBM on window creation.");
}
}
@@ -1469,10 +1481,10 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
_this->gl_config.major_version = 2;
_this->gl_config.minor_version = 0;
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) {
- return (SDL_SetError("Can't load EGL/GL library on window creation."));
+ return SDL_SetError("Can't load EGL/GL library on window creation.");
}
}
-
+
_this->gl_config.driver_loaded = 1;
}
@@ -1502,7 +1514,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
/* Create the window surfaces with the size we have just chosen.
Needs the window diverdata in place. */
if ((ret = KMSDRM_CreateSurfaces(_this, window))) {
- return (SDL_SetError("Can't window GBM/EGL surfaces on window creation."));
+ return SDL_SetError("Can't window GBM/EGL surfaces on window creation.");
}
} /* NON-Vulkan block ends. */
@@ -1516,7 +1528,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
viddata->max_windows = new_max_windows;
if (!viddata->windows) {
- return (SDL_OutOfMemory());
+ return SDL_OutOfMemory();
}
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
index d404fd8..4c64c94 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
@@ -51,19 +51,23 @@ int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasDisplayExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
+ }
+ if (path == NULL) {
path = DEFAULT_VULKAN;
+ }
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
@@ -71,43 +75,44 @@ int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path)
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
+ }
- for(i = 0; i < extensionCount; i++)
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_DISPLAY_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_DISPLAY_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasDisplayExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else if(!hasDisplayExtension)
- {
+ } else if (!hasDisplayExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_DISPLAY_EXTENSION_NAME "extension");
goto fail;
@@ -123,8 +128,7 @@ fail:
void KMSDRM_Vulkan_UnloadLibrary(_THIS)
{
- if(_this->vulkan_config.loader_handle)
- {
+ if (_this->vulkan_config.loader_handle) {
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -148,8 +152,7 @@ SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
static const char *const extensionsForKMSDRM[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
};
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
@@ -257,8 +260,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
(PFN_vkCreateDisplayModeKHR)vkGetInstanceProcAddr(
instance, "vkCreateDisplayModeKHR");
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
goto clean;
}
@@ -272,8 +274,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
/* that the VK_KHR_Display extension is active on the instance. */
/* That's the central extension we need for x-less VK! */
/****************************************************************/
- if(!vkCreateDisplayPlaneSurfaceKHR)
- {
+ if (!vkCreateDisplayPlaneSurfaceKHR) {
SDL_SetError(VK_KHR_DISPLAY_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
goto clean;
@@ -443,9 +444,9 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
/* The plane must be bound to the chosen display, or not in use.
If none of these is true, iterate to another plane. */
- if (!((plane_props[i].currentDisplay == display) ||
- (plane_props[i].currentDisplay == VK_NULL_HANDLE)))
+ if (!((plane_props[i].currentDisplay == display) || (plane_props[i].currentDisplay == VK_NULL_HANDLE))) {
continue;
+ }
/* Iterate the list of displays supported by this plane
in order to find out if the chosen display is among them. */
@@ -500,8 +501,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
&display_plane_surface_create_info,
NULL,
surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateDisplayPlaneSurfaceKHR failed: %s",
SDL_Vulkan_GetResultString(result));
goto clean;
@@ -510,16 +510,21 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
ret = SDL_TRUE;
clean:
- if (physical_devices)
- SDL_free (physical_devices);
- if (display_props)
- SDL_free (display_props);
- if (device_props)
- SDL_free (device_props);
- if (plane_props)
- SDL_free (plane_props);
- if (mode_props)
- SDL_free (mode_props);
+ if (physical_devices) {
+ SDL_free(physical_devices);
+ }
+ if (display_props) {
+ SDL_free(display_props);
+ }
+ if (device_props) {
+ SDL_free(device_props);
+ }
+ if (plane_props) {
+ SDL_free(plane_props);
+ }
+ if (mode_props) {
+ SDL_free(mode_props);
+ }
return ret;
}
diff --git a/src/video/n3ds/SDL_n3dsframebuffer.c b/src/video/n3ds/SDL_n3dsframebuffer.c
index ba4ec51..1de24d0 100644
--- a/src/video/n3ds/SDL_n3dsframebuffer.c
+++ b/src/video/n3ds/SDL_n3dsframebuffer.c
@@ -48,7 +48,7 @@ SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void
FreePreviousWindowFramebuffer(window);
framebuffer = CreateNewWindowFramebuffer(window);
- if (!framebuffer) {
+ if (framebuffer == NULL) {
return SDL_OutOfMemory();
}
@@ -86,7 +86,7 @@ SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rect
u32 bufsize;
surface = (SDL_Surface *) SDL_GetWindowData(window, N3DS_SURFACE);
- if (!surface) {
+ if (surface == NULL) {
return SDL_SetError("%s: Unable to get the window surface.", __func__);
}
@@ -94,8 +94,8 @@ SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rect
framebuffer = (u32 *) gfxGetFramebuffer(drv_data->screen, GFX_LEFT, &width, &height);
bufsize = width * height * 4;
- CopyFramebuffertoN3DS(framebuffer, (Dimensions){ width, height },
- surface->pixels, (Dimensions){ surface->w, surface->h });
+ CopyFramebuffertoN3DS(framebuffer, (Dimensions) { width, height },
+ surface->pixels, (Dimensions) { surface->w, surface->h });
FlushN3DSBuffer(framebuffer, bufsize, drv_data->screen);
return 0;
diff --git a/src/video/n3ds/SDL_n3dsvideo.c b/src/video/n3ds/SDL_n3dsvideo.c
index d4a46ad..490e411 100644
--- a/src/video/n3ds/SDL_n3dsvideo.c
+++ b/src/video/n3ds/SDL_n3dsvideo.c
@@ -59,9 +59,9 @@ static SDL_VideoDevice *
N3DS_CreateDevice(void)
{
SDL_VideoDevice *device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
device->VideoInit = N3DS_VideoInit;
diff --git a/src/video/ngage/SDL_ngageevents.cpp b/src/video/ngage/SDL_ngageevents.cpp
index a136333..71d9975 100644
--- a/src/video/ngage/SDL_ngageevents.cpp
+++ b/src/video/ngage/SDL_ngageevents.cpp
@@ -47,8 +47,7 @@ NGAGE_PumpEvents(_THIS)
{
SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata;
- while (phdata->NGAGE_WsEventStatus != KRequestPending)
- {
+ while (phdata->NGAGE_WsEventStatus != KRequestPending) {
phdata->NGAGE_WsSession.GetEvent(phdata->NGAGE_WsEvent);
HandleWsEvent(_this, phdata->NGAGE_WsEvent);
diff --git a/src/video/ngage/SDL_ngageframebuffer.cpp b/src/video/ngage/SDL_ngageframebuffer.cpp
index 98ff9ff..f8cea52 100644
--- a/src/video/ngage/SDL_ngageframebuffer.cpp
+++ b/src/video/ngage/SDL_ngageframebuffer.cpp
@@ -57,7 +57,7 @@ int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format);
- if (! surface) {
+ if (surface == NULL) {
return -1;
}
@@ -98,21 +98,16 @@ int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma
*
* In 12 bpp machines the table has 16 entries.
*/
- if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 8)
- {
+ if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 8) {
phdata->NGAGE_FrameBuffer += 512;
- }
- else
- {
+ } else {
phdata->NGAGE_FrameBuffer += 32;
}
#if 0
- if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 12)
- {
+ if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 12) {
phdata->NGAGE_FrameBuffer += 16 * 2;
}
- if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 16)
- {
+ if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 16) {
phdata->NGAGE_FrameBuffer += 16 * 2;
}
#endif
@@ -154,14 +149,12 @@ int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect
SDL_Surface *surface;
surface = (SDL_Surface *) SDL_GetWindowData(window, NGAGE_SURFACE);
- if (! surface)
- {
+ if (surface == NULL) {
return SDL_SetError("Couldn't find ngage surface for window");
}
/* Send the data to the display */
- if (SDL_getenv("SDL_VIDEO_NGAGE_SAVE_FRAMES"))
- {
+ if (SDL_getenv("SDL_VIDEO_NGAGE_SAVE_FRAMES")) {
char file[128];
SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
(int)SDL_GetWindowID(window), ++frame_number);
@@ -231,8 +224,7 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
/* Render the rectangles in the list */
- for (i = 0; i < numrects; ++i)
- {
+ for (i = 0; i < numrects; ++i) {
const SDL_Rect& currentRect = rects[i];
SDL_Rect rect2;
rect2.x = currentRect.x;
@@ -240,8 +232,7 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
rect2.w = currentRect.w;
rect2.h = currentRect.h;
- if (rect2.w <= 0 || rect2.h <= 0) /* Sanity check */
- {
+ if (rect2.w <= 0 || rect2.h <= 0) /* Sanity check */ {
continue;
}
@@ -250,8 +241,7 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
/* Check rects validity, i.e. upper and lower bounds */
TInt maxX = Min(screenW - 1, rect2.x + rect2.w - 1);
TInt maxY = Min(screenH - 1, rect2.y + rect2.h - 1);
- if (maxX < 0 || maxY < 0) /* sanity check */
- {
+ if (maxX < 0 || maxY < 0) /* sanity check */ {
continue;
}
/* Clip from bottom */
@@ -274,22 +264,19 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
TUint16* bitmapLine = (TUint16*)screen->pixels + sourceStartOffset;
TUint16* screenMemory = screenBuffer + targetStartOffset;
- if (skipValue == 1)
- {
- for(TInt y = 0 ; y < sourceRectHeight ; y++)
+ if (skipValue == 1) {
+ for (TInt y = 0 ; y < sourceRectHeight ; y++)
{
Mem::Copy(screenMemory, bitmapLine, sourceRectWidthInBytes);
bitmapLine += sourceScanlineLength;
screenMemory += targetScanlineLength;
}
- }
- else
- {
- for(TInt y = 0 ; y < sourceRectHeight ; y++)
+ } else {
+ for (TInt y = 0 ; y < sourceRectHeight ; y++)
{
TUint16* bitmapPos = bitmapLine; /* 2 bytes per pixel */
TUint16* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */
- for(TInt x = 0 ; x < sourceRectWidth ; x++)
+ for (TInt x = 0 ; x < sourceRectWidth ; x++)
{
__ASSERT_DEBUG(screenMemory < (screenBuffer + phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight), User::Panic(_L("SDL"), KErrCorrupt));
__ASSERT_DEBUG(screenMemory >= screenBuffer, User::Panic(_L("SDL"), KErrCorrupt));
@@ -308,17 +295,16 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
// 256 color paletted mode: 8 bpp --> 12 bpp
default:
{
- if(phdata->NGAGE_BytesPerPixel <= 2)
- {
+ if (phdata->NGAGE_BytesPerPixel <= 2) {
TUint8* bitmapLine = (TUint8*)screen->pixels + sourceStartOffset;
TUint16* screenMemory = screenBuffer + targetStartOffset;
- for(TInt y = 0 ; y < sourceRectHeight ; y++)
+ for (TInt y = 0 ; y < sourceRectHeight ; y++)
{
TUint8* bitmapPos = bitmapLine; /* 1 byte per pixel */
TUint16* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */
/* Convert each pixel from 256 palette to 4k color values */
- for(TInt x = 0 ; x < sourceRectWidth ; x++)
+ for (TInt x = 0 ; x < sourceRectWidth ; x++)
{
__ASSERT_DEBUG(screenMemoryLinePos < (screenBuffer + (phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight)), User::Panic(_L("SDL"), KErrCorrupt));
__ASSERT_DEBUG(screenMemoryLinePos >= screenBuffer, User::Panic(_L("SDL"), KErrCorrupt));
@@ -329,17 +315,15 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer)
bitmapLine += sourceScanlineLength;
screenMemory += targetScanlineLength;
}
- }
- else
- {
+ } else {
TUint8* bitmapLine = (TUint8*)screen->pixels + sourceStartOffset;
TUint32* screenMemory = reinterpret_cast<TUint32*>(screenBuffer + targetStartOffset);
- for(TInt y = 0 ; y < sourceRectHeight ; y++)
+ for (TInt y = 0 ; y < sourceRectHeight ; y++)
{
TUint8* bitmapPos = bitmapLine; /* 1 byte per pixel */
TUint32* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */
/* Convert each pixel from 256 palette to 4k color values */
- for(TInt x = 0 ; x < sourceRectWidth ; x++)
+ for (TInt x = 0 ; x < sourceRectWidth ; x++)
{
__ASSERT_DEBUG(screenMemoryLinePos < (reinterpret_cast<TUint32*>(screenBuffer) + (phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight)), User::Panic(_L("SDL"), KErrCorrupt));
__ASSERT_DEBUG(screenMemoryLinePos >= reinterpret_cast<TUint32*>(screenBuffer), User::Panic(_L("SDL"), KErrCorrupt));
@@ -360,8 +344,7 @@ void DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
{
SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata;
- if (! phdata->NGAGE_IsWindowFocused)
- {
+ if (! phdata->NGAGE_IsWindowFocused) {
SDL_PauseAudio(1);
SDL_Delay(1000);
return;
@@ -372,18 +355,15 @@ void DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
TUint16* screenBuffer = (TUint16*)phdata->NGAGE_FrameBuffer;
#if 0
- if (phdata->NGAGE_ScreenOrientation == CFbsBitGc::EGraphicsOrientationRotated270)
- {
+ if (phdata->NGAGE_ScreenOrientation == CFbsBitGc::EGraphicsOrientationRotated270) {
// ...
- }
- else
+ } else
#endif
{
DirectDraw(_this, numrects, rects, screenBuffer);
}
- for (int i = 0; i < numrects; ++i)
- {
+ for (int i = 0; i < numrects; ++i) {
TInt aAx = rects[i].x;
TInt aAy = rects[i].y;
TInt aBx = rects[i].w;
diff --git a/src/video/ngage/SDL_ngagevideo.cpp b/src/video/ngage/SDL_ngagevideo.cpp
index d0ed05f..0f753da 100644
--- a/src/video/ngage/SDL_ngagevideo.cpp
+++ b/src/video/ngage/SDL_ngagevideo.cpp
@@ -59,29 +59,24 @@ NGAGE_DeleteDevice(SDL_VideoDevice * device)
{
SDL_VideoData *phdata = (SDL_VideoData*)device->driverdata;
- if (phdata)
- {
+ if (phdata) {
/* Free Epoc resources */
/* Disable events for me */
- if (phdata->NGAGE_WsEventStatus != KRequestPending)
- {
+ if (phdata->NGAGE_WsEventStatus != KRequestPending) {
phdata->NGAGE_WsSession.EventReadyCancel();
}
- if (phdata->NGAGE_RedrawEventStatus != KRequestPending)
- {
+ if (phdata->NGAGE_RedrawEventStatus != KRequestPending) {
phdata->NGAGE_WsSession.RedrawReadyCancel();
}
free(phdata->NGAGE_DrawDevice);
- if (phdata->NGAGE_WsWindow.WsHandle())
- {
+ if (phdata->NGAGE_WsWindow.WsHandle()) {
phdata->NGAGE_WsWindow.Close();
}
- if (phdata->NGAGE_WsWindowGroup.WsHandle())
- {
+ if (phdata->NGAGE_WsWindowGroup.WsHandle()) {
phdata->NGAGE_WsWindowGroup.Close();
}
@@ -91,8 +86,7 @@ NGAGE_DeleteDevice(SDL_VideoDevice * device)
delete phdata->NGAGE_WsScreen;
phdata->NGAGE_WsScreen = NULL;
- if (phdata->NGAGE_WsSession.WsHandle())
- {
+ if (phdata->NGAGE_WsSession.WsHandle()) {
phdata->NGAGE_WsSession.Close();
}
@@ -100,8 +94,7 @@ NGAGE_DeleteDevice(SDL_VideoDevice * device)
phdata = NULL;
}
- if (device)
- {
+ if (device) {
SDL_free(device);
device = NULL;
}
@@ -115,18 +108,17 @@ NGAGE_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
/* Initialize internal N-Gage specific data */
phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (! phdata)
- {
+ if (phdata == NULL) {
SDL_OutOfMemory();
SDL_free(device);
- return (0);
+ return 0;
}
/* General video */
diff --git a/src/video/ngage/SDL_ngagewindow.cpp b/src/video/ngage/SDL_ngagewindow.cpp
index 5b0682b..206e8b8 100644
--- a/src/video/ngage/SDL_ngagewindow.cpp
+++ b/src/video/ngage/SDL_ngagewindow.cpp
@@ -37,7 +37,7 @@ NGAGE_CreateWindow(_THIS, SDL_Window* window)
{
NGAGE_Window* ngage_window = (NGAGE_Window*)SDL_calloc(1, sizeof(NGAGE_Window));
- if (!ngage_window) {
+ if (ngage_window == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/video/offscreen/SDL_offscreenframebuffer.c b/src/video/offscreen/SDL_offscreenframebuffer.c
index 3760588..2e97e58 100644
--- a/src/video/offscreen/SDL_offscreenframebuffer.c
+++ b/src/video/offscreen/SDL_offscreenframebuffer.c
@@ -40,7 +40,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * f
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format);
- if (!surface) {
+ if (surface == NULL) {
return -1;
}
@@ -58,7 +58,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_
SDL_Surface *surface;
surface = (SDL_Surface *) SDL_GetWindowData(window, OFFSCREEN_SURFACE);
- if (!surface) {
+ if (surface == NULL) {
return SDL_SetError("Couldn't find offscreen surface for window");
}
diff --git a/src/video/offscreen/SDL_offscreenvideo.c b/src/video/offscreen/SDL_offscreenvideo.c
index 8e62e88..84439fb 100644
--- a/src/video/offscreen/SDL_offscreenvideo.c
+++ b/src/video/offscreen/SDL_offscreenvideo.c
@@ -60,9 +60,9 @@ OFFSCREEN_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
/* General video */
diff --git a/src/video/offscreen/SDL_offscreenwindow.c b/src/video/offscreen/SDL_offscreenwindow.c
index fd85f77..a6aa4d4 100644
--- a/src/video/offscreen/SDL_offscreenwindow.c
+++ b/src/video/offscreen/SDL_offscreenwindow.c
@@ -32,7 +32,7 @@ OFFSCREEN_CreateWindow(_THIS, SDL_Window* window)
{
OFFSCREEN_Window *offscreen_window = SDL_calloc(1, sizeof(OFFSCREEN_Window));
- if (!offscreen_window) {
+ if (offscreen_window == NULL) {
return SDL_OutOfMemory();
}
diff --git a/src/video/ps2/SDL_ps2video.c b/src/video/ps2/SDL_ps2video.c
index 9ada4ed..2cecf7f 100644
--- a/src/video/ps2/SDL_ps2video.c
+++ b/src/video/ps2/SDL_ps2video.c
@@ -108,9 +108,9 @@ static SDL_VideoDevice *PS2_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
/* Set the function pointers */
diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c
index dd2c67f..f5022f4 100644
--- a/src/video/psp/SDL_pspevents.c
+++ b/src/video/psp/SDL_pspevents.c
@@ -89,9 +89,9 @@ void PSP_PumpEvents(_THIS)
/* HPRM Keyboard */
changed = old_keys ^ keys;
old_keys = keys;
- if(changed) {
- for(i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
- if(changed & keymap_psp[i].id) {
+ if (changed) {
+ for (i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
+ if (changed & keymap_psp[i].id) {
SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap_psp[i].sym));
}
@@ -104,10 +104,10 @@ void PSP_PumpEvents(_THIS)
int i, length, count;
SIrKeybScanCodeData *scanData;
- if(pspIrKeybReadinput(buffer, &length) >= 0) {
- if((length % sizeof(SIrKeybScanCodeData)) == 0){
+ if (pspIrKeybReadinput(buffer, &length) >= 0) {
+ if ((length % sizeof(SIrKeybScanCodeData)) == 0) {
count = length / sizeof(SIrKeybScanCodeData);
- for( i=0; i < count; i++ ) {
+ for ( i=0; i < count; i++ ) {
unsigned char raw, pressed;
scanData=(SIrKeybScanCodeData*) buffer+i;
raw = scanData->raw;
@@ -133,8 +133,9 @@ void PSP_InitOSKeymap(_THIS)
{
#ifdef PSPIRKEYB
int i;
- for (i=0; i<SDL_TABLESIZE(keymap); ++i)
+ for (i = 0; i < SDL_TABLESIZE(keymap); ++i) {
keymap[i] = SDLK_UNKNOWN;
+ }
keymap[KEY_ESC] = SDLK_ESCAPE;
@@ -252,12 +253,12 @@ void PSP_EventInit(_THIS)
}
#endif
/* Start thread to read data */
- if((event_sem = SDL_CreateSemaphore(1)) == NULL) {
+ if ((event_sem = SDL_CreateSemaphore(1)) == NULL) {
SDL_SetError("Can't create input semaphore");
return;
}
running = 1;
- if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
+ if ((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
SDL_SetError("Can't create input thread");
return;
}
diff --git a/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c
index ca55ea2..abbae83 100644
--- a/src/video/psp/SDL_pspgl.c
+++ b/src/video/psp/SDL_pspgl.c
@@ -103,13 +103,11 @@ PSP_GL_CreateContext(_THIS, SDL_Window * window)
attribs[i++] = EGL_DEPTH_SIZE;
attribs[i++] = _this->gl_config.depth_size;
- if (_this->gl_config.alpha_size)
- {
+ if (_this->gl_config.alpha_size) {
attribs[i++] = EGL_ALPHA_SIZE;
attribs[i++] = _this->gl_config.alpha_size;
}
- if (_this->gl_config.stencil_size)
- {
+ if (_this->gl_config.stencil_size) {
attribs[i++] = EGL_STENCIL_SIZE;
attribs[i++] = _this->gl_config.stencil_size;
}
@@ -118,8 +116,7 @@ PSP_GL_CreateContext(_THIS, SDL_Window * window)
EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
- if (num_configs == 0)
- {
+ if (num_configs == 0) {
SDL_SetError("No valid EGL configs for requested mode");
return 0;
}
diff --git a/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c
index 4503f56..39a7db0 100644
--- a/src/video/raspberry/SDL_rpivideo.c
+++ b/src/video/raspberry/SDL_rpivideo.c
@@ -351,7 +351,7 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
- if(data) {
+ if (data) {
if (data->double_buffer) {
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
SDL_LockMutex(data->vsync_cond_mutex);
diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c
index fcca470..362a67c 100644
--- a/src/video/riscos/SDL_riscosevents.c
+++ b/src/video/riscos/SDL_riscosevents.c
@@ -148,8 +148,9 @@ RISCOS_InitEvents(_THIS)
_kernel_swi_regs regs;
int i, status;
- for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++)
+ for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
driverdata->key_pressed[i] = 255;
+ }
status = (_kernel_osbyte(202, 0, 255) & 0xFF);
SDL_ToggleModState(KMOD_NUM, (status & (1 << 2)) == 0);
diff --git a/src/video/riscos/SDL_riscosmessagebox.c b/src/video/riscos/SDL_riscosmessagebox.c
index 8144a9d..de465d5 100644
--- a/src/video/riscos/SDL_riscosmessagebox.c
+++ b/src/video/riscos/SDL_riscosmessagebox.c
@@ -41,10 +41,12 @@ RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
regs.r[0] = (unsigned int)&error;
regs.r[1] = (1 << 8) | (1 << 4);
- if (messageboxdata->flags == SDL_MESSAGEBOX_INFORMATION)
+ if (messageboxdata->flags == SDL_MESSAGEBOX_INFORMATION) {
regs.r[1] |= (1 << 9);
- else if (messageboxdata->flags == SDL_MESSAGEBOX_WARNING)
+ } else if (messageboxdata->flags == SDL_MESSAGEBOX_WARNING) {
regs.r[1] |= (2 << 9);
+ }
+
regs.r[2] = (unsigned int)messageboxdata->title;
regs.r[3] = 0;
regs.r[4] = 0;
@@ -52,8 +54,9 @@ RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
SDL_strlcpy(buttonstring, "" , 1024);
for (i = 0; i < messageboxdata->numbuttons; i++) {
SDL_strlcat(buttonstring, messageboxdata->buttons[i].text, 1024);
- if (i + 1 < messageboxdata->numbuttons)
+ if (i + 1 < messageboxdata->numbuttons) {
SDL_strlcat(buttonstring, ",", 1024);
+ }
}
regs.r[5] = (unsigned int)buttonstring;
diff --git a/src/video/riscos/SDL_riscosmodes.c b/src/video/riscos/SDL_riscosmodes.c
index 9500b22..383a4bd 100644
--- a/src/video/riscos/SDL_riscosmodes.c
+++ b/src/video/riscos/SDL_riscosmodes.c
@@ -88,7 +88,7 @@ static size_t
measure_mode_block(const int *block)
{
size_t blockSize = ((block[0] & 0xFF) == 3) ? 7 : 5;
- while(block[blockSize] != -1) {
+ while (block[blockSize] != -1) {
blockSize += 2;
}
blockSize++;
@@ -169,7 +169,7 @@ convert_mode_block(const int *block)
}
dst = SDL_malloc(40);
- if (!dst) {
+ if (dst == NULL) {
return NULL;
}
@@ -249,7 +249,7 @@ RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
}
block = SDL_malloc(-regs.r[7]);
- if (!block) {
+ if (block == NULL) {
SDL_OutOfMemory();
return;
}
@@ -268,8 +268,9 @@ RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
continue;
}
- if (mode.format == SDL_PIXELFORMAT_UNKNOWN)
+ if (mode.format == SDL_PIXELFORMAT_UNKNOWN) {
continue;
+ }
mode.driverdata = convert_mode_block(pos + 4);
if (!mode.driverdata) {
diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c
index 4763011..7ae30e4 100644
--- a/src/video/riscos/SDL_riscosvideo.c
+++ b/src/video/riscos/SDL_riscosvideo.c
@@ -58,9 +58,9 @@ RISCOS_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
/* Initialize internal data */
diff --git a/src/video/riscos/SDL_riscoswindow.c b/src/video/riscos/SDL_riscoswindow.c
index f47d33a..290c72f 100644
--- a/src/video/riscos/SDL_riscoswindow.c
+++ b/src/video/riscos/SDL_riscoswindow.c
@@ -37,7 +37,7 @@ RISCOS_CreateWindow(_THIS, SDL_Window * window)
SDL_WindowData *driverdata;
driverdata = (SDL_WindowData *) SDL_calloc(1, sizeof(*driverdata));
- if (!driverdata) {
+ if (driverdata == NULL) {
return SDL_OutOfMemory();
}
driverdata->window = window;
@@ -56,8 +56,9 @@ RISCOS_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *driverdata = (SDL_WindowData *) window->driverdata;
- if (!driverdata)
+ if (driverdata == NULL) {
return;
+ }
SDL_free(driverdata);
window->driverdata = NULL;
diff --git a/src/video/vita/SDL_vitaframebuffer.c b/src/video/vita/SDL_vitaframebuffer.c
index 1c55848..c14700f 100644
--- a/src/video/vita/SDL_vitaframebuffer.c
+++ b/src/video/vita/SDL_vitaframebuffer.c
@@ -43,11 +43,13 @@ void *vita_gpu_alloc(unsigned int type, unsigned int size, SceUID *uid)
*uid = sceKernelAllocMemBlock("gpu_mem", type, size, NULL);
- if (*uid < 0)
+ if (*uid < 0) {
return NULL;
+ }
- if (sceKernelGetMemBlockBase(*uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(*uid, &mem) < 0) {
return NULL;
+ }
return mem;
}
@@ -55,8 +57,9 @@ void *vita_gpu_alloc(unsigned int type, unsigned int size, SceUID *uid)
void vita_gpu_free(SceUID uid)
{
void *mem = NULL;
- if (sceKernelGetMemBlockBase(uid, &mem) < 0)
+ if (sceKernelGetMemBlockBase(uid, &mem) < 0) {
return;
+ }
sceKernelFreeMemBlock(uid);
}
@@ -101,7 +104,7 @@ void VITA_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
- if (!data) {
+ if (data == NULL) {
/* The window wasn't fully initialized */
return;
}
diff --git a/src/video/vita/SDL_vitagl_pvr.c b/src/video/vita/SDL_vitagl_pvr.c
index d51150c..11b4d5d 100644
--- a/src/video/vita/SDL_vitagl_pvr.c
+++ b/src/video/vita/SDL_vitagl_pvr.c
@@ -54,10 +54,8 @@ VITA_GL_LoadLibrary(_THIS, const char *path)
char* default_path = "app0:module";
char target_path[MAX_PATH];
- if (skip_init == NULL) // we don't care about actual value
- {
- if (override != NULL)
- {
+ if (skip_init == NULL) // we don't care about actual value {
+ if (override != NULL) {
default_path = override;
}
@@ -101,8 +99,7 @@ VITA_GL_CreateContext(_THIS, SDL_Window * window)
context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
- if (context != NULL)
- {
+ if (context != NULL) {
FB_WIDTH = window->w;
FB_HEIGHT = window->h;
set_getprocaddress((void *(*)(const char *))eglGetProcAddress);
diff --git a/src/video/vita/SDL_vitagles.c b/src/video/vita/SDL_vitagles.c
index 18ca7d5..f9b6fb6 100644
--- a/src/video/vita/SDL_vitagles.c
+++ b/src/video/vita/SDL_vitagles.c
@@ -138,8 +138,7 @@ VITA_GLES_CreateContext(_THIS, SDL_Window * window)
EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
- if (num_configs == 0)
- {
+ if (num_configs == 0) {
SDL_SetError("No valid EGL configs for requested mode");
return 0;
}
diff --git a/src/video/vita/SDL_vitagles_pvr.c b/src/video/vita/SDL_vitagles_pvr.c
index bb06d29..0f1d5f5 100644
--- a/src/video/vita/SDL_vitagles_pvr.c
+++ b/src/video/vita/SDL_vitagles_pvr.c
@@ -43,10 +43,8 @@ VITA_GLES_LoadLibrary(_THIS, const char *path)
char* default_path = "app0:module";
char target_path[MAX_PATH];
- if (skip_init == NULL) // we don't care about actual value
- {
- if (override != NULL)
- {
+ if (skip_init == NULL) // we don't care about actual value {
+ if (override != NULL) {
default_path = override;
}
diff --git a/src/video/vita/SDL_vitakeyboard.c b/src/video/vita/SDL_vitakeyboard.c
index 409d424..9e5a638 100644
--- a/src/video/vita/SDL_vitakeyboard.c
+++ b/src/video/vita/SDL_vitakeyboard.c
@@ -52,17 +52,16 @@ void
VITA_PollKeyboard(void)
{
// We skip polling keyboard if no window is created
- if (Vita_Window == NULL)
+ if (Vita_Window == NULL) {
return;
+ }
- if (keyboard_hid_handle > 0)
- {
+ if (keyboard_hid_handle > 0) {
int numReports = sceHidKeyboardRead(keyboard_hid_handle, (SceHidKeyboardReport**)&k_reports, SCE_HID_MAX_REPORT);
if (numReports < 0) {
keyboard_hid_handle = 0;
- }
- else if (numReports) {
+ } else if (numReports) {
// Numlock and Capslock state changes only on a SDL_PRESSED event
// The k_report only reports the state of the LED
if (k_reports[numReports - 1].modifiers[1] & 0x1) {
@@ -70,8 +69,7 @@ VITA_PollKeyboard(void)
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
locks |= 0x1;
}
- }
- else {
+ } else {
if (locks & 0x1) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
@@ -85,8 +83,7 @@ VITA_PollKeyboard(void)
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
locks |= 0x2;
}
- }
- else {
+ } else {
if (locks & 0x2) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
@@ -100,8 +97,7 @@ VITA_PollKeyboard(void)
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_SCROLLLOCK);
locks |= 0x4;
}
- }
- else {
+ } else {
if (locks & 0x4) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_SCROLLLOCK);
locks &= ~0x4;
@@ -114,64 +110,56 @@ VITA_PollKeyboard(void)
if (changed_modifiers & 0x01) {
if (prev_modifiers & 0x01) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LCTRL);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LCTRL);
}
}
if (changed_modifiers & 0x02) {
if (prev_modifiers & 0x02) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
}
}
if (changed_modifiers & 0x04) {
if (prev_modifiers & 0x04) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LALT);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LALT);
}
}
if (changed_modifiers & 0x08) {
if (prev_modifiers & 0x08) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LGUI);
}
}
if (changed_modifiers & 0x10) {
if (prev_modifiers & 0x10) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RCTRL);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RCTRL);
}
}
if (changed_modifiers & 0x20) {
if (prev_modifiers & 0x20) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RSHIFT);
}
}
if (changed_modifiers & 0x40) {
if (prev_modifiers & 0x40) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RALT);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RALT);
}
}
if (changed_modifiers & 0x80) {
if (prev_modifiers & 0x80) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RGUI);
- }
- else {
+ } else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RGUI);
}
}
diff --git a/src/video/vita/SDL_vitamessagebox.c b/src/video/vita/SDL_vitamessagebox.c
index 4921139..6fe7048 100644
--- a/src/video/vita/SDL_vitamessagebox.c
+++ b/src/video/vita/SDL_vitamessagebox.c
@@ -43,8 +43,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
SceCommonDialogErrorCode init_result;
SDL_bool setup_minimal_gxm = SDL_FALSE;
- if (messageboxdata->numbuttons > 3)
- {
+ if (messageboxdata->numbuttons > 3) {
return -1;
}
@@ -58,20 +57,15 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
msgParam.msg = (const SceChar8*)message;
SDL_zero(buttonParam);
- if (messageboxdata->numbuttons == 3)
- {
+ if (messageboxdata->numbuttons == 3) {
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS;
msgParam.buttonParam = &buttonParam;
buttonParam.msg1 = messageboxdata->buttons[0].text;
buttonParam.msg2 = messageboxdata->buttons[1].text;
buttonParam.msg3 = messageboxdata->buttons[2].text;
- }
- else if (messageboxdata->numbuttons == 2)
- {
+ } else if (messageboxdata->numbuttons == 2) {
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_YESNO;
- }
- else if (messageboxdata->numbuttons == 1)
- {
+ } else if (messageboxdata->numbuttons == 1) {
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_OK;
}
param.userMsgParam = &msgParam;
@@ -81,8 +75,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
init_result = sceMsgDialogInit(¶m);
// Setup display if it hasn't been initialized before
- if (init_result == SCE_COMMON_DIALOG_ERROR_GXM_IS_UNINITIALIZED)
- {
+ if (init_result == SCE_COMMON_DIALOG_ERROR_GXM_IS_UNINITIALIZED) {
gxm_minimal_init_for_common_dialog();
init_result = sceMsgDialogInit(¶m);
setup_minimal_gxm = SDL_TRUE;
@@ -90,50 +83,34 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
gxm_init_for_common_dialog();
- if (init_result >= 0)
- {
- while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING)
- {
+ if (init_result >= 0) {
+ while (sceMsgDialogGetStatus() == SCE_COMMON_DIALOG_STATUS_RUNNING) {
gxm_swap_for_common_dialog();
}
SDL_zero(dialog_result);
sceMsgDialogGetResult(&dialog_result);
- if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON1)
- {
+ if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON1) {
*buttonid = messageboxdata->buttons[0].buttonid;
- }
- else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON2)
- {
+ } else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON2) {
*buttonid = messageboxdata->buttons[1].buttonid;
- }
- else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON3)
- {
+ } else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON3) {
*buttonid = messageboxdata->buttons[2].buttonid;
- }
- else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_YES)
- {
+ } else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_YES) {
*buttonid = messageboxdata->buttons[0].buttonid;
- }
- else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_NO)
- {
+ } else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_NO) {
*buttonid = messageboxdata->buttons[1].buttonid;
- }
- else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK)
- {
+ } else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK) {
*buttonid = messageboxdata->buttons[0].buttonid;
}
sceMsgDialogTerm();
- }
- else
- {
+ } else {
return -1;
}
gxm_term_for_common_dialog();
- if (setup_minimal_gxm)
- {
+ if (setup_minimal_gxm) {
gxm_minimal_term_for_common_dialog();
}
diff --git a/src/video/vita/SDL_vitamouse.c b/src/video/vita/SDL_vitamouse.c
index 398a194..46d3471 100644
--- a/src/video/vita/SDL_vitamouse.c
+++ b/src/video/vita/SDL_vitamouse.c
@@ -47,16 +47,14 @@ void
VITA_PollMouse(void)
{
// We skip polling mouse if no window is created
- if (Vita_Window == NULL)
+ if (Vita_Window == NULL) {
return;
+ }
- if (mouse_hid_handle > 0)
- {
+ if (mouse_hid_handle > 0) {
int numReports = sceHidMouseRead(mouse_hid_handle, (SceHidMouseReport**)&m_reports, SCE_HID_MAX_REPORT);
- if (numReports > 0)
- {
- for (int i = 0; i <= numReports - 1; i++)
- {
+ if (numReports > 0) {
+ for (int i = 0; i <= numReports - 1; i++) {
Uint8 changed_buttons = m_reports[i].buttons ^ prev_buttons;
if (changed_buttons & 0x1) {
@@ -80,8 +78,7 @@ VITA_PollMouse(void)
prev_buttons = m_reports[i].buttons;
- if (m_reports[i].rel_x || m_reports[i].rel_y)
- {
+ if (m_reports[i].rel_x || m_reports[i].rel_y) {
SDL_SendMouseMotion(Vita_Window, 0, 1, m_reports[i].rel_x, m_reports[i].rel_y);
}
}
diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c
index 43a3ecb..e28dd3d 100644
--- a/src/video/vita/SDL_vitatouch.c
+++ b/src/video/vita/SDL_vitatouch.c
@@ -56,7 +56,7 @@ VITA_InitTouch(void)
sceTouchEnableTouchForce(SCE_TOUCH_PORT_FRONT);
sceTouchEnableTouchForce(SCE_TOUCH_PORT_BACK);
- for(int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+ for (int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
SceTouchPanelInfo panelinfo;
sceTouchGetPanelInfo(port, &panelinfo);
@@ -75,7 +75,7 @@ VITA_InitTouch(void)
}
void
-VITA_QuitTouch(void){
+VITA_QuitTouch(void) {
sceTouchDisableTouchForce(SCE_TOUCH_PORT_FRONT);
sceTouchDisableTouchForce(SCE_TOUCH_PORT_BACK);
}
@@ -87,20 +87,20 @@ VITA_PollTouch(void)
int port;
// We skip polling touch if no window is created
- if (Vita_Window == NULL)
+ if (Vita_Window == NULL) {
return;
+ }
SDL_memcpy(touch_old, touch, sizeof(touch_old));
- for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+ for (port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
/** Skip polling of Touch Device if environment variable is set **/
if (((port == 0) && disableFrontPoll) || ((port == 1) && disableBackPoll)) {
continue;
}
sceTouchPeek(port, &touch[port], 1);
if (touch[port].reportNum > 0) {
- for (int i = 0; i < touch[port].reportNum; i++)
- {
+ for (int i = 0; i < touch[port].reportNum; i++) {
// adjust coordinates and forces to return normalized values
// for the front, screen area is used as a reference (for direct touch)
// e.g. touch_x = 1.0 corresponds to screen_x = 960
@@ -122,7 +122,7 @@ VITA_PollTouch(void)
finger_id = (SDL_FingerID) touch[port].report[i].id;
// Skip if finger was already previously down
- if(!finger_down) {
+ if (!finger_down) {
// Send an initial touch
SDL_SendTouch((SDL_TouchID)port,
finger_id,
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index 33758d6..34b5c62 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -143,7 +143,7 @@ VITA_Create()
#if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR)
#if defined(SDL_VIDEO_VITA_PVR_OGL)
-if(SDL_getenv("VITA_PVR_OGL") != NULL) {
+if (SDL_getenv("VITA_PVR_OGL") != NULL) {
device->GL_LoadLibrary = VITA_GL_LoadLibrary;
device->GL_CreateContext = VITA_GL_CreateContext;
device->GL_GetProcAddress = VITA_GL_GetProcAddress;
@@ -273,8 +273,7 @@ VITA_CreateWindow(_THIS, SDL_Window * window)
window->driverdata = wdata;
// Vita can only have one window
- if (Vita_Window != NULL)
- {
+ if (Vita_Window != NULL) {
return SDL_SetError("Only one window supported");
}
@@ -298,7 +297,7 @@ VITA_CreateWindow(_THIS, SDL_Window * window)
win.windowSize = PSP2_WINDOW_960X544;
}
if ((window->flags & SDL_WINDOW_OPENGL) != 0) {
- if(SDL_getenv("VITA_PVR_OGL") != NULL) {
+ if (SDL_getenv("VITA_PVR_OGL") != NULL) {
/* Set version to 2.1 and PROFILE to ES */
temp_major = _this->gl_config.major_version;
temp_minor = _this->gl_config.minor_version;
@@ -312,7 +311,7 @@ VITA_CreateWindow(_THIS, SDL_Window * window)
if (wdata->egl_surface == EGL_NO_SURFACE) {
return SDL_SetError("Could not create GLES window surface");
}
- if(SDL_getenv("VITA_PVR_OGL") != NULL) {
+ if (SDL_getenv("VITA_PVR_OGL") != NULL) {
/* Revert */
_this->gl_config.major_version = temp_major;
_this->gl_config.minor_version = temp_minor;
@@ -427,10 +426,10 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst) {
for (i = 0; src[i]; i++) {
if ((src[i] & 0xFF80) == 0) {
*(dst++) = src[i] & 0xFF;
- } else if((src[i] & 0xF800) == 0) {
+ } else if ((src[i] & 0xF800) == 0) {
*(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0;
*(dst++) = (src[i] & 0x3F) | 0x80;
- } else if((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) {
+ } else if ((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) {
*(dst++) = (((src[i] + 64) >> 8) & 0x3) | 0xF0;
*(dst++) = (((src[i] >> 2) + 16) & 0x3F) | 0x80;
*(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i + 1] << 2) & 0xF);
@@ -461,13 +460,11 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e)
if (e->param.text.caretIndex == 0) {
SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_BACKSPACE);
sceImeSetText((SceWChar16 *)libime_initval, 4);
- }
- else {
+ } else {
scancode = SDL_GetScancodeFromKey(*(SceWChar16 *)&libime_out[1]);
if (scancode == SDL_SCANCODE_SPACE) {
SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_SPACE);
- }
- else {
+ } else {
utf16_to_utf8((SceWChar16 *)&libime_out[1], utf8_buffer);
SDL_SendKeyboardText((const char*)utf8_buffer);
}
@@ -577,7 +574,7 @@ SDL_bool VITA_IsScreenKeyboardShown(_THIS, SDL_Window *window)
return videodata->ime_active;
#else
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
- return (dialogStatus == SCE_COMMON_DIALOG_STATUS_RUNNING);
+ return dialogStatus == SCE_COMMON_DIALOG_STATUS_RUNNING;
#endif
}
@@ -614,8 +611,9 @@ void VITA_PumpEvents(_THIS)
SDL_SendKeyboardText((const char*)utf8_buffer);
// Send enter key only on enter
- if (result.button == SCE_IME_DIALOG_BUTTON_ENTER)
+ if (result.button == SCE_IME_DIALOG_BUTTON_ENTER) {
SDL_SendKeyboardKeyAutoRelease(SDL_SCANCODE_RETURN);
+ }
sceImeDialogTerm();
diff --git a/src/video/vivante/SDL_vivantevulkan.c b/src/video/vivante/SDL_vivantevulkan.c
index fe6a6b0..7935cd3 100644
--- a/src/video/vivante/SDL_vivantevulkan.c
+++ b/src/video/vivante/SDL_vivantevulkan.c
@@ -42,19 +42,19 @@ int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasDisplayExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan loader library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
- {
+ }
+ if (path == NULL) {
/* If no path set, try Vivante fb vulkan driver explicitly */
path = "libvulkan-fb.so";
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
/* If that couldn't be loaded, fall back to default name */
path = "libvulkan.so";
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
@@ -62,43 +62,45 @@ int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path)
} else {
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
}
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vivante: Loaded vulkan driver %s", path);
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
- for(i = 0; i < extensionCount; i++)
+ }
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_DISPLAY_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_DISPLAY_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasDisplayExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else if(!hasDisplayExtension)
- {
+ } else if (!hasDisplayExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_DISPLAY_EXTENSION_NAME "extension");
goto fail;
@@ -113,8 +115,7 @@ fail:
void VIVANTE_Vulkan_UnloadLibrary(_THIS)
{
- if(_this->vulkan_config.loader_handle)
- {
+ if (_this->vulkan_config.loader_handle) {
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -128,8 +129,7 @@ SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(_THIS,
static const char *const extensionsForVivante[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
};
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
@@ -143,8 +143,7 @@ SDL_bool VIVANTE_Vulkan_CreateSurface(_THIS,
VkInstance instance,
VkSurfaceKHR *surface)
{
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c
index 6c91e0b..68ea1cf 100644
--- a/src/video/wayland/SDL_waylanddyn.c
+++ b/src/video/wayland/SDL_waylanddyn.c
@@ -67,8 +67,9 @@ WAYLAND_GetSym(const char *fnname, int *pHasModule)
for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
if (waylandlibs[i].lib != NULL) {
fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
- if (fn != NULL)
+ if (fn != NULL) {
break;
+ }
}
}
@@ -79,8 +80,9 @@ WAYLAND_GetSym(const char *fnname, int *pHasModule)
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
#endif
- if (fn == NULL)
- *pHasModule = 0; /* kill this module. */
+ if (fn == NULL) {
+ *pHasModule = 0; /* kill this module. */
+ }
return fn;
}
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 5ccffd9..c5863d9 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -433,7 +433,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
struct SDL_WaylandInput *input = data;
SDL_WindowData *window;
- if (!surface) {
+ if (surface == NULL) {
/* enter event for a window we've just destroyed */
return;
}
@@ -472,7 +472,7 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
{
struct SDL_WaylandInput *input = data;
- if (!surface || !SDL_WAYLAND_own_surface(surface)) {
+ if (surface == NULL || !SDL_WAYLAND_own_surface(surface)) {
return;
}
@@ -737,7 +737,7 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
{
struct SDL_WaylandInput *input = data;
- if(wl_seat_get_version(input->seat) >= 5)
+ if (wl_seat_get_version(input->seat) >= 5)
pointer_handle_axis_common(input, AXIS_EVENT_CONTINUOUS, axis, value);
else
pointer_handle_axis_common_v1(input, time, axis, value);
@@ -964,7 +964,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
char *map_str;
const char *locale;
- if (!data) {
+ if (data == NULL) {
close(fd);
return;
}
@@ -1103,7 +1103,7 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
SDL_WindowData *window;
uint32_t *key;
- if (!surface) {
+ if (surface == NULL) {
/* enter event for a window we've just destroyed */
return;
}
@@ -1146,7 +1146,7 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
struct SDL_WaylandInput *input = data;
SDL_WindowData *window;
- if (!surface || !SDL_WAYLAND_own_surface(surface)) {
+ if (surface == NULL || !SDL_WAYLAND_own_surface(surface)) {
return;
}
@@ -1175,7 +1175,7 @@ keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint
const xkb_keysym_t *syms;
xkb_keysym_t sym;
- if (!window || window->keyboard_device != input || !input->xkb.state) {
+ if (window == NULL || window->keyboard_device != input || !input->xkb.state) {
return SDL_FALSE;
}
@@ -1290,7 +1290,7 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
}
/* If a key is repeating, update the text to apply the modifier. */
- if(keyboard_repeat_is_set(&input->keyboard_repeat)) {
+ if (keyboard_repeat_is_set(&input->keyboard_repeat)) {
char text[8];
const uint32_t key = keyboard_repeat_get_key(&input->keyboard_repeat);
@@ -1712,8 +1712,11 @@ static char* Wayland_URIToLocal(char* uri) {
char *file = NULL;
SDL_bool local;
- if (SDL_memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
- else if (SDL_strstr(uri,":/") != NULL) return file; /* wrong scheme */
+ if (SDL_memcmp(uri,"file:/",6) == 0) {
+ uri += 6; /* local file? */
+ } else if (SDL_strstr(uri, ":/") != NULL) {
+ return file; /* wrong scheme */
+ }
local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/');
@@ -2095,7 +2098,7 @@ tablet_tool_handle_proximity_in(void* data, struct zwp_tablet_tool_v2* tool, uin
struct SDL_WaylandTabletInput* input = data;
SDL_WindowData* window;
- if (!surface) {
+ if (surface == NULL) {
return;
}
@@ -2155,7 +2158,7 @@ tablet_tool_handle_down(void* data, struct zwp_tablet_tool_v2* tool, uint32_t se
struct SDL_WaylandTabletInput* input = data;
SDL_WindowData* window = input->tool_focus;
input->is_down = SDL_TRUE;
- if (!window) {
+ if (window == NULL) {
/* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd.
* that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still
* received. To prevent SIGSEGV this returns when this is the case.
@@ -2174,7 +2177,7 @@ tablet_tool_handle_up(void* data, struct zwp_tablet_tool_v2* tool)
input->is_down = SDL_FALSE;
- if (!window) {
+ if (window == NULL) {
/* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd.
* that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still
* received. To prevent SIGSEGV this returns when this is the case.
@@ -2376,7 +2379,7 @@ Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTable
{
struct SDL_WaylandTabletInput* tablet_input;
- if (!tablet_manager || !input || !input->seat) {
+ if (tablet_manager == NULL || input == NULL || !input->seat) {
return;
}
@@ -2416,8 +2419,9 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version)
struct SDL_WaylandInput *input;
input = SDL_calloc(1, sizeof *input);
- if (input == NULL)
+ if (input == NULL) {
return;
+ }
input->display = d;
input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(SDL_WL_SEAT_VERSION, version));
@@ -2450,8 +2454,9 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
{
struct SDL_WaylandInput *input = d->input;
- if (!input)
+ if (input == NULL) {
return;
+ }
if (input->data_device != NULL) {
Wayland_data_device_clear_selection(input->data_device);
@@ -2472,11 +2477,13 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
SDL_free(input->text_input);
}
- if (input->keyboard)
+ if (input->keyboard) {
wl_keyboard_destroy(input->keyboard);
+ }
- if (input->pointer)
+ if (input->pointer) {
wl_pointer_destroy(input->pointer);
+ }
if (input->touch) {
SDL_DelTouch(1);
@@ -2487,20 +2494,25 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
Wayland_input_destroy_tablet(input);
}
- if (input->seat)
+ if (input->seat) {
wl_seat_destroy(input->seat);
+ }
- if (input->xkb.compose_state)
+ if (input->xkb.compose_state) {
WAYLAND_xkb_compose_state_unref(input->xkb.compose_state);
+ }
- if (input->xkb.compose_table)
+ if (input->xkb.compose_table) {
WAYLAND_xkb_compose_table_unref(input->xkb.compose_table);
+ }
- if (input->xkb.state)
+ if (input->xkb.state) {
WAYLAND_xkb_state_unref(input->xkb.state);
+ }
- if (input->xkb.keymap)
+ if (input->xkb.keymap) {
WAYLAND_xkb_keymap_unref(input->xkb.keymap);
+ }
SDL_free(input);
d->input = NULL;
@@ -2516,8 +2528,9 @@ void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id)
void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d)
{
- if (d->relative_pointer_manager)
+ if (d->relative_pointer_manager) {
zwp_relative_pointer_manager_v1_destroy(d->relative_pointer_manager);
+ }
}
void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id)
@@ -2529,8 +2542,9 @@ void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id)
void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d)
{
- if (d->pointer_constraints)
+ if (d->pointer_constraints) {
zwp_pointer_constraints_v1_destroy(d->pointer_constraints);
+ }
}
static void
@@ -2595,8 +2609,9 @@ lock_pointer_to_window(SDL_Window *window,
SDL_VideoData *d = input->display;
struct zwp_locked_pointer_v1 *locked_pointer;
- if (w->locked_pointer)
+ if (w->locked_pointer) {
return;
+ }
locked_pointer =
zwp_pointer_constraints_v1_lock_pointer(d->pointer_constraints,
@@ -2627,20 +2642,24 @@ int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
SDL_Window *window;
struct zwp_relative_pointer_v1 *relative_pointer;
- if (!d->relative_pointer_manager)
+ if (!d->relative_pointer_manager) {
return -1;
+ }
- if (!d->pointer_constraints)
+ if (!d->pointer_constraints) {
return -1;
+ }
- if (!input->pointer)
+ if (!input->pointer) {
return -1;
+ }
/* If we have a pointer confine active, we must destroy it here because
* creating a locked pointer otherwise would be a protocol error.
*/
- for (window = vd->windows; window; window = window->next)
+ for (window = vd->windows; window; window = window->next) {
pointer_confine_destroy(window);
+ }
if (!input->relative_pointer) {
relative_pointer =
@@ -2653,8 +2672,9 @@ int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
input->relative_pointer = relative_pointer;
}
- for (window = vd->windows; window; window = window->next)
+ for (window = vd->windows; window; window = window->next) {
lock_pointer_to_window(window, input);
+ }
d->relative_mouse_mode = 1;
@@ -2670,8 +2690,9 @@ int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input)
for (window = vd->windows; window; window = window->next) {
w = window->driverdata;
- if (w->locked_pointer)
+ if (w->locked_pointer) {
zwp_locked_pointer_v1_destroy(w->locked_pointer);
+ }
w->locked_pointer = NULL;
}
@@ -2680,8 +2701,9 @@ int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input)
d->relative_mouse_mode = 0;
- for (window = vd->windows; window; window = window->next)
+ for (window = vd->windows; window; window = window->next) {
Wayland_input_confine_pointer(input, window);
+ }
return 0;
}
@@ -2710,11 +2732,13 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi
struct zwp_confined_pointer_v1 *confined_pointer;
struct wl_region *confine_rect;
- if (!d->pointer_constraints)
+ if (!d->pointer_constraints) {
return -1;
+ }
- if (!input->pointer)
+ if (!input->pointer) {
return -1;
+ }
/* A confine may already be active, in which case we should destroy it and
* create a new one.
@@ -2724,12 +2748,14 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi
/* We cannot create a confine if the pointer is already locked. Defer until
* the pointer is unlocked.
*/
- if (d->relative_mouse_mode)
+ if (d->relative_mouse_mode) {
return 0;
+ }
/* Don't confine the pointer if it shouldn't be confined. */
- if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED))
+ if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
return 0;
+ }
if (SDL_RectEmpty(&window->mouse_rect)) {
confine_rect = NULL;
@@ -2778,11 +2804,13 @@ int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *inp
SDL_WindowData *w = window->driverdata;
SDL_VideoData *d = input->display;
- if (!d->key_inhibitor_manager)
+ if (!d->key_inhibitor_manager) {
return -1;
+ }
- if (w->key_inhibitor)
+ if (w->key_inhibitor) {
return 0;
+ }
w->key_inhibitor =
zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(d->key_inhibitor_manager,
diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c
index 5cea5ef..1f3900b 100644
--- a/src/video/wayland/SDL_waylandkeyboard.c
+++ b/src/video/wayland/SDL_waylandkeyboard.c
@@ -62,8 +62,9 @@ Wayland_StartTextInput(_THIS)
const SDL_Rect *rect = &input->text_input->cursor_rect;
/* Don't re-enable if we're already enabled. */
- if (input->text_input->is_enabled)
+ if (input->text_input->is_enabled) {
return;
+ }
/* For some reason this has to be done twice, it appears to be a
* bug in mutter? Maybe?
@@ -118,7 +119,7 @@ Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
SDL_VideoData *driverdata = _this->driverdata;
- if (!rect) {
+ if (rect == NULL) {
SDL_InvalidParamError("rect");
return;
}
@@ -126,8 +127,7 @@ Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
if (driverdata->text_input_manager) {
struct SDL_WaylandInput *input = driverdata->input;
if (input != NULL && input->text_input) {
- if (!SDL_RectEquals(rect, &input->text_input->cursor_rect))
- {
+ if (!SDL_RectEquals(rect, &input->text_input->cursor_rect)) {
SDL_copyp(&input->text_input->cursor_rect, rect);
zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input,
rect->x,
@@ -156,7 +156,7 @@ Wayland_HasScreenKeyboardSupport(_THIS)
SDL_VideoData *driverdata = _this->driverdata;
SDL_bool haskeyboard = (driverdata->input != NULL) && (driverdata->input->keyboard != NULL);
SDL_bool hastextmanager = (driverdata->text_input_manager != NULL);
- return (!haskeyboard && hastextmanager);
+ return !haskeyboard && hastextmanager;
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c
index fe66c61..e2a3b9b 100644
--- a/src/video/wayland/SDL_waylandmessagebox.c
+++ b/src/video/wayland/SDL_waylandmessagebox.c
@@ -140,14 +140,14 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
}
}
output = SDL_malloc(output_len + 1);
- if (!output) {
+ if (output == NULL) {
close(fd_pipe[0]);
return SDL_OutOfMemory();
}
output[0] = '\0';
outputfp = fdopen(fd_pipe[0], "r");
- if (!outputfp) {
+ if (outputfp == NULL) {
SDL_free(output);
close(fd_pipe[0]);
return SDL_SetError("Couldn't open pipe for reading: %s", strerror(errno));
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 20c5efc..2e3a60e 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -118,7 +118,7 @@ wayland_dbus_read_cursor_size(int *size)
DBusMessage *reply;
SDL_DBusContext *dbus = SDL_DBus_GetContext();
- if (!dbus || !size) {
+ if (dbus == NULL || size == NULL) {
return SDL_FALSE;
}
@@ -141,7 +141,7 @@ wayland_dbus_read_cursor_theme(char **theme)
DBusMessage *reply;
SDL_DBusContext *dbus = SDL_DBus_GetContext();
- if (!dbus || !theme) {
+ if (dbus == NULL || theme == NULL) {
return SDL_FALSE;
}
@@ -297,7 +297,7 @@ wayland_create_tmp_file(off_t size)
int fd;
xdg_path = SDL_getenv("XDG_RUNTIME_DIR");
- if (!xdg_path) {
+ if (xdg_path == NULL) {
return -1;
}
@@ -305,8 +305,9 @@ wayland_create_tmp_file(off_t size)
SDL_strlcat(tmp_path, template, PATH_MAX);
fd = mkostemp(tmp_path, O_CLOEXEC);
- if (fd < 0)
+ if (fd < 0) {
return -1;
+ }
if (ftruncate(fd, size) < 0) {
close(fd);
@@ -341,8 +342,7 @@ create_buffer_from_shm(Wayland_CursorData *d,
int shm_fd;
shm_fd = wayland_create_tmp_file(size);
- if (shm_fd < 0)
- {
+ if (shm_fd < 0) {
return SDL_SetError("Creating mouse cursor buffer failed.");
}
@@ -387,7 +387,7 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_VideoDevice *vd = SDL_GetVideoDevice ();
SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata;
Wayland_CursorData *data = SDL_calloc (1, sizeof (Wayland_CursorData));
- if (!data) {
+ if (data == NULL) {
SDL_OutOfMemory();
SDL_free(cursor);
return NULL;
@@ -433,7 +433,7 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
cursor = SDL_calloc(1, sizeof (*cursor));
if (cursor) {
Wayland_CursorData *cdata = SDL_calloc (1, sizeof (Wayland_CursorData));
- if (!cdata) {
+ if (cdata == NULL) {
SDL_OutOfMemory();
SDL_free(cursor);
return NULL;
@@ -479,7 +479,7 @@ Wayland_FreeCursorData(Wayland_CursorData *d)
static void
Wayland_FreeCursor(SDL_Cursor *cursor)
{
- if (!cursor) {
+ if (cursor == NULL) {
return;
}
@@ -504,11 +504,11 @@ Wayland_ShowCursor(SDL_Cursor *cursor)
struct wl_pointer *pointer = d->pointer;
float scale = 1.0f;
- if (!pointer)
+ if (pointer == NULL) {
return -1;
+ }
- if (cursor)
- {
+ if (cursor) {
Wayland_CursorData *data = cursor->driverdata;
/* TODO: High-DPI custom cursors? -flibit */
@@ -535,9 +535,7 @@ Wayland_ShowCursor(SDL_Cursor *cursor)
input->relative_mode_override = SDL_FALSE;
}
- }
- else
- {
+ } else {
input->cursor_visible = SDL_FALSE;
wl_pointer_set_cursor(pointer, input->pointer_enter_serial, NULL, 0, 0);
}
@@ -579,8 +577,9 @@ Wayland_SetRelativeMouseMode(SDL_bool enabled)
if (enabled) {
/* Disable mouse warp emulation if it's enabled. */
- if (data->input->relative_mode_override)
+ if (data->input->relative_mode_override) {
data->input->relative_mode_override = SDL_FALSE;
+ }
/* If the app has used relative mode before, it probably shouldn't
* also be emulating it using repeated mouse warps, so disable
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index a0af3f5..4a85a4d 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -185,8 +185,7 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
if (window && context) {
ret = SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context);
- }
- else {
+ } else {
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
}
diff --git a/src/video/wayland/SDL_waylandtouch.h b/src/video/wayland/SDL_waylandtouch.h
index e4436f9..8487adb 100644
--- a/src/video/wayland/SDL_waylandtouch.h
+++ b/src/video/wayland/SDL_waylandtouch.h
@@ -99,7 +99,7 @@ qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surfac
id = wl_proxy_create((struct wl_proxy *) qt_surface_extension,
&qt_extended_surface_interface);
- if (!id)
+ if (id == NULL)
return NULL;
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 76b93cd..7600afb 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -204,7 +204,7 @@ Wayland_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_free(data);
WAYLAND_wl_display_disconnect(display);
SDL_WAYLAND_UnloadSymbols();
@@ -599,7 +599,7 @@ display_handle_done(void *data,
if (driverdata->has_logical_size) { /* If xdg-output is present, calculate the true scale of the desktop */
driverdata->scale_factor = (float)native_mode.w / (float)driverdata->width;
- } else { /* Scale the desktop coordinates, if xdg-output isn't present */
+ } else { /* Scale the desktop coordinates, if xdg-output isn't present */
driverdata->width /= driverdata->scale_factor;
driverdata->height /= driverdata->scale_factor;
}
@@ -705,7 +705,7 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id)
SDL_WaylandOutputData *data;
output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
- if (!output) {
+ if (output == NULL) {
SDL_SetError("Failed to retrieve output.");
return;
}
diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c
index f76efd0..a736816 100644
--- a/src/video/wayland/SDL_waylandvulkan.c
+++ b/src/video/wayland/SDL_waylandvulkan.c
@@ -48,51 +48,56 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasWaylandSurfaceExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan loader library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
+ }
+ if (path == NULL) {
path = DEFAULT_VULKAN;
+ }
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
- for(i = 0; i < extensionCount; i++)
+ }
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasWaylandSurfaceExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else if(!hasWaylandSurfaceExtension)
- {
+ } else if (!hasWaylandSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "extension");
goto fail;
@@ -107,8 +112,7 @@ fail:
void Wayland_Vulkan_UnloadLibrary(_THIS)
{
- if(_this->vulkan_config.loader_handle)
- {
+ if (_this->vulkan_config.loader_handle) {
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -122,8 +126,7 @@ SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS,
static const char *const extensionsForWayland[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
};
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
@@ -147,14 +150,12 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
VkWaylandSurfaceCreateInfoKHR createInfo;
VkResult result;
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
- if(!vkCreateWaylandSurfaceKHR)
- {
+ if (!vkCreateWaylandSurfaceKHR) {
SDL_SetError(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
@@ -167,8 +168,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
createInfo.surface = windowData->surface;
result = vkCreateWaylandSurfaceKHR(instance, &createInfo,
NULL, surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateWaylandSurfaceKHR failed: %s",
SDL_Vulkan_GetResultString(result));
return SDL_FALSE;
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index a31f6ba..5f43bcc 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1958,8 +1958,9 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
SDL_VideoData *c;
data = SDL_calloc(1, sizeof *data);
- if (data == NULL)
+ if (data == NULL) {
return SDL_OutOfMemory();
+ }
c = _this->driverdata;
window->driverdata = data;
diff --git a/src/video/windows/SDL_windowsclipboard.c b/src/video/windows/SDL_windowsclipboard.c
index e961a2b..4ba650e 100644
--- a/src/video/windows/SDL_windowsclipboard.c
+++ b/src/video/windows/SDL_windowsclipboard.c
@@ -125,7 +125,7 @@ WIN_GetClipboardText(_THIS)
}
CloseClipboard();
}
- if (!text) {
+ if (text == NULL) {
text = SDL_strdup("");
}
return text;
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 7370f9e..f608b39 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -278,8 +278,7 @@ WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, Uint32 mouseFlags, SDL_
if (bSwapButtons) {
if (button == SDL_BUTTON_LEFT) {
button = SDL_BUTTON_RIGHT;
- }
- else if (button == SDL_BUTTON_RIGHT) {
+ } else if (button == SDL_BUTTON_RIGHT) {
button = SDL_BUTTON_LEFT;
}
}
@@ -332,26 +331,36 @@ WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data, SDL_MouseID mou
if (rawButtons != data->mouse_button_flags) {
Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
SDL_bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0;
- if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN))
+ if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN)) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_1_UP))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_1_UP)) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_1_UP), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN)) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_2_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_2_UP))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_2_UP)) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_2_UP), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN)) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_3_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_3_UP))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_3_UP)) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_3_UP), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN)) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_4_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_4_UP))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_4_UP)) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_4_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN)) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_5_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID);
- if ((rawButtons & RI_MOUSE_BUTTON_5_UP))
+ }
+ if ((rawButtons & RI_MOUSE_BUTTON_5_UP)) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_5_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID);
+ }
data->mouse_button_flags = rawButtons;
}
}
@@ -650,12 +659,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Get the window data for the window */
data = WIN_GetWindowDataFromHWND(hwnd);
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
- if (!data) {
+ if (data == NULL) {
/* Fallback */
data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
}
#endif
- if (!data) {
+ if (data == NULL) {
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
}
@@ -672,8 +681,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#endif /* WMMSG_DEBUG */
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
- if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
+ if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata)) {
return 0;
+ }
#endif
switch (msg) {
@@ -1271,8 +1281,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* We'll do our own drawing, prevent flicker */
case WM_ERASEBKGND:
- if (!data->videodata->cleared)
- {
+ if (!data->videodata->cleared) {
RECT client_rect;
HBRUSH brush;
data->videodata->cleared = SDL_TRUE;
@@ -1281,12 +1290,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
FillRect(GetDC(hwnd), &client_rect, brush);
DeleteObject(brush);
}
- return (1);
+ return 1;
case WM_SYSCOMMAND:
{
if ((wParam & 0xFFF0) == SC_KEYMENU) {
- return (0);
+ return 0;
}
#if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
@@ -1294,7 +1303,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
(wParam & 0xFFF0) == SC_MONITORPOWER) {
if (SDL_GetVideoDevice()->suspend_screensaver) {
- return (0);
+ return 0;
}
}
#endif /* System has screensaver support */
@@ -1372,15 +1381,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
* If we're handling our own touches, we don't want any gestures.
* Not all of these settings are documented.
* The use of the undocumented ones was suggested by https://github.com/bjarkeck/GCGJ/blob/master/Monogame/Windows/WinFormsGameForm.cs . */
- return TABLET_DISABLE_PRESSANDHOLD | /* disables press and hold (right-click) gesture */
- TABLET_DISABLE_PENTAPFEEDBACK | /* disables UI feedback on pen up (waves) */
- TABLET_DISABLE_PENBARRELFEEDBACK | /* disables UI feedback on pen button down (circle) */
- TABLET_DISABLE_TOUCHUIFORCEON |
- TABLET_DISABLE_TOUCHUIFORCEOFF |
- TABLET_DISABLE_TOUCHSWITCH |
- TABLET_DISABLE_FLICKS | /* disables pen flicks (back, forward, drag down, drag up) */
- TABLET_DISABLE_SMOOTHSCROLLING |
- TABLET_DISABLE_FLICKFALLBACKKEYS;
+ return TABLET_DISABLE_PRESSANDHOLD | TABLET_DISABLE_PENTAPFEEDBACK | TABLET_DISABLE_PENBARRELFEEDBACK | TABLET_DISABLE_TOUCHUIFORCEON | TABLET_DISABLE_TOUCHUIFORCEOFF | TABLET_DISABLE_TOUCHSWITCH | TABLET_DISABLE_FLICKS | TABLET_DISABLE_SMOOTHSCROLLING | TABLET_DISABLE_FLICKFALLBACKKEYS; /* disables press and hold (right-click) gesture */
+ /* disables UI feedback on pen up (waves) */
+ /* disables UI feedback on pen button down (circle) */
+ /* disables pen flicks (back, forward, drag down, drag up) */
#endif /* HAVE_TPCSHRD_H */
@@ -1839,7 +1843,7 @@ WIN_PumpEvents(_THIS)
not grabbing the keyboard. Note: If we *are* grabbing the keyboard, GetKeyState()
will return inaccurate results for VK_LWIN and VK_RWIN but we don't need it anyway. */
focusWindow = SDL_GetKeyboardFocus();
- if (!focusWindow || !(focusWindow->flags & SDL_WINDOW_KEYBOARD_GRABBED)) {
+ if (focusWindow == NULL || !(focusWindow->flags & SDL_WINDOW_KEYBOARD_GRABBED)) {
if ((keystate[SDL_SCANCODE_LGUI] == SDL_PRESSED) && !(GetKeyState(VK_LWIN) & 0x8000)) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
}
@@ -1869,8 +1873,12 @@ HINSTANCE SDL_Instance = NULL;
static void WIN_CleanRegisterApp(WNDCLASSEX wcex)
{
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
- if (wcex.hIcon) DestroyIcon(wcex.hIcon);
- if (wcex.hIconSm) DestroyIcon(wcex.hIconSm);
+ if (wcex.hIcon) {
+ DestroyIcon(wcex.hIcon);
+ }
+ if (wcex.hIconSm) {
+ DestroyIcon(wcex.hIconSm);
+ }
#endif
SDL_free(SDL_Appname);
SDL_Appname = NULL;
@@ -1889,10 +1897,10 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
/* Only do this once... */
if (app_registered) {
++app_registered;
- return (0);
+ return 0;
}
SDL_assert(SDL_Appname == NULL);
- if (!name) {
+ if (name == NULL) {
name = "SDL_app";
#if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC)
style = (CS_BYTEALIGNCLIENT | CS_OWNDC);
diff --git a/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c
index 4076e6f..389cf94 100644
--- a/src/video/windows/SDL_windowsframebuffer.c
+++ b/src/video/windows/SDL_windowsframebuffer.c
@@ -65,8 +65,7 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
masks = (Uint32*)((Uint8*)info + info->bmiHeader.biSize);
*format = SDL_MasksToPixelFormatEnum(bpp, masks[0], masks[1], masks[2], 0);
}
- if (*format == SDL_PIXELFORMAT_UNKNOWN)
- {
+ if (*format == SDL_PIXELFORMAT_UNKNOWN) {
/* We'll use RGB format for now */
*format = SDL_PIXELFORMAT_RGB888;
@@ -112,7 +111,7 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
- if (!data) {
+ if (data == NULL) {
/* The window wasn't fully initialized */
return;
}
diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index a62ba07..68ec749 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -249,7 +249,7 @@ WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
HIMC himc = 0;
- if (!rect) {
+ if (rect == NULL) {
SDL_InvalidParamError("rect");
return;
}
@@ -258,8 +258,7 @@ WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
videodata->ime_rect = *rect;
himc = ImmGetContext(videodata->ime_hwnd_current);
- if (himc)
- {
+ if (himc) {
COMPOSITIONFORM cof;
CANDIDATEFORM caf;
@@ -438,15 +437,17 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd)
static void
IME_Enable(SDL_VideoData *videodata, HWND hwnd)
{
- if (!videodata->ime_initialized || !videodata->ime_hwnd_current)
+ if (!videodata->ime_initialized || !videodata->ime_hwnd_current) {
return;
+ }
if (!videodata->ime_available) {
IME_Disable(videodata, hwnd);
return;
}
- if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
+ if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) {
ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc);
+ }
videodata->ime_enabled = SDL_TRUE;
IME_UpdateInputLocale(videodata);
@@ -456,12 +457,14 @@ IME_Enable(SDL_VideoData *videodata, HWND hwnd)
static void
IME_Disable(SDL_VideoData *videodata, HWND hwnd)
{
- if (!videodata->ime_initialized || !videodata->ime_hwnd_current)
+ if (!videodata->ime_initialized || !videodata->ime_hwnd_current) {
return;
+ }
IME_ClearComposition(videodata);
- if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
+ if (videodata->ime_hwnd_current == videodata->ime_hwnd_main) {
ImmAssociateContext(videodata->ime_hwnd_current, (HIMC)0);
+ }
videodata->ime_enabled = SDL_FALSE;
UILess_DisableUIUpdates(videodata);
@@ -470,12 +473,14 @@ IME_Disable(SDL_VideoData *videodata, HWND hwnd)
static void
IME_Quit(SDL_VideoData *videodata)
{
- if (!videodata->ime_initialized)
+ if (!videodata->ime_initialized) {
return;
+ }
UILess_ReleaseSinks(videodata);
- if (videodata->ime_hwnd_main)
+ if (videodata->ime_hwnd_main) {
ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc);
+ }
videodata->ime_hwnd_main = 0;
videodata->ime_himc = 0;
@@ -507,30 +512,33 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
BOOL vertical = FALSE;
UINT maxuilen = 0;
- if (videodata->ime_uiless)
+ if (videodata->ime_uiless) {
return;
+ }
videodata->ime_readingstring[0] = 0;
id = IME_GetId(videodata, 0);
- if (!id)
+ if (!id) {
return;
+ }
himc = ImmGetContext(hwnd);
- if (!himc)
+ if (!himc) {
return;
+ }
if (videodata->GetReadingString) {
len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen);
if (len) {
- if (len > SDL_arraysize(buffer))
+ if (len > SDL_arraysize(buffer)) {
len = SDL_arraysize(buffer);
+ }
len = videodata->GetReadingString(himc, len, s, &err, &vertical, &maxuilen);
}
SDL_wcslcpy(videodata->ime_readingstring, s, len);
- }
- else {
+ } else {
LPINPUTCONTEXT2 lpimc = videodata->ImmLockIMC(himc);
LPBYTE p = 0;
s = 0;
@@ -540,8 +548,9 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
case IMEID_CHT_VER43:
case IMEID_CHT_VER44:
p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 24);
- if (!p)
+ if (!p) {
break;
+ }
len = *(DWORD *)(p + 7*4 + 32*4);
s = (WCHAR *)(p + 56);
@@ -550,12 +559,14 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
case IMEID_CHT_VER52:
case IMEID_CHS_VER53:
p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 4);
- if (!p)
+ if (!p) {
break;
+ }
p = *(LPBYTE *)((LPBYTE)p + 1*4 + 5*4);
- if (!p)
+ if (!p) {
break;
+ }
len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2);
s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4);
@@ -564,8 +575,9 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
{
int offset = (IME_GetId(videodata, 1) >= 0x00000002) ? 8 : 7;
p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + offset * 4);
- if (!p)
+ if (!p) {
break;
+ }
len = *(DWORD *)(p + 7*4 + 16*2*4);
s = (WCHAR *)(p + 6*4 + 16*2*1);
@@ -573,8 +585,9 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
break;
case IMEID_CHS_VER42:
p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4);
- if (!p)
+ if (!p) {
break;
+ }
len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2);
s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4);
@@ -597,8 +610,9 @@ IME_InputLangChanged(SDL_VideoData *videodata)
{
UINT lang = PRIMLANG();
IME_UpdateInputLocale(videodata);
- if (!videodata->ime_uiless)
+ if (!videodata->ime_uiless) {
videodata->ime_candlistindexbase = (videodata->ime_hkl == CHT_HKL_DAYI) ? 0 : 1;
+ }
IME_SetupAPI(videodata);
if (lang != PRIMLANG()) {
@@ -622,8 +636,9 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex)
SDL_assert(uIndex < sizeof(dwRet) / sizeof(dwRet[0]));
hkl = videodata->ime_hkl;
- if (hklprev == hkl)
+ if (hklprev == hkl) {
return dwRet[uIndex];
+ }
hklprev = hkl;
SDL_assert(uIndex == 0);
@@ -703,16 +718,19 @@ IME_SetupAPI(SDL_VideoData *videodata)
HKL hkl = 0;
videodata->GetReadingString = 0;
videodata->ShowReadingWindow = 0;
- if (videodata->ime_uiless)
+ if (videodata->ime_uiless) {
return;
+ }
hkl = videodata->ime_hkl;
- if (!ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1))
+ if (!ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1)) {
return;
+ }
hime = SDL_LoadObject(ime_file);
- if (!hime)
+ if (hime == NULL) {
return;
+ }
videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT))
SDL_LoadFunction(hime, "GetReadingString");
@@ -735,8 +753,9 @@ IME_SetWindow(SDL_VideoData* videodata, HWND hwnd)
if (videodata->ime_threadmgr) {
struct ITfDocumentMgr *document_mgr = 0;
if (SUCCEEDED(videodata->ime_threadmgr->lpVtbl->AssociateFocus(videodata->ime_threadmgr, hwnd, NULL, &document_mgr))) {
- if (document_mgr)
+ if (document_mgr) {
document_mgr->lpVtbl->Release(document_mgr);
+ }
}
}
}
@@ -746,8 +765,9 @@ IME_UpdateInputLocale(SDL_VideoData *videodata)
{
HKL hklnext = GetKeyboardLayout(0);
- if (hklnext == videodata->ime_hkl)
+ if (hklnext == videodata->ime_hkl) {
return;
+ }
videodata->ime_hkl = hklnext;
videodata->ime_candvertical = (PRIMLANG() == LANG_KOREAN || LANG() == LANG_CHS) ? SDL_FALSE : SDL_TRUE;
@@ -757,16 +777,19 @@ static void
IME_ClearComposition(SDL_VideoData *videodata)
{
HIMC himc = 0;
- if (!videodata->ime_initialized)
+ if (!videodata->ime_initialized) {
return;
+ }
himc = ImmGetContext(videodata->ime_hwnd_current);
- if (!himc)
+ if (!himc) {
return;
+ }
ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
- if (videodata->ime_uiless)
+ if (videodata->ime_uiless) {
ImmSetCompositionString(himc, SCS_SETSTR, TEXT(""), sizeof(TCHAR), TEXT(""), sizeof(TCHAR));
+ }
ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0);
ImmReleaseContext(videodata->ime_hwnd_current, himc);
@@ -776,8 +799,9 @@ IME_ClearComposition(SDL_VideoData *videodata)
static SDL_bool
IME_IsTextInputShown(SDL_VideoData* videodata)
{
- if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled)
+ if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) {
return SDL_FALSE;
+ }
return videodata->ime_uicontext != 0 ? SDL_TRUE : SDL_FALSE;
}
@@ -790,8 +814,9 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
length = ImmGetCompositionStringW(himc, string, NULL, 0);
if (length > 0 && videodata->ime_composition_length < length) {
- if (videodata->ime_composition != NULL)
+ if (videodata->ime_composition != NULL) {
SDL_free(videodata->ime_composition);
+ }
videodata->ime_composition = (WCHAR*)SDL_malloc(length + sizeof(WCHAR));
videodata->ime_composition_length = length;
@@ -804,8 +829,9 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
videodata->ime_composition_length
);
- if (length < 0)
+ if (length < 0) {
length = 0;
+ }
length /= sizeof(WCHAR);
videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0));
@@ -816,8 +842,9 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
// Traditional Chinese IMEs add a placeholder U+3000
// Simplified Chinese IMEs seem to add a placeholder U+0020 sometimes
int i;
- for (i = videodata->ime_cursor + 1; i < length; ++i)
+ for (i = videodata->ime_cursor + 1; i < length; ++i) {
videodata->ime_composition[i - 1] = videodata->ime_composition[i];
+ }
--length;
}
@@ -835,15 +862,15 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
ImmGetCompositionString(himc, GCS_COMPATTR, attributes, length);
for (start = 0; start < length; ++start) {
- if (attributes[start] == ATTR_TARGET_CONVERTED ||
- attributes[start] == ATTR_TARGET_NOTCONVERTED)
+ if (attributes[start] == ATTR_TARGET_CONVERTED || attributes[start] == ATTR_TARGET_NOTCONVERTED) {
break;
+ }
}
for (end = start; end < length; ++end) {
- if (attributes[end] != ATTR_TARGET_CONVERTED &&
- attributes[end] != ATTR_TARGET_NOTCONVERTED)
+ if (attributes[end] != ATTR_TARGET_CONVERTED && attributes[end] != ATTR_TARGET_NOTCONVERTED) {
break;
+ }
}
if (start == length) {
@@ -887,8 +914,7 @@ IME_SendEditingEvent(SDL_VideoData *videodata)
SDL_wcslcpy(buffer, videodata->ime_composition, len + 1);
SDL_wcslcat(buffer, videodata->ime_readingstring, size);
SDL_wcslcat(buffer, &videodata->ime_composition[len], size);
- }
- else {
+ } else {
buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR));
buffer[0] = 0;
SDL_wcslcpy(buffer, videodata->ime_composition, size);
@@ -907,11 +933,13 @@ IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate)
LPWSTR end = &dst[MAX_CANDLENGTH - 1];
SDL_COMPILE_TIME_ASSERT(IME_CANDIDATE_INDEXING_REQUIRES, MAX_CANDLIST == 10);
*dst++ = (WCHAR)(TEXT('0') + ((i + videodata->ime_candlistindexbase) % 10));
- if (videodata->ime_candvertical)
+ if (videodata->ime_candvertical) {
*dst++ = TEXT(' ');
+ }
- while (*candidate && dst < end)
+ while (*candidate && dst < end) {
*dst++ = *candidate++;
+ }
*dst = (WCHAR)'\0';
}
@@ -923,11 +951,13 @@ IME_GetCandidateList(HWND hwnd, SDL_VideoData *videodata)
DWORD size;
LPCANDIDATELIST cand_list;
- if (IME_ShowCandidateList(videodata) < 0)
+ if (IME_ShowCandidateList(videodata) < 0) {
return;
+ }
himc = ImmGetContext(hwnd);
- if (!himc)
+ if (!himc) {
return;
+ }
size = ImmGetCandidateListW(himc, 0, 0, 0);
if (size != 0) {
cand_list = (LPCANDIDATELIST)SDL_malloc(size);
@@ -946,13 +976,13 @@ IME_GetCandidateList(HWND hwnd, SDL_VideoData *videodata)
for (i = 0; i < videodata->ime_candcount; ++i) {
size_t len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1;
if (len + cchars > maxcandchar) {
- if (i > cand_list->dwSelection)
+ if (i > cand_list->dwSelection) {
break;
+ }
page_start = i;
cchars = len;
- }
- else {
+ } else {
cchars += len;
}
}
@@ -983,11 +1013,13 @@ IME_ShowCandidateList(SDL_VideoData *videodata)
videodata->ime_candcount = 0;
candidates = SDL_realloc(videodata->ime_candidates, MAX_CANDSIZE);
- if (candidates != NULL)
+ if (candidates != NULL) {
videodata->ime_candidates = (WCHAR *)candidates;
+ }
- if (videodata->ime_candidates == NULL)
+ if (videodata->ime_candidates == NULL) {
return -1;
+ }
SDL_memset(videodata->ime_candidates, 0, MAX_CANDSIZE);
@@ -1012,17 +1044,16 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
{
SDL_bool trap = SDL_FALSE;
HIMC himc = 0;
- if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled)
+ if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) {
return SDL_FALSE;
+ }
switch (msg) {
case WM_KEYDOWN:
- if (wParam == VK_PROCESSKEY)
- {
+ if (wParam == VK_PROCESSKEY) {
videodata->ime_uicontext = 1;
trap = SDL_TRUE;
- }
- else
+ } else
videodata->ime_uicontext = 0;
break;
case WM_INPUTLANGCHANGE:
@@ -1047,8 +1078,9 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
IME_SendInputEvent(videodata);
}
if (*lParam & GCS_COMPSTR) {
- if (!videodata->ime_uiless)
+ if (!videodata->ime_uiless) {
videodata->ime_readingstring[0] = 0;
+ }
IME_GetCompositionString(videodata, himc, GCS_COMPSTR);
IME_SendEditingEvent(videodata);
@@ -1060,8 +1092,9 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
videodata->ime_composition[0] = 0;
videodata->ime_readingstring[0] = 0;
videodata->ime_cursor = 0;
- if (videodata->ime_suppress_endcomposition_event == SDL_FALSE)
+ if (videodata->ime_suppress_endcomposition_event == SDL_FALSE) {
SDL_SendEditingText("", 0, 0);
+ }
videodata->ime_suppress_endcomposition_event = SDL_FALSE;
break;
case WM_IME_NOTIFY:
@@ -1072,8 +1105,9 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
break;
case IMN_OPENCANDIDATE:
case IMN_CHANGECANDIDATE:
- if (videodata->ime_uiless)
+ if (videodata->ime_uiless) {
break;
+ }
trap = SDL_TRUE;
videodata->ime_uicontext = 1;
@@ -1095,8 +1129,9 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
case IMEID_CHT_VER44:
case IMEID_CHS_VER41:
case IMEID_CHS_VER42:
- if (*lParam == 1 || *lParam == 2)
+ if (*lParam == 1 || *lParam == 2) {
trap = SDL_TRUE;
+ }
break;
case IMEID_CHT_VER50:
@@ -1104,12 +1139,9 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD
case IMEID_CHT_VER52:
case IMEID_CHT_VER60:
case IMEID_CHS_VER53:
- if (*lParam == 16
- || *lParam == 17
- || *lParam == 26
- || *lParam == 27
- || *lParam == 28)
+ if (*lParam == 16 || *lParam == 17 || *lParam == 26 || *lParam == 27 || *lParam == 28) {
trap = SDL_TRUE;
+ }
break;
}
}
@@ -1143,8 +1175,9 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca
DWORD pgsize = 0;
UINT i, j;
- if (IME_ShowCandidateList(videodata) < 0)
+ if (IME_ShowCandidateList(videodata) < 0) {
return;
+ }
pcandlist->lpVtbl->GetSelection(pcandlist, &selection);
pcandlist->lpVtbl->GetCount(pcandlist, &count);
@@ -1200,14 +1233,16 @@ STDMETHODIMP_(ULONG) TSFSink_Release(TSFSink *sink)
STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
{
- if (!ppv)
+ if (ppv == NULL) {
return E_INVALIDARG;
+ }
*ppv = 0;
- if (WIN_IsEqualIID(riid, &IID_IUnknown))
+ if (WIN_IsEqualIID(riid, &IID_IUnknown)) {
*ppv = (IUnknown *)sink;
- else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink))
+ } else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink)) {
*ppv = (ITfUIElementSink *)sink;
+ }
if (*ppv) {
TSFSink_AddRef(sink);
@@ -1235,8 +1270,9 @@ STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BO
ITfReadingInformationUIElement *preading = 0;
ITfCandidateListUIElement *pcandlist = 0;
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
- if (!element)
+ if (element == NULL) {
return E_INVALIDARG;
+ }
*pbShow = FALSE;
if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
@@ -1245,8 +1281,7 @@ STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BO
SysFreeString(bstr);
}
preading->lpVtbl->Release(preading);
- }
- else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ } else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
videodata->ime_candref++;
UILess_GetCandidateList(videodata, pcandlist);
pcandlist->lpVtbl->Release(pcandlist);
@@ -1260,8 +1295,9 @@ STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId)
ITfReadingInformationUIElement *preading = 0;
ITfCandidateListUIElement *pcandlist = 0;
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
- if (!element)
+ if (element == NULL) {
return E_INVALIDARG;
+ }
if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
BSTR bstr;
@@ -1272,8 +1308,7 @@ STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId)
SysFreeString(bstr);
}
preading->lpVtbl->Release(preading);
- }
- else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ } else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
UILess_GetCandidateList(videodata, pcandlist);
pcandlist->lpVtbl->Release(pcandlist);
}
@@ -1286,8 +1321,9 @@ STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId)
ITfReadingInformationUIElement *preading = 0;
ITfCandidateListUIElement *pcandlist = 0;
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
- if (!element)
+ if (element == NULL) {
return E_INVALIDARG;
+ }
if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
videodata->ime_readingstring[0] = 0;
@@ -1296,8 +1332,9 @@ STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId)
}
if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
videodata->ime_candref--;
- if (videodata->ime_candref == 0)
+ if (videodata->ime_candref == 0) {
IME_CloseCandidateList(videodata);
+ }
pcandlist->lpVtbl->Release(pcandlist);
}
@@ -1306,14 +1343,16 @@ STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId)
STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
{
- if (!ppv)
+ if (ppv == NULL) {
return E_INVALIDARG;
+ }
*ppv = 0;
- if (WIN_IsEqualIID(riid, &IID_IUnknown))
+ if (WIN_IsEqualIID(riid, &IID_IUnknown)) {
*ppv = (IUnknown *)sink;
- else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink))
+ } else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) {
*ppv = (ITfInputProcessorProfileActivationSink *)sink;
+ }
if (*ppv) {
TSFSink_AddRef(sink);
@@ -1327,8 +1366,9 @@ STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID lan
static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
- if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE))
+ if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) {
IME_InputLangChanged((SDL_VideoData *)sink->data);
+ }
IME_HideCandidateList(videodata);
return S_OK;
@@ -1354,8 +1394,9 @@ static void
UILess_EnableUIUpdates(SDL_VideoData *videodata)
{
ITfSource *source = 0;
- if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie != TF_INVALID_COOKIE)
+ if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie != TF_INVALID_COOKIE) {
return;
+ }
if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie);
@@ -1367,8 +1408,9 @@ static void
UILess_DisableUIUpdates(SDL_VideoData *videodata)
{
ITfSource *source = 0;
- if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie == TF_INVALID_COOKIE)
+ if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie == TF_INVALID_COOKIE) {
return;
+ }
if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie);
@@ -1383,11 +1425,13 @@ UILess_SetupSinks(SDL_VideoData *videodata)
TfClientId clientid = 0;
SDL_bool result = SDL_FALSE;
ITfSource *source = 0;
- if (FAILED(CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&videodata->ime_threadmgrex)))
+ if (FAILED(CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&videodata->ime_threadmgrex))) {
return SDL_FALSE;
+ }
- if (FAILED(videodata->ime_threadmgrex->lpVtbl->ActivateEx(videodata->ime_threadmgrex, &clientid, TF_TMAE_UIELEMENTENABLEDONLY)))
+ if (FAILED(videodata->ime_threadmgrex->lpVtbl->ActivateEx(videodata->ime_threadmgrex, &clientid, TF_TMAE_UIELEMENTENABLEDONLY))) {
return SDL_FALSE;
+ }
videodata->ime_uielemsink = SDL_malloc(sizeof(TSFSink));
videodata->ime_ippasink = SDL_malloc(sizeof(TSFSink));
@@ -1451,8 +1495,9 @@ StartDrawToBitmap(HDC hdc, HBITMAP *hhbm, int width, int height)
infoHeader->biBitCount = 32;
infoHeader->biCompression = BI_RGB;
*hhbm = CreateDIBSection(hdc, &info, DIB_RGB_COLORS, (void **)&bits, 0, 0);
- if (*hhbm)
+ if (*hhbm) {
SelectObject(hdc, *hhbm);
+ }
}
return bits;
}
@@ -1507,8 +1552,9 @@ IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size)
left -= right - winw;
right = winw;
}
- if (bottom < winh)
+ if (bottom < winh) {
ok = SDL_TRUE;
+ }
/* Top */
if (!ok) {
@@ -1520,8 +1566,9 @@ IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size)
left -= right - winw;
right = winw;
}
- if (top >= 0)
+ if (top >= 0) {
ok = SDL_TRUE;
+ }
}
/* Right */
@@ -1530,8 +1577,9 @@ IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size)
top = 0;
right = left + size.cx;
bottom = size.cy;
- if (right < winw)
+ if (right < winw) {
ok = SDL_TRUE;
+ }
}
/* Left */
@@ -1540,8 +1588,9 @@ IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size)
top = 0;
right = videodata->ime_rect.x;
bottom = size.cy;
- if (right >= 0)
+ if (right >= 0) {
ok = SDL_TRUE;
+ }
}
/* Window too small, show at (0,0) */
@@ -1625,8 +1674,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
(candcount * candpadding * 2) +
(candcount * maxcandsize.cy)
;
- }
- else {
+ } else {
size.cx =
(listborder * 2) +
(listpadding * 2) +
@@ -1635,8 +1683,9 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
(candcount * candpadding * 2) +
((candcount - 1) * horzcandspacing);
- for (i = 0; i < candcount; ++i)
+ for (i = 0; i < candcount; ++i) {
size.cx += candsizes[i].cx;
+ }
size.cy =
(listborder * 2) +
@@ -1668,12 +1717,12 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
top = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * maxcandsize.cy);
right = size.cx - listborder - listpadding - candmargin;
bottom = top + maxcandsize.cy + (candpadding * 2) + (candborder * 2);
- }
- else {
+ } else {
left = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * horzcandspacing);
- for (j = 0; j < i; ++j)
+ for (j = 0; j < i; ++j) {
left += candsizes[j].cx;
+ }
top = listborder + listpadding + candmargin;
right = left + candsizes[i].cx + (candpadding * 2) + (candborder * 2);
@@ -1684,8 +1733,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
SelectObject(hdc, selpen);
SelectObject(hdc, selbrush);
SetTextColor(hdc, seltextcolor);
- }
- else {
+ } else {
SelectObject(hdc, candpen);
SelectObject(hdc, candbrush);
SetTextColor(hdc, candtextcolor);
@@ -1712,8 +1760,9 @@ IME_Render(SDL_VideoData *videodata)
{
HDC hdc = CreateCompatibleDC(NULL);
- if (videodata->ime_candlist)
+ if (videodata->ime_candlist) {
IME_RenderCandidateList(videodata, hdc);
+ }
DeleteDC(hdc);
@@ -1722,8 +1771,9 @@ IME_Render(SDL_VideoData *videodata)
void IME_Present(SDL_VideoData *videodata)
{
- if (videodata->ime_dirty)
+ if (videodata->ime_dirty) {
IME_Render(videodata);
+ }
/* FIXME: Need to show the IME bitmap */
}
diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c
index 25d40a1..bfbf3c3 100644
--- a/src/video/windows/SDL_windowsmessagebox.c
+++ b/src/video/windows/SDL_windowsmessagebox.c
@@ -345,7 +345,7 @@ static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space)
if (size > dialog->size) {
void *data = SDL_realloc(dialog->data, size);
- if (!data) {
+ if (data == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@@ -388,12 +388,12 @@ static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string)
size_t count;
SDL_bool status;
- if (!string) {
+ if (string == NULL) {
string = "";
}
wstring = WIN_UTF8ToStringW(string);
- if (!wstring) {
+ if (wstring == NULL) {
return SDL_FALSE;
}
@@ -523,7 +523,7 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy);
dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog));
- if (!dialog) {
+ if (dialog == NULL) {
return NULL;
}
@@ -566,8 +566,10 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
{
HDC ScreenDC = GetDC(NULL);
int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY);
- if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */
- LogicalPixelsY = 72;
+ if (!LogicalPixelsY) {
+ LogicalPixelsY = 72; /* This can happen if the application runs out of GDI handles */
+ }
+
WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY);
ReleaseDC(NULL, ScreenDC);
}
@@ -805,8 +807,9 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
}
/* Ensure the size is wide enough for all of the buttons. */
- if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin)
+ if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin) {
Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin;
+ }
/* Reset the height to the icon size if it is actually bigger than the text. */
if (icon && Size.cy < IconMargin * 2 + IconHeight) {
@@ -817,7 +820,7 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Size.cy += ButtonHeight + TextMargin;
dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title);
- if (!dialog) {
+ if (dialog == NULL) {
return -1;
}
@@ -977,8 +980,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
pButtons = SDL_malloc(sizeof (TASKDIALOG_BUTTON) * messageboxdata->numbuttons);
TaskConfig.nDefaultButton = 0;
nCancelButton = 0;
- for (i = 0; i < messageboxdata->numbuttons; i++)
- {
+ for (i = 0; i < messageboxdata->numbuttons; i++) {
const char *buttontext;
if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT) {
pButton = &pButtons[i];
diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c
index 2e44140..78af479 100644
--- a/src/video/windows/SDL_windowsmodes.c
+++ b/src/video/windows/SDL_windowsmodes.c
@@ -174,7 +174,7 @@ WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * mod
}
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
- if (!data) {
+ if (data == NULL) {
return SDL_FALSE;
}
@@ -217,7 +217,7 @@ WIN_GetDisplayNameVista(const WCHAR *deviceName)
LONG rc;
dll = SDL_LoadObject("USER32.DLL");
- if (!dll) {
+ if (dll == NULL) {
return NULL;
}
@@ -225,7 +225,7 @@ WIN_GetDisplayNameVista(const WCHAR *deviceName)
pQueryDisplayConfig = (SDL_WIN32PROC_QueryDisplayConfig) SDL_LoadFunction(dll, "QueryDisplayConfig");
pDisplayConfigGetDeviceInfo = (SDL_WIN32PROC_DisplayConfigGetDeviceInfo) SDL_LoadFunction(dll, "DisplayConfigGetDeviceInfo");
- if (!pGetDisplayConfigBufferSizes || !pQueryDisplayConfig || !pDisplayConfigGetDeviceInfo) {
+ if (pGetDisplayConfigBufferSizes == NULL || pQueryDisplayConfig == NULL || pDisplayConfigGetDeviceInfo == NULL) {
goto WIN_GetDisplayNameVista_failed;
}
@@ -316,7 +316,7 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se
// Prevent adding duplicate displays. Do this after we know the display is
// ready to be added to allow any displays that we can't fully query to be
// removed
- for(i = 0; i < _this->num_displays; ++i) {
+ for (i = 0; i < _this->num_displays; ++i) {
SDL_DisplayData *driverdata = (SDL_DisplayData *)_this->displays[i].driverdata;
if (SDL_wcscmp(driverdata->DeviceName, info->szDevice) == 0) {
driverdata->MonitorHandle = hMonitor;
@@ -333,7 +333,7 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se
}
displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
- if (!displaydata) {
+ if (displaydata == NULL) {
return SDL_FALSE;
}
SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName));
@@ -583,7 +583,7 @@ void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut)
*dpiOut = 96;
}
- if (!videodevice || !videodevice->driverdata) {
+ if (videodevice == NULL || !videodevice->driverdata) {
return;
}
@@ -637,7 +637,7 @@ void WIN_ScreenPointToSDL(int *x, int *y)
float ddpi, hdpi, vdpi;
int x_pixels, y_pixels;
- if (!videodevice || !videodevice->driverdata) {
+ if (videodevice == NULL || !videodevice->driverdata) {
return;
}
diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c
index 2ef0f14..31d8f60 100644
--- a/src/video/windows/SDL_windowsmouse.c
+++ b/src/video/windows/SDL_windowsmouse.c
@@ -235,7 +235,7 @@ WIN_FreeCursor(SDL_Cursor * cursor)
static int
WIN_ShowCursor(SDL_Cursor * cursor)
{
- if (!cursor) {
+ if (cursor == NULL) {
cursor = SDL_blank_cursor;
}
if (cursor) {
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index c1df7f6..53f27d5 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -189,7 +189,7 @@ WIN_GL_GetProcAddress(_THIS, const char *proc)
/* This is to pick up extensions */
func = _this->gl_data->wglGetProcAddress(proc);
- if (!func) {
+ if (func == NULL) {
/* This is probably a normal GL function */
func = GetProcAddress(_this->gl_config.dll_handle, proc);
}
@@ -352,11 +352,13 @@ HasExtension(const char *extension, const char *extensions)
/* Extension names should not have spaces. */
where = SDL_strchr(extension, ' ');
- if (where || *extension == '\0')
+ if (where || *extension == '\0') {
return SDL_FALSE;
+ }
- if (!extensions)
+ if (extensions == NULL) {
return SDL_FALSE;
+ }
/* It takes a bit of care to be fool-proof about parsing the
* OpenGL extensions string. Don't be fooled by sub-strings,
@@ -366,13 +368,16 @@ HasExtension(const char *extension, const char *extensions)
for (;;) {
where = SDL_strstr(start, extension);
- if (!where)
+ if (where == NULL) {
break;
+ }
terminator = where + SDL_strlen(extension);
- if (where == start || *(where - 1) == ' ')
- if (*terminator == ' ' || *terminator == '\0')
+ if (where == start || *(where - 1) == ' ') {
+ if (*terminator == ' ' || *terminator == '\0') {
return SDL_TRUE;
+ }
+ }
start = terminator;
}
@@ -663,11 +668,7 @@ WIN_GL_UseEGL(_THIS)
SDL_assert(_this->gl_data != NULL);
SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
- return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE)
- || _this->gl_config.major_version == 1 /* No WGL extension for OpenGL ES 1.x profiles. */
- || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major
- || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major
- && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor));
+ return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); /* No WGL extension for OpenGL ES 1.x profiles. */
}
SDL_GLContext
@@ -712,7 +713,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
_this->gl_config.flags == 0) {
/* Create legacy context */
context = _this->gl_data->wglCreateContext(hdc);
- if( share_context != 0 ) {
+ if ( share_context != 0 ) {
_this->gl_data->wglShareLists(share_context, context);
}
} else {
@@ -810,15 +811,15 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
}
/* sanity check that higher level handled this. */
- SDL_assert(window || (!window && !context));
+ SDL_assert(window || (window == NULL && !context));
/* Some Windows drivers freak out if hdc is NULL, even when context is
NULL, against spec. Since hdc is _supposed_ to be ignored if context
is NULL, we either use the current GL window, or do nothing if we
already have no current context. */
- if (!window) {
+ if (window == NULL) {
window = SDL_GL_GetCurrentWindow();
- if (!window) {
+ if (window == NULL) {
SDL_assert(SDL_GL_GetCurrentContext() == NULL);
return 0; /* already done. */
}
diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c
index 484566d..64af5a6 100644
--- a/src/video/windows/SDL_windowsshape.c
+++ b/src/video/windows/SDL_windowsshape.c
@@ -29,7 +29,7 @@ SDL_WindowShaper*
Win32_CreateShaper(SDL_Window * window) {
int resized_properly;
SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper));
- if (!result) {
+ if (result == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -60,14 +60,13 @@ Win32_CreateShaper(SDL_Window * window) {
static void
CombineRectRegions(SDL_ShapeTree* node,void* closure) {
HRGN mask_region = *((HRGN*)closure),temp_region = NULL;
- if(node->kind == OpaqueShape) {
+ if (node->kind == OpaqueShape) {
/* Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. */
temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.x + node->data.shape.w + 1,node->data.shape.y + node->data.shape.h + 1);
- if(mask_region != NULL) {
+ if (mask_region != NULL) {
CombineRgn(mask_region,mask_region,temp_region,RGN_OR);
DeleteObject(temp_region);
- }
- else
+ } else
*((HRGN*)closure) = temp_region;
}
}
@@ -77,7 +76,7 @@ Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
SDL_ShapeData *data;
HRGN mask_region = NULL;
- if( (shaper == NULL) ||
+ if ( (shaper == NULL) ||
(shape == NULL) ||
((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) ||
(shape->w != shaper->window->w) ||
@@ -86,8 +85,9 @@ Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
}
data = (SDL_ShapeData*)shaper->driverdata;
- if(data->mask_tree != NULL)
+ if (data->mask_tree != NULL) {
SDL_FreeShapeTree(&data->mask_tree);
+ }
data->mask_tree = SDL_CalculateShapeTree(*shape_mode,shape);
SDL_TraverseShapeTree(data->mask_tree,&CombineRectRegions,&mask_region);
@@ -102,15 +102,18 @@ int
Win32_ResizeWindowShape(SDL_Window *window) {
SDL_ShapeData* data;
- if (window == NULL)
+ if (window == NULL) {
return -1;
+ }
data = (SDL_ShapeData *)window->shaper->driverdata;
- if (data == NULL)
+ if (data == NULL) {
return -1;
+ }
- if(data->mask_tree != NULL)
+ if (data->mask_tree != NULL) {
SDL_FreeShapeTree(&data->mask_tree);
- if(window->shaper->hasshape == SDL_TRUE) {
+ }
+ if (window->shaper->hasshape == SDL_TRUE) {
window->shaper->userx = window->x;
window->shaper->usery = window->y;
SDL_SetWindowPosition(window,-1000,-1000);
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 0dc107b..54cdd72 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -552,7 +552,7 @@ SDL_Direct3D9GetAdapterIndex(int displayIndex)
SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex);
int adapterIndex = D3DADAPTER_DEFAULT;
- if (!pData) {
+ if (pData == NULL) {
SDL_SetError("Invalid display index");
adapterIndex = -1; /* make sure we return something invalid */
} else {
@@ -620,8 +620,12 @@ SDL_bool
SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
{
#if !HAVE_DXGI_H
- if (adapterIndex) *adapterIndex = -1;
- if (outputIndex) *outputIndex = -1;
+ if (adapterIndex) {
+ *adapterIndex = -1;
+ }
+ if (outputIndex) {
+ *outputIndex = -1;
+ }
SDL_SetError("SDL was compiled without DXGI support due to missing dxgi.h header");
return SDL_FALSE;
#else
@@ -633,12 +637,12 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
IDXGIAdapter *pDXGIAdapter;
IDXGIOutput* pDXGIOutput;
- if (!adapterIndex) {
+ if (adapterIndex == NULL) {
SDL_InvalidParamError("adapterIndex");
return SDL_FALSE;
}
- if (!outputIndex) {
+ if (outputIndex == NULL) {
SDL_InvalidParamError("outputIndex");
return SDL_FALSE;
}
@@ -646,7 +650,7 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
*adapterIndex = -1;
*outputIndex = -1;
- if (!pData) {
+ if (pData == NULL) {
SDL_SetError("Invalid display index");
return SDL_FALSE;
}
diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c
index 2a66f43..36af273 100644
--- a/src/video/windows/SDL_windowsvulkan.c
+++ b/src/video/windows/SDL_windowsvulkan.c
@@ -43,51 +43,56 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasWin32SurfaceExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan loader library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
+ }
+ if (path == NULL) {
path = "vulkan-1.dll";
+ }
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
- for(i = 0; i < extensionCount; i++)
+ }
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasWin32SurfaceExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else if(!hasWin32SurfaceExtension)
- {
+ } else if (!hasWin32SurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_WIN32_SURFACE_EXTENSION_NAME "extension");
goto fail;
@@ -102,8 +107,7 @@ fail:
void WIN_Vulkan_UnloadLibrary(_THIS)
{
- if(_this->vulkan_config.loader_handle)
- {
+ if (_this->vulkan_config.loader_handle) {
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -117,8 +121,7 @@ SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS,
static const char *const extensionsForWin32[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME
};
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
@@ -142,14 +145,12 @@ SDL_bool WIN_Vulkan_CreateSurface(_THIS,
VkWin32SurfaceCreateInfoKHR createInfo;
VkResult result;
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
- if(!vkCreateWin32SurfaceKHR)
- {
+ if (!vkCreateWin32SurfaceKHR) {
SDL_SetError(VK_KHR_WIN32_SURFACE_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
@@ -161,8 +162,7 @@ SDL_bool WIN_Vulkan_CreateSurface(_THIS,
createInfo.hwnd = windowData->hwnd;
result = vkCreateWin32SurfaceKHR(instance, &createInfo,
NULL, surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateWin32SurfaceKHR failed: %s",
SDL_Vulkan_GetResultString(result));
return SDL_FALSE;
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index d260f15..151c369 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -305,7 +305,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
/* Allocate the window data */
data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
data->window = window;
@@ -841,8 +841,7 @@ WIN_RaiseWindow(_THIS, SDL_Window * window)
DWORD dwCurID = 0u;
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
- if(bForce)
- {
+ if (bForce) {
hCurWnd = GetForegroundWindow();
dwMyID = GetCurrentThreadId();
dwCurID = GetWindowThreadProcessId(hCurWnd, NULL);
@@ -852,8 +851,7 @@ WIN_RaiseWindow(_THIS, SDL_Window * window)
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}
SetForegroundWindow(hwnd);
- if (bForce)
- {
+ if (bForce) {
AttachThreadInput(dwCurID, dwMyID, FALSE);
SetFocus(hwnd);
SetActiveWindow(hwnd);
@@ -1079,7 +1077,7 @@ WIN_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size)
filename_utf8 = WIN_StringToUTF8(data->ICMFileName);
if (filename_utf8) {
iccProfileData = SDL_LoadFile(filename_utf8, size);
- if (!iccProfileData) {
+ if (iccProfileData == NULL) {
SDL_SetError("Could not open ICC profile");
}
SDL_free(filename_utf8);
@@ -1293,7 +1291,7 @@ void WIN_OnWindowEnter(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
- if (!data || !data->hwnd) {
+ if (data == NULL || !data->hwnd) {
/* The window wasn't fully initialized */
return;
}
@@ -1451,8 +1449,9 @@ WIN_ClientPointToSDL(const SDL_Window *window, int *x, int *y)
const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata);
const SDL_VideoData *videodata = data->videodata;
- if (!videodata->dpi_scaling_enabled)
+ if (!videodata->dpi_scaling_enabled) {
return;
+ }
*x = MulDiv(*x, 96, data->scaling_dpi);
*y = MulDiv(*y, 96, data->scaling_dpi);
@@ -1469,8 +1468,9 @@ WIN_ClientPointFromSDL(const SDL_Window *window, int *x, int *y)
const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata);
const SDL_VideoData *videodata = data->videodata;
- if (!videodata->dpi_scaling_enabled)
+ if (!videodata->dpi_scaling_enabled) {
return;
+ }
*x = MulDiv(*x, data->scaling_dpi, 96);
*y = MulDiv(*y, data->scaling_dpi, 96);
diff --git a/src/video/winrt/SDL_winrtgamebar.cpp b/src/video/winrt/SDL_winrtgamebar.cpp
index 2b12357..ae16092 100644
--- a/src/video/winrt/SDL_winrtgamebar.cpp
+++ b/src/video/winrt/SDL_winrtgamebar.cpp
@@ -121,7 +121,7 @@ WINRT_HandleGameBarIsInputRedirected_MainThread()
return;
}
gameBar = WINRT_GetGameBar();
- if (!gameBar) {
+ if (gameBar == NULL) {
/* Shouldn't happen, but just in case... */
return;
}
@@ -175,11 +175,11 @@ WINRT_QuitGameBar(_THIS)
{
SDL_VideoData *driverdata;
IGameBarStatics_ *gameBar;
- if (!_this || !_this->driverdata) {
+ if (_this == NULL || _this->driverdata == NULL) {
return;
}
gameBar = WINRT_GetGameBar();
- if (!gameBar) {
+ if (gameBar == NULL) {
return;
}
driverdata = (SDL_VideoData *)_this->driverdata;
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index 7511aa5..aae34b9 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -124,16 +124,16 @@ WINRT_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
- return (0);
+ return 0;
}
data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (!data) {
+ if (data == NULL) {
SDL_OutOfMemory();
SDL_free(device);
- return (0);
+ return 0;
}
device->driverdata = data;
@@ -351,7 +351,7 @@ WINRT_AddDisplaysForOutput (_THIS, IDXGIAdapter1 * dxgiAdapter1, int outputIndex
}
dxgiModes = (DXGI_MODE_DESC *)SDL_calloc(numModes, sizeof(DXGI_MODE_DESC));
- if ( ! dxgiModes) {
+ if (dxgiModes == NULL) {
SDL_OutOfMemory();
goto done;
}
@@ -613,7 +613,7 @@ WINRT_IsCoreWindowActive(CoreWindow ^ coreWindow)
if (coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) {
CoreWindowActivationState activationState = \
safe_cast<CoreWindowActivationState>(coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState"));
- return (activationState != CoreWindowActivationState::Deactivated);
+ return activationState != CoreWindowActivationState::Deactivated;
}
/* Assume that non-SDL tracked windows are active, although this should
diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c
index fd198bd..6bb6ef0 100644
--- a/src/video/x11/SDL_x11clipboard.c
+++ b/src/video/x11/SDL_x11clipboard.c
@@ -217,7 +217,7 @@ GetSlectionText(_THIS, Atom selection_type)
X11_XFree(src);
}
- if (!text) {
+ if (text == NULL) {
text = SDL_strdup("");
}
diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c
index 3c6474a..93747a5 100644
--- a/src/video/x11/SDL_x11dyn.c
+++ b/src/video/x11/SDL_x11dyn.c
@@ -78,8 +78,9 @@ X11_GetSym(const char *fnname, int *pHasModule)
for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
if (x11libs[i].lib != NULL) {
fn = SDL_LoadFunction(x11libs[i].lib, fnname);
- if (fn != NULL)
+ if (fn != NULL) {
break;
+ }
}
}
@@ -90,8 +91,9 @@ X11_GetSym(const char *fnname, int *pHasModule)
printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
#endif
- if (fn == NULL)
- *pHasModule = 0; /* kill this module. */
+ if (fn == NULL) {
+ *pHasModule = 0; /* kill this module. */
+ }
return fn;
}
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 6b6b834..1318824 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -100,7 +100,9 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
int bytes_fetch = 0;
do {
- if (ret != NULL) X11_XFree(ret);
+ if (ret != NULL) {
+ X11_XFree(ret);
+ }
X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
bytes_fetch += bytes_left;
} while (bytes_left != 0);
@@ -134,9 +136,15 @@ static Atom X11_PickTargetFromAtoms(Display *disp, Atom a0, Atom a1, Atom a2)
{
int count=0;
Atom atom[3];
- if (a0 != None) atom[count++] = a0;
- if (a1 != None) atom[count++] = a1;
- if (a2 != None) atom[count++] = a2;
+ if (a0 != None) {
+ atom[count++] = a0;
+ }
+ if (a1 != None) {
+ atom[count++] = a1;
+ }
+ if (a2 != None) {
+ atom[count++] = a2;
+ }
return X11_PickTarget(disp, atom, count);
}
@@ -150,10 +158,9 @@ static Bool X11_KeyRepeatCheckIfEvent(Display *display, XEvent *chkev,
XPointer arg)
{
struct KeyRepeatCheckData *d = (struct KeyRepeatCheckData *) arg;
- if (chkev->type == KeyPress &&
- chkev->xkey.keycode == d->event->xkey.keycode &&
- chkev->xkey.time - d->event->xkey.time < 2)
+ if (chkev->type == KeyPress && chkev->xkey.keycode == d->event->xkey.keycode && chkev->xkey.time - d->event->xkey.time < 2) {
d->found = SDL_TRUE;
+ }
return False;
}
@@ -166,9 +173,9 @@ static SDL_bool X11_KeyRepeat(Display *display, XEvent *event)
struct KeyRepeatCheckData d;
d.event = event;
d.found = SDL_FALSE;
- if (X11_XPending(display))
- X11_XCheckIfEvent(display, &dummyev, X11_KeyRepeatCheckIfEvent,
- (XPointer) &d);
+ if (X11_XPending(display)) {
+ X11_XCheckIfEvent(display, &dummyev, X11_KeyRepeatCheckIfEvent, (XPointer)&d);
+ }
return d.found;
}
@@ -270,8 +277,11 @@ static char* X11_URIToLocal(char* uri) {
char *file = NULL;
SDL_bool local;
- if (SDL_memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
- else if (SDL_strstr(uri,":/") != NULL) return file; /* wrong scheme */
+ if (SDL_memcmp(uri,"file:/",6) == 0) {
+ uri += 6; /* local file? */
+ } else if (SDL_strstr(uri, ":/") != NULL) {
+ return file; /* wrong scheme */
+ }
local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/');
@@ -340,8 +350,8 @@ X11_GetNumLockModifierMask(_THIS)
xmods = X11_XGetModifierMapping(display);
n = xmods->max_keypermod;
- for(i = 3; i < 8; i++) {
- for(j = 0; j < n; j++) {
+ for (i = 3; i < 8; i++) {
+ for (j = 0; j < n; j++) {
KeyCode kc = xmods->modifiermap[i * n + j];
if (viddata->key_layout[kc] == SDL_SCANCODE_NUMLOCKCLEAR) {
num_mask = 1 << i;
@@ -366,8 +376,8 @@ X11_GetScrollLockModifierMask(_THIS)
xmods = X11_XGetModifierMapping(display);
n = xmods->max_keypermod;
- for(i = 3; i < 8; i++) {
- for(j = 0; j < n; j++) {
+ for (i = 3; i < 8; i++) {
+ for (j = 0; j < n; j++) {
KeyCode kc = xmods->modifiermap[i * n + j];
if (viddata->key_layout[kc] == SDL_SCANCODE_SCROLLLOCK) {
num_mask = 1 << i;
@@ -527,8 +537,9 @@ InitiateWindowResize(_THIS, const SDL_WindowData *data, const SDL_Point *point,
Display *display = viddata->display;
XEvent evt;
- if (direction < _NET_WM_MOVERESIZE_SIZE_TOPLEFT || direction > _NET_WM_MOVERESIZE_SIZE_LEFT)
+ if (direction < _NET_WM_MOVERESIZE_SIZE_TOPLEFT || direction > _NET_WM_MOVERESIZE_SIZE_LEFT) {
return;
+ }
/* !!! FIXME: we need to regrab this if necessary when the drag is done. */
X11_XUngrabPointer(display, 0L);
@@ -644,8 +655,9 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
if (req->target == XA_TARGETS) {
supportedFormats[0] = XA_TARGETS;
mime_formats = 1;
- for (i = 0; i < SDL_X11_CLIPBOARD_MIME_TYPE_MAX; ++i)
+ for (i = 0; i < SDL_X11_CLIPBOARD_MIME_TYPE_MAX; ++i) {
supportedFormats[mime_formats++] = X11_GetSDLCutBufferClipboardExternalFormat(display, i);
+ }
X11_XChangeProperty(display, req->requestor, req->property,
XA_ATOM, 32, PropModeReplace,
(unsigned char*)supportedFormats,
@@ -654,8 +666,9 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
sevent.xselection.target = XA_TARGETS;
} else {
for (i = 0; i < SDL_X11_CLIPBOARD_MIME_TYPE_MAX; ++i) {
- if (X11_GetSDLCutBufferClipboardExternalFormat(display, i) != req->target)
+ if (X11_GetSDLCutBufferClipboardExternalFormat(display, i) != req->target) {
continue;
+ }
if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
X11_GetSDLCutBufferClipboardType(display, i, req->selection), 0, INT_MAX/4, False, X11_GetSDLCutBufferClipboardInternalFormat(display, i),
&sevent.xselection.target, &seln_format, &nbytes,
@@ -796,7 +809,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
}
#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
- if(xevent->type == GenericEvent) {
+ if (xevent->type == GenericEvent) {
X11_HandleGenericEvent(videodata, xevent);
return;
}
@@ -839,7 +852,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
}
}
}
- if (!data) {
+ if (data == NULL) {
/* The window for KeymapNotify, etc events is 0 */
if (xevent->type == KeymapNotify) {
#ifdef DEBUG_XEVENTS
@@ -884,7 +897,9 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
}
}
- if (name_of_atom) X11_XFree(name_of_atom);
+ if (name_of_atom) {
+ X11_XFree(name_of_atom);
+ }
}
return;
}
@@ -899,10 +914,12 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
xevent->xcrossing.x,
xevent->xcrossing.y,
xevent->xcrossing.mode);
- if (xevent->xcrossing.mode == NotifyGrab)
+ if (xevent->xcrossing.mode == NotifyGrab) {
printf("Mode: NotifyGrab\n");
- if (xevent->xcrossing.mode == NotifyUngrab)
+ }
+ if (xevent->xcrossing.mode == NotifyUngrab) {
printf("Mode: NotifyUngrab\n");
+ }
#endif
SDL_SetMouseFocus(data->window);
@@ -934,10 +951,12 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
xevent->xcrossing.x,
xevent->xcrossing.y,
xevent->xcrossing.mode);
- if (xevent->xcrossing.mode == NotifyGrab)
+ if (xevent->xcrossing.mode == NotifyGrab) {
printf("Mode: NotifyGrab\n");
- if (xevent->xcrossing.mode == NotifyUngrab)
+ }
+ if (xevent->xcrossing.mode == NotifyUngrab) {
printf("Mode: NotifyUngrab\n");
+ }
#endif
if (!SDL_GetMouse()->relative_mode) {
SDL_SendMouseMotion(data->window, 0, 0, xevent->xcrossing.x, xevent->xcrossing.y);
@@ -977,14 +996,11 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
#ifdef DEBUG_XEVENTS
printf("window %p: FocusIn!\n", data);
#endif
- if (!videodata->last_mode_change_deadline) /* no recent mode changes */
- {
+ if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
data->pending_focus = PENDING_FOCUS_NONE;
data->pending_focus_time = 0;
X11_DispatchFocusIn(_this, data);
- }
- else
- {
+ } else {
data->pending_focus = PENDING_FOCUS_IN;
data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME;
}
@@ -1013,14 +1029,11 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
#ifdef DEBUG_XEVENTS
printf("window %p: FocusOut!\n", data);
#endif
- if (!videodata->last_mode_change_deadline) /* no recent mode changes */
- {
+ if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
data->pending_focus = PENDING_FOCUS_NONE;
data->pending_focus_time = 0;
X11_DispatchFocusOut(_this, data);
- }
- else
- {
+ } else {
data->pending_focus = PENDING_FOCUS_OUT;
data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME;
}
@@ -1070,7 +1083,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
#endif
#ifdef SDL_USE_IME
- if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED));
}
#endif
@@ -1163,7 +1176,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
xevent->xconfigure.x, xevent->xconfigure.y);
#ifdef SDL_USE_IME
- if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
/* Update IME candidate list position */
SDL_IME_UpdateTextRect(NULL);
}
@@ -1206,12 +1219,11 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
/* pick from list of three */
data->xdnd_req = X11_PickTargetFromAtoms(display, xevent->xclient.data.l[2], xevent->xclient.data.l[3], xevent->xclient.data.l[4]);
}
- }
- else if (xevent->xclient.message_type == videodata->XdndPosition) {
+ } else if (xevent->xclient.message_type == videodata->XdndPosition) {
#ifdef DEBUG_XEVENTS
Atom act= videodata->XdndActionCopy;
- if(xdnd_version >= 2) {
+ if (xdnd_version >= 2) {
act = xevent->xclient.data.l[4];
}
printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
@@ -1233,8 +1245,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
X11_XSendEvent(display, xevent->xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
X11_XFlush(display);
- }
- else if(xevent->xclient.message_type == videodata->XdndDrop) {
+ } else if (xevent->xclient.message_type == videodata->XdndDrop) {
if (data->xdnd_req == None) {
/* say again - not interested! */
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
@@ -1249,14 +1260,13 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
X11_XSendEvent(display, xevent->xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
} else {
/* convert */
- if(xdnd_version >= 1) {
+ if (xdnd_version >= 1) {
X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent->xclient.data.l[2]);
} else {
X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
}
}
- }
- else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
+ } else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
(xevent->xclient.format == 32) &&
(xevent->xclient.data.l[0] == videodata->_NET_WM_PING)) {
Window root = DefaultRootWindow(display);
@@ -1278,8 +1288,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
#endif
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
break;
- }
- else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
+ } else if ((xevent->xclient.message_type == videodata->WM_PROTOCOLS) &&
(xevent->xclient.format == 32) &&
(xevent->xclient.data.l[0] == videodata->WM_TAKE_FOCUS)) {
@@ -1303,7 +1312,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
case MotionNotify:{
SDL_Mouse *mouse = SDL_GetMouse();
- if(!mouse->relative_mode || mouse->relative_mode_warp) {
+ if (!mouse->relative_mode || mouse->relative_mode_warp) {
#ifdef DEBUG_MOTION
printf("window %p: X11 motion: %d,%d\n", data, xevent->xmotion.x, xevent->xmotion.y);
#endif
@@ -1323,13 +1332,12 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
} else {
SDL_bool ignore_click = SDL_FALSE;
int button = xevent->xbutton.button;
- if(button == Button1) {
+ if (button == Button1) {
if (ProcessHitTest(_this, data, xevent)) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
break; /* don't pass this event on to app. */
}
- }
- else if(button > 7) {
+ } else if (button > 7) {
/* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ...
=> subtract (8-SDL_BUTTON_X1) to get value SDL expects */
button -= (8-SDL_BUTTON_X1);
@@ -1672,7 +1680,7 @@ X11_WaitEventTimeout(_THIS, int timeout)
X11_DispatchEvent(_this, &xevent);
#ifdef SDL_USE_IME
- if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
SDL_IME_PumpEvents();
}
#endif
@@ -1715,7 +1723,7 @@ X11_PumpEvents(_THIS)
}
#ifdef SDL_USE_IME
- if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
SDL_IME_PumpEvents();
}
#endif
diff --git a/src/video/x11/SDL_x11framebuffer.c b/src/video/x11/SDL_x11framebuffer.c
index 123ad8f..b98d27e 100644
--- a/src/video/x11/SDL_x11framebuffer.c
+++ b/src/video/x11/SDL_x11framebuffer.c
@@ -35,9 +35,9 @@ static int shm_errhandler(Display *d, XErrorEvent *e)
{
if ( e->error_code == BadAccess ) {
shm_error = True;
- return(0);
+ return 0;
} else
- return(X_handler(d,e));
+ return X_handler(d, e);
}
static SDL_bool have_mitshm(Display *dpy)
@@ -95,8 +95,9 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
X11_XShmAttach(display, shminfo);
X11_XSync(display, False);
X11_XSetErrorHandler(X_handler);
- if ( shm_error )
+ if (shm_error) {
shmdt(shminfo->shmaddr);
+ }
} else {
shm_error = True;
}
@@ -160,26 +161,25 @@ X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects,
/* Clipped? */
continue;
}
- if (x < 0)
- {
+ if (x < 0) {
x += w;
w += rects[i].x;
}
- if (y < 0)
- {
+ if (y < 0) {
y += h;
h += rects[i].y;
}
- if (x + w > window->w)
+ if (x + w > window->w) {
w = window->w - x;
- if (y + h > window->h)
+ }
+ if (y + h > window->h) {
h = window->h - y;
+ }
X11_XShmPutImage(display, data->xwindow, data->gc, data->ximage,
x, y, x, y, w, h, False);
}
- }
- else
+ } else
#endif /* !NO_SHARED_MEMORY */
{
for (i = 0; i < numrects; ++i) {
@@ -192,20 +192,20 @@ X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects,
/* Clipped? */
continue;
}
- if (x < 0)
- {
+ if (x < 0) {
x += w;
w += rects[i].x;
}
- if (y < 0)
- {
+ if (y < 0) {
y += h;
h += rects[i].y;
}
- if (x + w > window->w)
+ if (x + w > window->w) {
w = window->w - x;
- if (y + h > window->h)
+ }
+ if (y + h > window->h) {
h = window->h - y;
+ }
X11_XPutImage(display, data->xwindow, data->gc, data->ximage,
x, y, x, y, w, h);
@@ -223,7 +223,7 @@ X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display;
- if (!data) {
+ if (data == NULL) {
/* The window wasn't fully initialized */
return;
}
diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c
index bad2029..edc0147 100644
--- a/src/video/x11/SDL_x11keyboard.c
+++ b/src/video/x11/SDL_x11keyboard.c
@@ -434,7 +434,7 @@ X11_StopTextInput(_THIS)
void
X11_SetTextInputRect(_THIS, const SDL_Rect *rect)
{
- if (!rect) {
+ if (rect == NULL) {
SDL_InvalidParamError("rect");
return;
}
diff --git a/src/video/x11/SDL_x11messagebox.c b/src/video/x11/SDL_x11messagebox.c
index 9bc9702..f7e9170 100644
--- a/src/video/x11/SDL_x11messagebox.c
+++ b/src/video/x11/SDL_x11messagebox.c
@@ -250,7 +250,7 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data )
const int linecount = CountLinesOfText(text);
TextLineData *plinedata = (TextLineData *) SDL_malloc(sizeof (TextLineData) * linecount);
- if (!plinedata) {
+ if (plinedata == NULL) {
return SDL_OutOfMemory();
}
@@ -278,8 +278,9 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data )
text += length + 1;
/* Break if there are no more linefeeds. */
- if ( !lf )
+ if (lf == NULL) {
break;
+ }
}
/* Bump up the text height slightly. */
@@ -632,7 +633,7 @@ X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data )
data->button_press_index = -1; /* Reset what button is currently depressed. */
data->mouse_over_index = -1; /* Reset what button the mouse is over. */
- while( !close_dialog ) {
+ while ( !close_dialog ) {
XEvent e;
SDL_bool draw = SDL_TRUE;
@@ -642,8 +643,9 @@ X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data )
/* If X11_XFilterEvent returns True, then some input method has filtered the
event, and the client should discard the event. */
- if ( ( e.type != Expose ) && X11_XFilterEvent( &e, None ) )
+ if ((e.type != Expose) && X11_XFilterEvent(&e, None)) {
continue;
+ }
switch( e.type ) {
case Expose:
@@ -693,13 +695,15 @@ X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data )
KeySym key = X11_XLookupKeysym( &e.xkey, 0 );
/* If this is a key release for something we didn't get the key down for, then bail. */
- if ( key != last_key_pressed )
+ if (key != last_key_pressed) {
break;
+ }
- if ( key == XK_Escape )
+ if ( key == XK_Escape ) {
mask = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
- else if ( ( key == XK_Return ) || ( key == XK_KP_Enter ) )
+ } else if ((key == XK_Return) || (key == XK_KP_Enter)) {
mask = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
+ }
if ( mask ) {
int i;
@@ -763,8 +767,9 @@ X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid)
SDL_zero(data);
- if ( !SDL_X11_LoadSymbols() )
+ if (!SDL_X11_LoadSymbols()) {
return -1;
+ }
#if SDL_SET_LOCALE
origlocale = setlocale(LC_ALL, NULL);
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index da63afd..ce7c218 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -333,7 +333,7 @@ X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScre
}
output_info = X11_XRRGetOutputInfo(dpy, res, outputid);
- if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) {
+ if (output_info == NULL || !output_info->crtc || output_info->connection == RR_Disconnected) {
X11_XRRFreeOutputInfo(output_info);
return 0; /* ignore this one. */
}
@@ -345,7 +345,7 @@ X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScre
X11_XRRFreeOutputInfo(output_info);
crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc);
- if (!crtc) {
+ if (crtc == NULL) {
return 0; /* oh well, ignore it. */
}
@@ -361,12 +361,12 @@ X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScre
X11_XRRFreeCrtcInfo(crtc);
displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
- if (!displaydata) {
+ if (displaydata == NULL) {
return SDL_OutOfMemory();
}
modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
- if (!modedata) {
+ if (modedata == NULL) {
SDL_free(displaydata);
return SDL_OutOfMemory();
}
@@ -436,7 +436,7 @@ X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent *ev)
XVisualInfo vinfo;
if (get_visualinfo(dpy, screen, &vinfo) == 0) {
XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen));
- if (!res || res->noutput == 0) {
+ if (res == NULL || res->noutput == 0) {
if (res) {
X11_XRRFreeScreenResources(res);
}
@@ -495,13 +495,13 @@ X11_InitModes_XRandR(_THIS)
}
res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen));
- if (!res || res->noutput == 0) {
+ if (res == NULL || res->noutput == 0) {
if (res) {
X11_XRRFreeScreenResources(res);
}
res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen));
- if (!res) {
+ if (res == NULL) {
continue;
}
}
@@ -540,7 +540,7 @@ GetXftDPI(Display* dpy)
xdefault_resource = X11_XGetDefault(dpy, "Xft", "dpi");
- if(!xdefault_resource) {
+ if (xdefault_resource == NULL) {
return 0;
}
@@ -593,12 +593,12 @@ static int X11_InitModes_StdXlib(_THIS)
mode.refresh_rate = 0; /* don't know it, sorry. */
displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
- if (!displaydata) {
+ if (displaydata == NULL) {
return SDL_OutOfMemory();
}
modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
- if (!modedata) {
+ if (modedata == NULL) {
SDL_free(displaydata);
return SDL_OutOfMemory();
}
@@ -615,7 +615,7 @@ static int X11_InitModes_StdXlib(_THIS)
displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f);
xft_dpi = GetXftDPI(dpy);
- if(xft_dpi > 0) {
+ if (xft_dpi > 0) {
displaydata->hdpi = (float)xft_dpi;
displaydata->vdpi = (float)xft_dpi;
}
@@ -700,7 +700,7 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
if (output_info && output_info->connection != RR_Disconnected) {
for (i = 0; i < output_info->nmode; ++i) {
modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
- if (!modedata) {
+ if (modedata == NULL) {
continue;
}
mode.driverdata = modedata;
@@ -769,18 +769,18 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode
Status status;
res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen));
- if (!res) {
+ if (res == NULL) {
return SDL_SetError("Couldn't get XRandR screen resources");
}
output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output);
- if (!output_info || output_info->connection == RR_Disconnected) {
+ if (output_info == NULL || output_info->connection == RR_Disconnected) {
X11_XRRFreeScreenResources(res);
return SDL_SetError("Couldn't get XRandR output info");
}
crtc = X11_XRRGetCrtcInfo(display, res, output_info->crtc);
- if (!crtc) {
+ if (crtc == NULL) {
X11_XRRFreeOutputInfo(output_info);
X11_XRRFreeScreenResources(res);
return SDL_SetError("Couldn't get XRandR crtc info");
diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c
index 96a25a2..2e6dd07 100644
--- a/src/video/x11/SDL_x11mouse.c
+++ b/src/video/x11/SDL_x11mouse.c
@@ -94,7 +94,7 @@ X11_CreateXCursorCursor(SDL_Surface * surface, int hot_x, int hot_y)
XcursorImage *image;
image = X11_XcursorImageCreate(surface->w, surface->h);
- if (!image) {
+ if (image == NULL) {
SDL_OutOfMemory();
return None;
}
@@ -128,13 +128,13 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
unsigned int width_bytes = ((surface->w + 7) & ~7) / 8;
data_bits = SDL_calloc(1, surface->h * width_bytes);
- if (!data_bits) {
+ if (data_bits == NULL) {
SDL_OutOfMemory();
return None;
}
mask_bits = SDL_calloc(1, surface->h * width_bytes);
- if (!mask_bits) {
+ if (mask_bits == NULL) {
SDL_free(data_bits);
SDL_OutOfMemory();
return None;
@@ -175,15 +175,13 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
fg.red = rfg * 257 / fgBits;
fg.green = gfg * 257 / fgBits;
fg.blue = bfg * 257 / fgBits;
- }
- else fg.red = fg.green = fg.blue = 0;
+ } else fg.red = fg.green = fg.blue = 0;
if (bgBits) {
bg.red = rbg * 257 / bgBits;
bg.green = gbg * 257 / bgBits;
bg.blue = bbg * 257 / bgBits;
- }
- else bg.red = bg.green = bg.blue = 0;
+ } else bg.red = bg.green = bg.blue = 0;
data_pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display),
(char*)data_bits,
@@ -360,8 +358,9 @@ static int
X11_SetRelativeMouseMode(SDL_bool enabled)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2
- if(X11_Xinput2IsInitialized())
+ if (X11_Xinput2IsInitialized()) {
return 0;
+ }
#else
SDL_Unsupported();
#endif
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 60b2203..aafaa2f 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -307,13 +307,15 @@ HasExtension(const char *extension, const char *extensions)
const char *start;
const char *where, *terminator;
- if (!extensions)
+ if (!extensions) {
return SDL_FALSE;
+ }
/* Extension names should not have spaces. */
where = SDL_strchr(extension, ' ');
- if (where || *extension == '\0')
+ if (where || *extension == '\0') {
return SDL_FALSE;
+ }
/* It takes a bit of care to be fool-proof about parsing the
* OpenGL extensions string. Don't be fooled by sub-strings,
@@ -323,13 +325,16 @@ HasExtension(const char *extension, const char *extensions)
for (;;) {
where = SDL_strstr(start, extension);
- if (!where)
+ if (!where) {
break;
+ }
terminator = where + SDL_strlen(extension);
- if (where == start || *(where - 1) == ' ')
- if (*terminator == ' ' || *terminator == '\0')
+ if (where == start || *(where - 1) == ' ') {
+ if (*terminator == ' ' || *terminator == '\0') {
return SDL_TRUE;
+ }
+ }
start = terminator;
}
@@ -500,7 +505,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
SDL_assert(size >= MAX_ATTRIBUTES);
/* Setup our GLX attributes according to the gl_config. */
- if( for_FBConfig ) {
+ if ( for_FBConfig ) {
attribs[i++] = GLX_RENDER_TYPE;
if (_this->gl_config.floatbuffers) {
attribs[i++] = GLX_RGBA_FLOAT_BIT_ARB;
@@ -524,7 +529,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
if (_this->gl_config.double_buffer) {
attribs[i++] = GLX_DOUBLEBUFFER;
- if( for_FBConfig ) {
+ if ( for_FBConfig ) {
attribs[i++] = True;
}
}
@@ -559,7 +564,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
if (_this->gl_config.stereo) {
attribs[i++] = GLX_STEREO;
- if( for_FBConfig ) {
+ if ( for_FBConfig ) {
attribs[i++] = True;
}
}
@@ -669,18 +674,14 @@ X11_GL_ErrorHandler(Display * d, XErrorEvent * e)
char x11_error_locale[256];
errorCode = e->error_code;
- if (X11_XGetErrorText(d, errorCode, x11_error_locale, sizeof(x11_error_locale)) == Success)
- {
+ if (X11_XGetErrorText(d, errorCode, x11_error_locale, sizeof(x11_error_locale)) == Success) {
x11_error = SDL_iconv_string("UTF-8", "", x11_error_locale, SDL_strlen(x11_error_locale)+1);
}
- if (x11_error)
- {
+ if (x11_error) {
SDL_SetError("Could not %s: %s", errorHandlerOperation, x11_error);
SDL_free(x11_error);
- }
- else
- {
+ } else {
SDL_SetError("Could not %s: %i (Base %i)", errorHandlerOperation, errorCode, errorBase);
}
@@ -752,19 +753,19 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
int iattr = 4;
/* SDL profile bits match GLX profile bits */
- if( _this->gl_config.profile_mask != 0 ) {
+ if ( _this->gl_config.profile_mask != 0 ) {
attribs[iattr++] = GLX_CONTEXT_PROFILE_MASK_ARB;
attribs[iattr++] = _this->gl_config.profile_mask;
}
/* SDL flags match GLX flags */
- if( _this->gl_config.flags != 0 ) {
+ if ( _this->gl_config.flags != 0 ) {
attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
attribs[iattr++] = _this->gl_config.flags;
}
/* only set if glx extension is available */
- if( _this->gl_data->HAS_GLX_ARB_context_flush_control ) {
+ if ( _this->gl_data->HAS_GLX_ARB_context_flush_control ) {
attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB;
attribs[iattr++] =
_this->gl_config.release_behavior ?
@@ -773,7 +774,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
}
/* only set if glx extension is available */
- if( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) {
+ if ( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) {
attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
attribs[iattr++] =
_this->gl_config.reset_notification ?
@@ -782,7 +783,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
}
/* only set if glx extension is available */
- if( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) {
+ if ( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) {
attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB;
attribs[iattr++] = _this->gl_config.no_error;
}
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
index 7d4e32c..fe28845 100644
--- a/src/video/x11/SDL_x11shape.c
+++ b/src/video/x11/SDL_x11shape.c
@@ -35,7 +35,7 @@ X11_CreateShaper(SDL_Window* window) {
#if SDL_VIDEO_DRIVER_X11_XSHAPE
if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
result = SDL_malloc(sizeof(SDL_WindowShaper));
- if (!result) {
+ if (result == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -44,7 +44,7 @@ X11_CreateShaper(SDL_Window* window) {
result->mode.parameters.binarizationCutoff = 1;
result->userx = result->usery = 0;
data = SDL_malloc(sizeof(SDL_ShapeData));
- if (!data) {
+ if (data == NULL) {
SDL_free(result);
SDL_OutOfMemory();
return NULL;
@@ -71,14 +71,15 @@ X11_ResizeWindowShape(SDL_Window* window) {
unsigned int bitmapsize = window->w / 8;
SDL_assert(data != NULL);
- if(window->w % 8 > 0)
+ if (window->w % 8 > 0) {
bitmapsize += 1;
+ }
bitmapsize *= window->h;
- if(data->bitmapsize != bitmapsize || data->bitmap == NULL) {
+ if (data->bitmapsize != bitmapsize || data->bitmap == NULL) {
data->bitmapsize = bitmapsize;
SDL_free(data->bitmap);
data->bitmap = SDL_malloc(data->bitmapsize);
- if(data->bitmap == NULL) {
+ if (data->bitmap == NULL) {
return SDL_OutOfMemory();
}
}
@@ -97,14 +98,17 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo
SDL_WindowData *windowdata = NULL;
Pixmap shapemask;
- if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
+ if (shaper == NULL || shape == NULL || shaper->driverdata == NULL) {
return -1;
+ }
#if SDL_VIDEO_DRIVER_X11_XSHAPE
- if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode))
+ if (shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode)) {
return -2;
- if(shape->w != shaper->window->w || shape->h != shaper->window->h)
+ }
+ if (shape->w != shaper->window->w || shape->h != shaper->window->h) {
return -3;
+ }
data = shaper->driverdata;
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index 49f5c5b..42d3f9e 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -167,19 +167,19 @@ X11_CreateDevice(void)
/* Open the display first to be sure that X11 is available */
x11_display = X11_XOpenDisplay(display);
- if (!x11_display) {
+ if (x11_display == NULL) {
SDL_X11_UnloadSymbols();
return NULL;
}
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
- if (!device) {
+ if (device == NULL) {
SDL_OutOfMemory();
return NULL;
}
data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (!data) {
+ if (data == NULL) {
SDL_free(device);
SDL_OutOfMemory();
return NULL;
@@ -339,9 +339,9 @@ static int
X11_CheckWindowManagerErrorHandler(Display * d, XErrorEvent * e)
{
if (e->error_code == BadWindow) {
- return (0);
+ return 0;
} else {
- return (handler(d, e));
+ return handler(d, e);
}
}
diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c
index b9eb34b..2bdce98 100644
--- a/src/video/x11/SDL_x11vulkan.c
+++ b/src/video/x11/SDL_x11vulkan.c
@@ -51,73 +51,76 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path)
SDL_bool hasXCBSurfaceExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
Uint32 i;
- if(_this->vulkan_config.loader_handle)
+ if (_this->vulkan_config.loader_handle) {
return SDL_SetError("Vulkan already loaded");
+ }
/* Load the Vulkan loader library */
- if(!path)
+ if (path == NULL) {
path = SDL_getenv("SDL_VULKAN_LIBRARY");
- if(!path)
+ }
+ if (path == NULL) {
path = DEFAULT_VULKAN;
+ }
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
- if(!_this->vulkan_config.loader_handle)
+ if (!_this->vulkan_config.loader_handle) {
return -1;
+ }
SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path));
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
- if(!vkGetInstanceProcAddr)
+ if (!vkGetInstanceProcAddr) {
goto fail;
+ }
_this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
(void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
- if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
+ }
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
(PFN_vkEnumerateInstanceExtensionProperties)
_this->vulkan_config.vkEnumerateInstanceExtensionProperties,
&extensionCount);
- if(!extensions)
+ if (extensions == NULL) {
goto fail;
- for(i = 0; i < extensionCount; i++)
+ }
+ for (i = 0; i < extensionCount; i++)
{
- if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasXCBSurfaceExtension = SDL_TRUE;
- else if(SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ } else if (SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
hasXlibSurfaceExtension = SDL_TRUE;
+ }
}
SDL_free(extensions);
- if(!hasSurfaceExtension)
- {
+ if (!hasSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement the "
VK_KHR_SURFACE_EXTENSION_NAME " extension");
goto fail;
}
- if(hasXlibSurfaceExtension)
- {
+ if (hasXlibSurfaceExtension) {
videoData->vulkan_xlib_xcb_library = NULL;
- }
- else if(!hasXCBSurfaceExtension)
- {
+ } else if (!hasXCBSurfaceExtension) {
SDL_SetError("Installed Vulkan doesn't implement either the "
VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the "
VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension");
goto fail;
- }
- else
- {
+ } else {
const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY");
- if(!libX11XCBLibraryName)
+ if (libX11XCBLibraryName == NULL) {
libX11XCBLibraryName = "libX11-xcb.so";
+ }
videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName);
- if(!videoData->vulkan_xlib_xcb_library)
+ if (!videoData->vulkan_xlib_xcb_library) {
goto fail;
+ }
videoData->vulkan_XGetXCBConnection =
SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection");
- if(!videoData->vulkan_XGetXCBConnection)
- {
+ if (!videoData->vulkan_XGetXCBConnection) {
SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
goto fail;
}
@@ -133,10 +136,10 @@ fail:
void X11_Vulkan_UnloadLibrary(_THIS)
{
SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
- if(_this->vulkan_config.loader_handle)
- {
- if(videoData->vulkan_xlib_xcb_library)
+ if (_this->vulkan_config.loader_handle) {
+ if (videoData->vulkan_xlib_xcb_library) {
SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
+ }
SDL_UnloadObject(_this->vulkan_config.loader_handle);
_this->vulkan_config.loader_handle = NULL;
}
@@ -148,21 +151,17 @@ SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS,
const char **names)
{
SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
- if(videoData->vulkan_xlib_xcb_library)
- {
+ if (videoData->vulkan_xlib_xcb_library) {
static const char *const extensionsForXCB[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME,
};
return SDL_Vulkan_GetInstanceExtensions_Helper(
count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB);
- }
- else
- {
+ } else {
static const char *const extensionsForXlib[] = {
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
};
@@ -179,21 +178,18 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
- if(!_this->vulkan_config.loader_handle)
- {
+ if (!_this->vulkan_config.loader_handle) {
SDL_SetError("Vulkan is not loaded");
return SDL_FALSE;
}
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
- if(videoData->vulkan_xlib_xcb_library)
- {
+ if (videoData->vulkan_xlib_xcb_library) {
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXcbSurfaceKHR");
VkXcbSurfaceCreateInfoKHR createInfo;
VkResult result;
- if(!vkCreateXcbSurfaceKHR)
- {
+ if (!vkCreateXcbSurfaceKHR) {
SDL_SetError(VK_KHR_XCB_SURFACE_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
@@ -201,30 +197,25 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display);
- if(!createInfo.connection)
- {
+ if (!createInfo.connection) {
SDL_SetError("XGetXCBConnection failed");
return SDL_FALSE;
}
createInfo.window = (xcb_window_t)windowData->xwindow;
result = vkCreateXcbSurfaceKHR(instance, &createInfo,
NULL, surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateXcbSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result));
return SDL_FALSE;
}
return SDL_TRUE;
- }
- else
- {
+ } else {
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXlibSurfaceKHR");
VkXlibSurfaceCreateInfoKHR createInfo;
VkResult result;
- if(!vkCreateXlibSurfaceKHR)
- {
+ if (!vkCreateXlibSurfaceKHR) {
SDL_SetError(VK_KHR_XLIB_SURFACE_EXTENSION_NAME
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
@@ -235,8 +226,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
createInfo.window = (xcb_window_t)windowData->xwindow;
result = vkCreateXlibSurfaceKHR(instance, &createInfo,
NULL, surface);
- if(result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_SetError("vkCreateXlibSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result));
return SDL_FALSE;
}
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 6d4e53f..4c5d5de 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -102,10 +102,8 @@ X11_IsActionAllowed(SDL_Window *window, Atom action)
Atom *list;
SDL_bool ret = SDL_FALSE;
- if (X11_XGetWindowProperty(display, data->xwindow, _NET_WM_ALLOWED_ACTIONS, 0, 1024, False, XA_ATOM, &type, &form, &len, &remain, (unsigned char **)&list) == Success)
- {
- for (i=0; i<len; ++i)
- {
+ if (X11_XGetWindowProperty(display, data->xwindow, _NET_WM_ALLOWED_ACTIONS, 0, 1024, False, XA_ATOM, &type, &form, &len, &remain, (unsigned char **)&list) == Success) {
+ for (i=0; i<len; ++i) {
if (list[i] == action) {
ret = SDL_TRUE;
break;
@@ -265,7 +263,7 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
/* Allocate the window data */
data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
- if (!data) {
+ if (data == NULL) {
return SDL_OutOfMemory();
}
data->window = window;
@@ -292,7 +290,7 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
(SDL_WindowData **) SDL_realloc(windowlist,
(numwindows +
1) * sizeof(*windowlist));
- if (!windowlist) {
+ if (windowlist == NULL) {
SDL_free(data);
return SDL_OutOfMemory();
}
@@ -326,8 +324,7 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
Window FocalWindow;
int RevertTo=0;
X11_XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
- if (FocalWindow==w)
- {
+ if (FocalWindow==w) {
window->flags |= SDL_WINDOW_INPUT_FOCUS;
}
@@ -405,8 +402,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL
const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID);
- if (forced_visual_id != NULL && forced_visual_id[0] != '\0')
- {
+ if (forced_visual_id != NULL && forced_visual_id[0] != '\0') {
XVisualInfo *vi, template;
int nvis;
@@ -417,13 +413,10 @@ X11_CreateWindow(_THIS, SDL_Window * window)
visual = vi->visual;
depth = vi->depth;
X11_XFree(vi);
- }
- else
- {
+ } else {
return -1;
}
- }
- else if ((window->flags & SDL_WINDOW_OPENGL) &&
+ } else if ((window->flags & SDL_WINDOW_OPENGL) &&
!SDL_getenv("SDL_VIDEO_X11_VISUALID")) {
XVisualInfo *vinfo = NULL;
@@ -443,7 +436,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
#endif
}
- if (!vinfo) {
+ if (vinfo == NULL) {
return -1;
}
visual = vinfo->visual;
@@ -480,7 +473,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
/* OK, we got a colormap, now fill it in as best as we can */
colorcells = SDL_malloc(visual->map_entries * sizeof(XColor));
- if (!colorcells) {
+ if (colorcells == NULL) {
return SDL_OutOfMemory();
}
ncolors = visual->map_entries;
@@ -1031,7 +1024,7 @@ X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
if (opacity == 1.0f) {
X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY);
- } else {
+ } else {
const Uint32 FullyOpaque = 0xFFFFFFFF;
const long alpha = (long) ((double)opacity * (double)FullyOpaque);
X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32,
@@ -1180,8 +1173,9 @@ X11_ShowWindow(_THIS, SDL_Window * window)
/* Blocking wait for "MapNotify" event.
* We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
* and XCheckTypedWindowEvent doesn't block */
- if(!(window->flags & SDL_WINDOW_FOREIGN))
+ if (!(window->flags & SDL_WINDOW_FOREIGN)) {
X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
+ }
X11_XFlush(display);
}
@@ -1204,8 +1198,9 @@ X11_HideWindow(_THIS, SDL_Window * window)
if (X11_IsWindowMapped(_this, window)) {
X11_XWithdrawWindow(display, data->xwindow, displaydata->screen);
/* Blocking wait for "UnmapNotify" event */
- if(!(window->flags & SDL_WINDOW_FOREIGN))
+ if (!(window->flags & SDL_WINDOW_FOREIGN)) {
X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
+ }
X11_XFlush(display);
}
}
@@ -1562,7 +1557,9 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
int bytes_fetch = 0;
do {
- if (ret != NULL) X11_XFree(ret);
+ if (ret != NULL) {
+ X11_XFree(ret);
+ }
X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
bytes_fetch += bytes_left;
} while (bytes_left != 0);
@@ -1611,7 +1608,7 @@ X11_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size)
}
ret_icc_profile_data = SDL_malloc(real_nitems);
- if (!ret_icc_profile_data) {
+ if (ret_icc_profile_data == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -1766,7 +1763,7 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display;
- if (!data) {
+ if (data == NULL) {
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
SDL_SetError("Window not initialized");
return SDL_FALSE;
@@ -1816,7 +1813,7 @@ X11_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation)
XWMHints *wmhints;
wmhints = X11_XGetWMHints(display, data->xwindow);
- if (!wmhints) {
+ if (wmhints == NULL) {
return SDL_SetError("Couldn't get WM hints");
}
diff --git a/src/video/x11/SDL_x11xfixes.c b/src/video/x11/SDL_x11xfixes.c
index 95027d4..dfe3a4c 100644
--- a/src/video/x11/SDL_x11xfixes.c
+++ b/src/video/x11/SDL_x11xfixes.c
@@ -35,13 +35,13 @@ query_xfixes_version(Display *display, int major, int minor)
{
/* We don't care if this fails, so long as it sets major/minor on it's way out the door. */
X11_XFixesQueryVersion(display, &major, &minor);
- return ((major * 1000) + minor);
+ return (major * 1000) + minor;
}
static SDL_bool
xfixes_version_atleast(const int version, const int wantmajor, const int wantminor)
{
- return (version >= ((wantmajor * 1000) + wantminor));
+ return version >= ((wantmajor * 1000) + wantminor);
}
void
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index db3187b..a23e587 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -46,8 +46,9 @@ static void parse_valuators(const double *input_values, const unsigned char *mas
double *output_values,int output_values_len) {
int i = 0,z = 0;
int top = mask_len * 8;
- if (top > MAX_AXIS)
+ if (top > MAX_AXIS) {
top = MAX_AXIS;
+ }
SDL_memset(output_values,0,output_values_len * sizeof(double));
for (; i < top && z < output_values_len; i++) {
@@ -65,13 +66,13 @@ query_xinput2_version(Display *display, int major, int minor)
{
/* We don't care if this fails, so long as it sets major/minor on it's way out the door. */
X11_XIQueryVersion(display, &major, &minor);
- return ((major * 1000) + minor);
+ return (major * 1000) + minor;
}
static SDL_bool
xinput2_version_atleast(const int version, const int wantmajor, const int wantminor)
{
- return ( version >= ((wantmajor * 1000) + wantminor) );
+ return version >= ((wantmajor * 1000) + wantminor);
}
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
@@ -232,13 +233,13 @@ xinput2_get_device_info(SDL_VideoData *videodata, const int device_id)
/* don't know about this device yet, query and cache it. */
devinfo = (SDL_XInput2DeviceInfo *) SDL_calloc(1, sizeof (SDL_XInput2DeviceInfo));
- if (!devinfo) {
+ if (devinfo == NULL) {
SDL_OutOfMemory();
return NULL;
}
xidevinfo = X11_XIQueryDevice(videodata->display, device_id, &i);
- if (!xidevinfo) {
+ if (xidevinfo == NULL) {
SDL_free(devinfo);
return NULL;
}
@@ -292,7 +293,7 @@ X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie)
}
devinfo = xinput2_get_device_info(videodata, rawev->deviceid);
- if (!devinfo) {
+ if (devinfo == NULL) {
return 0; /* oh well. */
}
@@ -417,8 +418,9 @@ X11_InitXinput2Multitouch(_THIS)
XITouchClassInfo *t = (XITouchClassInfo*)class;
/* Only touch devices */
- if (class->type != XITouchClass)
+ if (class->type != XITouchClass) {
continue;
+ }
if (t->mode == XIDependentTouch) {
touchType = SDL_TOUCH_DEVICE_INDIRECT_RELATIVE;
diff --git a/test/checkkeys.c b/test/checkkeys.c
index 9167c5c..de827f8 100644
--- a/test/checkkeys.c
+++ b/test/checkkeys.c
@@ -68,30 +68,42 @@ print_modifiers(char **text, size_t *maxlen)
print_string(text, maxlen, " (none)");
return;
}
- if (mod & KMOD_LSHIFT)
+ if (mod & KMOD_LSHIFT) {
print_string(text, maxlen, " LSHIFT");
- if (mod & KMOD_RSHIFT)
+ }
+ if (mod & KMOD_RSHIFT) {
print_string(text, maxlen, " RSHIFT");
- if (mod & KMOD_LCTRL)
+ }
+ if (mod & KMOD_LCTRL) {
print_string(text, maxlen, " LCTRL");
- if (mod & KMOD_RCTRL)
+ }
+ if (mod & KMOD_RCTRL) {
print_string(text, maxlen, " RCTRL");
- if (mod & KMOD_LALT)
+ }
+ if (mod & KMOD_LALT) {
print_string(text, maxlen, " LALT");
- if (mod & KMOD_RALT)
+ }
+ if (mod & KMOD_RALT) {
print_string(text, maxlen, " RALT");
- if (mod & KMOD_LGUI)
+ }
+ if (mod & KMOD_LGUI) {
print_string(text, maxlen, " LGUI");
- if (mod & KMOD_RGUI)
+ }
+ if (mod & KMOD_RGUI) {
print_string(text, maxlen, " RGUI");
- if (mod & KMOD_NUM)
+ }
+ if (mod & KMOD_NUM) {
print_string(text, maxlen, " NUM");
- if (mod & KMOD_CAPS)
+ }
+ if (mod & KMOD_CAPS) {
print_string(text, maxlen, " CAPS");
- if (mod & KMOD_MODE)
+ }
+ if (mod & KMOD_MODE) {
print_string(text, maxlen, " MODE");
- if (mod & KMOD_SCROLL)
+ }
+ if (mod & KMOD_SCROLL) {
print_string(text, maxlen, " SCROLL");
+ }
}
static void
@@ -147,8 +159,7 @@ PrintText(const char *eventtype, const char *text)
char expanded[1024];
expanded[0] = '\0';
- for ( spot = text; *spot; ++spot )
- {
+ for ( spot = text; *spot; ++spot ) {
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
@@ -253,21 +264,21 @@ main(int argc, char *argv[])
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
/* Set 640x480 video mode */
window = SDL_CreateWindow("CheckKeys Test",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, 0);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
SDL_GetError());
quit(2);
}
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n",
SDL_GetError());
quit(2);
@@ -298,7 +309,7 @@ main(int argc, char *argv[])
#endif
SDL_Quit();
- return (0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c
index 0716d0f..00fb71b 100644
--- a/test/checkkeysthreads.c
+++ b/test/checkkeysthreads.c
@@ -64,30 +64,42 @@ print_modifiers(char **text, size_t *maxlen)
print_string(text, maxlen, " (none)");
return;
}
- if (mod & KMOD_LSHIFT)
+ if (mod & KMOD_LSHIFT) {
print_string(text, maxlen, " LSHIFT");
- if (mod & KMOD_RSHIFT)
+ }
+ if (mod & KMOD_RSHIFT) {
print_string(text, maxlen, " RSHIFT");
- if (mod & KMOD_LCTRL)
+ }
+ if (mod & KMOD_LCTRL) {
print_string(text, maxlen, " LCTRL");
- if (mod & KMOD_RCTRL)
+ }
+ if (mod & KMOD_RCTRL) {
print_string(text, maxlen, " RCTRL");
- if (mod & KMOD_LALT)
+ }
+ if (mod & KMOD_LALT) {
print_string(text, maxlen, " LALT");
- if (mod & KMOD_RALT)
+ }
+ if (mod & KMOD_RALT) {
print_string(text, maxlen, " RALT");
- if (mod & KMOD_LGUI)
+ }
+ if (mod & KMOD_LGUI) {
print_string(text, maxlen, " LGUI");
- if (mod & KMOD_RGUI)
+ }
+ if (mod & KMOD_RGUI) {
print_string(text, maxlen, " RGUI");
- if (mod & KMOD_NUM)
+ }
+ if (mod & KMOD_NUM) {
print_string(text, maxlen, " NUM");
- if (mod & KMOD_CAPS)
+ }
+ if (mod & KMOD_CAPS) {
print_string(text, maxlen, " CAPS");
- if (mod & KMOD_MODE)
+ }
+ if (mod & KMOD_MODE) {
print_string(text, maxlen, " MODE");
- if (mod & KMOD_SCROLL)
+ }
+ if (mod & KMOD_SCROLL) {
print_string(text, maxlen, " SCROLL");
+ }
}
static void
@@ -144,8 +156,7 @@ PrintText(const char *eventtype, const char *text)
char expanded[1024];
expanded[0] = '\0';
- for ( spot = text; *spot; ++spot )
- {
+ for ( spot = text; *spot; ++spot ) {
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
@@ -235,14 +246,14 @@ main(int argc, char *argv[])
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
/* Set 640x480 video mode */
window = SDL_CreateWindow("CheckKeys Test",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, 0);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
SDL_GetError());
quit(2);
@@ -280,7 +291,7 @@ main(int argc, char *argv[])
SDL_WaitThread(thread, NULL);
SDL_Quit();
- return (0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/controllermap.c b/test/controllermap.c
index 22ab19e..e418136 100644
--- a/test/controllermap.c
+++ b/test/controllermap.c
@@ -199,8 +199,7 @@ SetCurrentBinding(int iBinding)
return;
}
- if (s_arrBindingOrder[iBinding] == -1)
- {
+ if (s_arrBindingOrder[iBinding] == -1) {
SetCurrentBinding(iBinding + 1);
return;
}
@@ -227,8 +226,7 @@ SetCurrentBinding(int iBinding)
static SDL_bool
BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const SDL_GameControllerExtendedBind *pBindingB)
{
- if (pBindingA->bindType != pBindingB->bindType)
- {
+ if (pBindingA->bindType != pBindingB->bindType) {
return SDL_FALSE;
}
switch (pBindingA->bindType)
@@ -245,7 +243,7 @@ BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const S
int maxA = SDL_max(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max);
int minB = SDL_min(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max);
int maxB = SDL_max(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max);
- return (minA <= minB && maxA >= maxB);
+ return minA <= minB && maxA >= maxB;
}
/* Not reached */
default:
diff --git a/test/loopwave.c b/test/loopwave.c
index 1b5fa95..026c8e6 100644
--- a/test/loopwave.c
+++ b/test/loopwave.c
@@ -107,8 +107,9 @@ static int done = 0;
void
loop()
{
- if(done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING))
+ if (done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) {
emscripten_cancel_main_loop();
+ }
}
#endif
@@ -124,7 +125,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_EVENTS) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
@@ -178,7 +179,7 @@ main(int argc, char *argv[])
SDL_FreeWAV(wave.sound);
SDL_free(filename);
SDL_Quit();
- return (0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c
index 1996d78..8893e3b 100644
--- a/test/loopwavequeue.c
+++ b/test/loopwavequeue.c
@@ -56,8 +56,7 @@ loop()
#ifdef __EMSCRIPTEN__
if (done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) {
emscripten_cancel_main_loop();
- }
- else
+ } else
#endif
{
/* The device from SDL_OpenAudio() is always device #1. */
@@ -84,7 +83,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
@@ -135,8 +134,7 @@ main(int argc, char *argv[])
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(loop, 0, 1);
#else
- while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING))
- {
+ while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) {
loop();
SDL_Delay(100); /* let it play for awhile. */
diff --git a/test/testatomic.c b/test/testatomic.c
index 9efbb29..ffb11c6 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -25,8 +25,7 @@ tf(SDL_bool _tf)
static const char *t = "TRUE";
static const char *f = "FALSE";
- if (_tf)
- {
+ if (_tf) {
return t;
}
@@ -142,11 +141,13 @@ void runAdder(void)
SDL_AtomicSet(&threadsRunning, NThreads);
- while (T--)
+ while (T--) {
SDL_CreateThread(adder, "Adder", NULL);
+ }
- while (SDL_AtomicGet(&threadsRunning) > 0)
+ while (SDL_AtomicGet(&threadsRunning) > 0) {
SDL_SemWait(threadDone);
+ }
SDL_DestroySemaphore(threadDone);
diff --git a/test/testaudiocapture.c b/test/testaudiocapture.c
index 03d3732..0a91703 100644
--- a/test/testaudiocapture.c
+++ b/test/testaudiocapture.c
@@ -101,7 +101,7 @@ main(int argc, char **argv)
/* Load the SDL library */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c
index dc84a78..1b906e7 100644
--- a/test/testaudiohotplug.c
+++ b/test/testaudiohotplug.c
@@ -90,8 +90,9 @@ iteration()
if (e.type == SDL_QUIT) {
done = 1;
} else if (e.type == SDL_KEYUP) {
- if (e.key.keysym.sym == SDLK_ESCAPE)
+ if (e.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
+ }
} else if (e.type == SDL_AUDIODEVICEADDED) {
int index = e.adevice.which;
int iscapture = e.adevice.iscapture;
@@ -127,7 +128,7 @@ iteration()
void
loop()
{
- if(done)
+ if (done)
emscripten_cancel_main_loop();
else
iteration();
@@ -146,7 +147,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
/* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */
@@ -201,7 +202,7 @@ main(int argc, char *argv[])
SDL_FreeWAV(sound);
SDL_free(filename);
SDL_Quit();
- return (0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c
index 9e3bfcd..d2ea229 100644
--- a/test/testaudioinfo.c
+++ b/test/testaudioinfo.c
@@ -57,7 +57,7 @@ main(int argc, char **argv)
/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
/* Print available audio drivers */
diff --git a/test/testautomation.c b/test/testautomation.c
index 5f469db..0245d11 100644
--- a/test/testautomation.c
+++ b/test/testautomation.c
@@ -42,7 +42,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
@@ -56,23 +56,22 @@ main(int argc, char *argv[])
if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
if (argv[i + 1]) {
testIterations = SDL_atoi(argv[i + 1]);
- if (testIterations < 1) testIterations = 1;
+ if (testIterations < 1) {
+ testIterations = 1;
+ }
consumed = 2;
}
- }
- else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
+ } else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
if (argv[i + 1]) {
SDL_sscanf(argv[i + 1], "%"SDL_PRIu64, &userExecKey);
consumed = 2;
}
- }
- else if (SDL_strcasecmp(argv[i], "--seed") == 0) {
+ } else if (SDL_strcasecmp(argv[i], "--seed") == 0) {
if (argv[i + 1]) {
userRunSeed = SDL_strdup(argv[i + 1]);
consumed = 2;
}
- }
- else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
+ } else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
if (argv[i + 1]) {
filter = SDL_strdup(argv[i + 1]);
consumed = 2;
@@ -105,7 +104,7 @@ main(int argc, char *argv[])
/* Empty event queue */
done = 0;
- for (i=0; i<100; i++) {
+ for (i=0; i<100; i++) {
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
}
@@ -118,7 +117,7 @@ main(int argc, char *argv[])
/* Shutdown everything */
quit(result);
- return(result);
+ return result;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c
index e6127b5..86eb875 100644
--- a/test/testautomation_audio.c
+++ b/test/testautomation_audio.c
@@ -461,8 +461,7 @@ int audio_printAudioDrivers()
SDLTest_AssertCheck(n>=0, "Verify number of audio drivers >= 0, got: %i", n);
/* List drivers. */
- if (n>0)
- {
+ if (n>0) {
for (i=0; i<n; i++) {
name = SDL_GetAudioDriver(i);
SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
@@ -712,7 +711,9 @@ int audio_openCloseAndGetAudioStatus()
device = SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
- if (device == NULL) return TEST_ABORTED;
+ if (device == NULL) {
+ return TEST_ABORTED;
+ }
/* Set standard desired spec */
desired.freq=22050;
@@ -770,7 +771,9 @@ int audio_lockUnlockOpenAudioDevice()
device = SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
- if (device == NULL) return TEST_ABORTED;
+ if (device == NULL) {
+ return TEST_ABORTED;
+ }
/* Set standard desired spec */
desired.freq=22050;
@@ -878,7 +881,9 @@ int audio_convertAudio()
SDLTest_LogError("%s", SDL_GetError());
} else {
SDLTest_AssertCheck(cvt.len_mult > 0, "Verify that cvt.len_mult value; expected: >0, got: %i", cvt.len_mult);
- if (cvt.len_mult < 1) return TEST_ABORTED;
+ if (cvt.len_mult < 1) {
+ return TEST_ABORTED;
+ }
/* Create some random data to convert */
l = 64;
@@ -887,7 +892,9 @@ int audio_convertAudio()
cvt.len = l;
cvt.buf = (Uint8 *)SDL_malloc(ll);
SDLTest_AssertCheck(cvt.buf != NULL, "Check data buffer to convert is not NULL");
- if (cvt.buf == NULL) return TEST_ABORTED;
+ if (cvt.buf == NULL) {
+ return TEST_ABORTED;
+ }
/* Convert the data */
result = SDL_ConvertAudio(&cvt);
@@ -932,7 +939,9 @@ int audio_openCloseAudioDeviceConnected()
device = SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
- if (device == NULL) return TEST_ABORTED;
+ if (device == NULL) {
+ return TEST_ABORTED;
+ }
/* Set standard desired spec */
desired.freq=22050;
diff --git a/test/testautomation_mouse.c b/test/testautomation_mouse.c
index f833480..d9cd4f0 100644
--- a/test/testautomation_mouse.c
+++ b/test/testautomation_mouse.c
@@ -230,7 +230,9 @@ mouse_createFreeColorCursor(void *arg)
/* Get sample surface */
face = SDLTest_ImageFace();
SDLTest_AssertCheck(face != NULL, "Validate sample input image is not NULL");
- if (face == NULL) return TEST_ABORTED;
+ if (face == NULL) {
+ return TEST_ABORTED;
+ }
/* Create a color cursor from surface */
cursor = SDL_CreateColorCursor(face, 0, 0);
@@ -466,7 +468,9 @@ mouse_warpMouseInWindow(void *arg)
yPositions[5] = h+1;
/* Create test window */
window = _createMouseSuiteTestWindow();
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Mouse to random position inside window */
x = SDLTest_RandomIntegerInRange(1, w-1);
@@ -518,7 +522,9 @@ mouse_getMouseFocus(void *arg)
/* Create test window */
window = _createMouseSuiteTestWindow();
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Mouse to random position inside window */
x = SDLTest_RandomIntegerInRange(1, w-1);
diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c
index 8117c11..a61959e 100644
--- a/test/testautomation_pixels.c
+++ b/test/testautomation_pixels.c
@@ -352,7 +352,7 @@ pixels_allocFreePalette(void *arg)
if (result->ncolors > 0) {
SDLTest_AssertCheck(result->colors != NULL, "Verify value of result.colors is not NULL");
if (result->colors != NULL) {
- for(i = 0; i < result->ncolors; i++) {
+ for (i = 0; i < result->ncolors; i++) {
SDLTest_AssertCheck(result->colors[i].r == 255, "Verify value of result.colors[%d].r; expected: 255, got %u", i, result->colors[i].r);
SDLTest_AssertCheck(result->colors[i].g == 255, "Verify value of result.colors[%d].g; expected: 255, got %u", i, result->colors[i].g);
SDLTest_AssertCheck(result->colors[i].b == 255, "Verify value of result.colors[%d].b; expected: 255, got %u", i, result->colors[i].b);
diff --git a/test/testautomation_platform.c b/test/testautomation_platform.c
index e866148..466ee5d 100644
--- a/test/testautomation_platform.c
+++ b/test/testautomation_platform.c
@@ -305,8 +305,7 @@ int platform_testGetSetClearError(void *arg)
SDLTest_AssertPass("SDL_GetError()");
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == 0,
"SDL_GetError(): no message expected, len: %i", (int) len);
@@ -318,8 +317,7 @@ int platform_testGetSetClearError(void *arg)
lastError = (char *)SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == SDL_strlen(testError),
"SDL_GetError(): expected message len %i, was len: %i",
@@ -356,8 +354,7 @@ int platform_testSetErrorEmptyInput(void *arg)
lastError = (char *)SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == SDL_strlen(testError),
"SDL_GetError(): expected message len %i, was len: %i",
@@ -405,8 +402,7 @@ int platform_testSetErrorInvalidInput(void *arg)
lastError = (char *)SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == 0 || SDL_strcmp(lastError, "(null)") == 0,
"SDL_GetError(): expected message len 0, was len: %i",
@@ -425,8 +421,7 @@ int platform_testSetErrorInvalidInput(void *arg)
lastError = (char *)SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == 0 || SDL_strcmp( lastError, "(null)" ) == 0,
"SDL_GetError(): expected message len 0, was len: %i",
@@ -444,8 +439,7 @@ int platform_testSetErrorInvalidInput(void *arg)
lastError = (char *)SDL_GetError();
SDLTest_AssertCheck(lastError != NULL,
"SDL_GetError() != NULL");
- if (lastError != NULL)
- {
+ if (lastError != NULL) {
len = SDL_strlen(lastError);
SDLTest_AssertCheck(len == SDL_strlen(probeError),
"SDL_GetError(): expected message len %i, was len: %i",
@@ -493,8 +487,7 @@ int platform_testGetPowerInfo(void *arg)
"SDL_GetPowerInfo(): state %i is one of the expected values",
(int)state);
- if (state==SDL_POWERSTATE_ON_BATTERY)
- {
+ if (state==SDL_POWERSTATE_ON_BATTERY) {
SDLTest_AssertCheck(
secs >= 0,
"SDL_GetPowerInfo(): on battery, secs >= 0, was: %i",
diff --git a/test/testautomation_rect.c b/test/testautomation_rect.c
index 729ff29..853f544 100644
--- a/test/testautomation_rect.c
+++ b/test/testautomation_rect.c
@@ -1009,10 +1009,18 @@ int rect_testEnclosePoints(void *arg)
miny = newy;
maxy = newy;
} else {
- if (newx < minx) minx = newx;
- if (newx > maxx) maxx = newx;
- if (newy < miny) miny = newy;
- if (newy > maxy) maxy = newy;
+ if (newx < minx) {
+ minx = newx;
+ }
+ if (newx > maxx) {
+ maxx = newx;
+ }
+ if (newy < miny) {
+ miny = newy;
+ }
+ if (newy > maxy) {
+ maxy = newy;
+ }
}
}
@@ -1085,10 +1093,18 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
miny = newy;
maxy = newy;
} else {
- if (newx < minx) minx = newx;
- if (newx > maxx) maxx = newx;
- if (newy < miny) miny = newy;
- if (newy > maxy) maxy = newy;
+ if (newx < minx) {
+ minx = newx;
+ }
+ if (newx > maxx) {
+ maxx = newx;
+ }
+ if (newy < miny) {
+ miny = newy;
+ }
+ if (newy > maxy) {
+ maxy = newy;
+ }
}
}
@@ -1165,10 +1181,18 @@ int rect_testEnclosePointsWithClipping(void *arg)
miny = newy;
maxy = newy;
} else {
- if (newx < minx) minx = newx;
- if (newx > maxx) maxx = newx;
- if (newy < miny) miny = newy;
- if (newy > maxy) maxy = newy;
+ if (newx < minx) {
+ minx = newx;
+ }
+ if (newx > maxx) {
+ maxx = newx;
+ }
+ if (newy < miny) {
+ miny = newy;
+ }
+ if (newy > maxy) {
+ maxy = newy;
+ }
}
expectedEnclosed = SDL_TRUE;
}
@@ -1305,10 +1329,18 @@ int rect_testUnionRectOutside(void *arg)
refRectB.w=refRectA.w - 2;
refRectB.h=refRectA.h - 2;
expectedResult = refRectA;
- if (dx == -1) expectedResult.x--;
- if (dy == -1) expectedResult.y--;
- if ((dx == 1) || (dx == -1)) expectedResult.w++;
- if ((dy == 1) || (dy == -1)) expectedResult.h++;
+ if (dx == -1) {
+ expectedResult.x--;
+ }
+ if (dy == -1) {
+ expectedResult.y--;
+ }
+ if ((dx == 1) || (dx == -1)) {
+ expectedResult.w++;
+ }
+ if ((dy == 1) || (dy == -1)) {
+ expectedResult.h++;
+ }
rectA = refRectA;
rectB = refRectB;
SDL_UnionRect(&rectA, &rectB, &result);
@@ -1433,10 +1465,18 @@ int rect_testUnionRectInside(void *arg)
refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
refRectB = refRectA;
- if (dx == -1) refRectB.x++;
- if ((dx == 1) || (dx == -1)) refRectB.w--;
- if (dy == -1) refRectB.y++;
- if ((dy == 1) || (dy == -1)) refRectB.h--;
+ if (dx == -1) {
+ refRectB.x++;
+ }
+ if ((dx == 1) || (dx == -1)) {
+ refRectB.w--;
+ }
+ if (dy == -1) {
+ refRectB.y++;
+ }
+ if ((dy == 1) || (dy == -1)) {
+ refRectB.h--;
+ }
expectedResult = refRectA;
rectA = refRectA;
rectB = refRectB;
diff --git a/test/testautomation_render.c b/test/testautomation_render.c
index 52da1bf..6989a02 100644
--- a/test/testautomation_render.c
+++ b/test/testautomation_render.c
@@ -151,10 +151,14 @@ int render_testPrimitives (void *arg)
for (y=0; y<3; y++) {
for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
ret = SDL_RenderDrawPoint(renderer, x, y );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
@@ -281,16 +285,22 @@ int render_testPrimitivesBlend (void *arg)
checkFailCount1 = 0;
checkFailCount2 = 0;
checkFailCount3 = 0;
- for (i=0; i<TESTRENDER_SCREEN_W; i+=2) {
+ for (i=0; i<TESTRENDER_SCREEN_W; i+=2) {
ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
- if (ret != 0) checkFailCount3++;
+ if (ret != 0) {
+ checkFailCount3++;
+ }
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
@@ -299,16 +309,22 @@ int render_testPrimitivesBlend (void *arg)
checkFailCount1 = 0;
checkFailCount2 = 0;
checkFailCount3 = 0;
- for (i=0; i<TESTRENDER_SCREEN_H; i+=2) {
+ for (i=0; i<TESTRENDER_SCREEN_H; i+=2) {
ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
(((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
- if (ret != 0) checkFailCount3++;
+ if (ret != 0) {
+ checkFailCount3++;
+ }
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
@@ -321,14 +337,20 @@ int render_testPrimitivesBlend (void *arg)
for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
ret = SDL_RenderDrawPoint(renderer, i, j );
- if (ret != 0) checkFailCount3++;
+ if (ret != 0) {
+ checkFailCount3++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
@@ -399,7 +421,9 @@ render_testBlit(void *arg)
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
@@ -466,13 +490,17 @@ render_testBlitColor (void *arg)
for (i=0; i <= ni; i+=4) {
/* Set color mod. */
ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
@@ -543,13 +571,17 @@ render_testBlitAlpha (void *arg)
for (i=0; i <= ni; i+=4) {
/* Set alpha mod. */
ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
@@ -608,13 +640,17 @@ _testBlitBlendMode( SDL_Texture * tface, int mode )
for (i=0; i <= ni; i+=4) {
/* Set blend mode. */
ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
@@ -727,26 +763,39 @@ render_testBlitBlend (void *arg)
/* Set color mod. */
ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
/* Set alpha mod. */
ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
- if (ret != 0) checkFailCount2++;
+ if (ret != 0) {
+ checkFailCount2++;
+ }
/* Crazy blending mode magic. */
mode = (i/4*j/4) % 4;
- if (mode==0) mode = SDL_BLENDMODE_NONE;
- else if (mode==1) mode = SDL_BLENDMODE_BLEND;
- else if (mode==2) mode = SDL_BLENDMODE_ADD;
- else if (mode==3) mode = SDL_BLENDMODE_MOD;
+ if (mode==0) {
+ mode = SDL_BLENDMODE_NONE;
+ } else if (mode==1) {
+ mode = SDL_BLENDMODE_BLEND;
+ } else if (mode==2) {
+ mode = SDL_BLENDMODE_ADD;
+ } else if (mode == 3) {
+ mode = SDL_BLENDMODE_MOD;
+ }
ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
- if (ret != 0) checkFailCount3++;
+ if (ret != 0) {
+ checkFailCount3++;
+ }
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
- if (ret != 0) checkFailCount4++;
+ if (ret != 0) {
+ checkFailCount4++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
@@ -777,7 +826,7 @@ render_testBlitBlend (void *arg)
static int
_isSupported( int code )
{
- return (code == 0);
+ return code == 0;
}
/**
@@ -797,24 +846,28 @@ _hasDrawColor (void)
/* Set color. */
ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
/* Restore natural. */
ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
/* Something failed, consider not available. */
- if (fail)
+ if (fail) {
return 0;
-
+ }
/* Not set properly, consider failed. */
- else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
+ else if ((r != 100) || (g != 100) || (b != 100) || (a != 100)) {
return 0;
+ }
return 1;
}
@@ -835,41 +888,53 @@ _hasBlendModes (void)
fail = 0;
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = (mode != SDL_BLENDMODE_BLEND);
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = (mode != SDL_BLENDMODE_ADD);
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = (mode != SDL_BLENDMODE_MOD);
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = (mode != SDL_BLENDMODE_NONE);
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
return !fail;
}
@@ -921,25 +986,29 @@ _hasTexColor (void)
/* Get test face. */
tface = _loadTestFace();
- if (tface == NULL)
+ if (tface == NULL) {
return 0;
+ }
/* See if supported. */
fail = 0;
ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
/* Clean up. */
SDL_DestroyTexture( tface );
- if (fail)
+ if (fail) {
return 0;
- else if ((r != 100) || (g != 100) || (b != 100))
+ } else if ((r != 100) || (g != 100) || (b != 100)) {
return 0;
+ }
return 1;
}
@@ -961,25 +1030,29 @@ _hasTexAlpha(void)
/* Get test face. */
tface = _loadTestFace();
- if (tface == NULL)
+ if (tface == NULL) {
return 0;
+ }
/* See if supported. */
fail = 0;
ret = SDL_SetTextureAlphaMod( tface, 100 );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
ret = SDL_GetTextureAlphaMod( tface, &a );
- if (!_isSupported(ret))
+ if (!_isSupported(ret)) {
fail = 1;
+ }
/* Clean up. */
SDL_DestroyTexture( tface );
- if (fail)
+ if (fail) {
return 0;
- else if (a != 100)
+ } else if (a != 100) {
return 0;
+ }
return 1;
}
@@ -1004,7 +1077,9 @@ _compare(SDL_Surface *referenceSurface, int allowable_error)
/* Read pixels. */
pixels = (Uint8 *)SDL_malloc(4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H);
SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
- if (pixels == NULL) return;
+ if (pixels == NULL) {
+ return;
+ }
/* Explicitly specify the rect in case the window isn't the expected size... */
rect.x = 0;
diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c
index 687ff75..200917a 100644
--- a/test/testautomation_rwops.c
+++ b/test/testautomation_rwops.c
@@ -47,7 +47,9 @@ RWopsSetUp(void *arg)
/* Create a test file */
handle = fopen(RWopsReadTestFilename, "w");
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
- if (handle == NULL) return;
+ if (handle == NULL) {
+ return;
+ }
/* Write some known text into it */
fileLen = SDL_strlen(RWopsHelloWorldTestString);
@@ -59,7 +61,9 @@ RWopsSetUp(void *arg)
/* Create a second test file */
handle = fopen(RWopsAlphabetFilename, "w");
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsAlphabetFilename);
- if (handle == NULL) return;
+ if (handle == NULL) {
+ return;
+ }
/* Write alphabet text into it */
fileLen = SDL_strlen(RWopsAlphabetString);
@@ -114,8 +118,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write)
SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
if (write) {
SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int) s);
- }
- else {
+ } else {
SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int) s);
}
@@ -236,7 +239,9 @@ rwops_testMem (void)
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
/* Bail out if NULL */
- if (rw == NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY, rw->type);
@@ -272,7 +277,9 @@ rwops_testConstMem (void)
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
/* Bail out if NULL */
- if (rw == NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Check type */
SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_MEMORY_RO, rw->type);
@@ -308,7 +315,9 @@ rwops_testFileRead(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
/* Bail out if NULL */
- if (rw == NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Check type */
#if defined(__ANDROID__)
@@ -355,7 +364,9 @@ rwops_testFileWrite(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
/* Bail out if NULL */
- if (rw == NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Check type */
#if defined(__ANDROID__)
@@ -502,7 +513,9 @@ rwops_testAllocFree (void)
SDL_RWops *rw = SDL_AllocRW();
SDLTest_AssertPass("Call to SDL_AllocRW() succeeded");
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_AllocRW() is not NULL");
- if (rw==NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Check type */
SDLTest_AssertCheck(
@@ -538,8 +551,7 @@ rwops_testCompareRWFromMemWithRWFromFile(void)
int result;
- for (size=5; size<10; size++)
- {
+ for (size=5; size<10; size++) {
/* Terminate buffer */
buffer_file[slen] = 0;
buffer_mem[slen] = 0;
@@ -652,7 +664,9 @@ rwops_testFileWriteReadEndian(void)
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
/* Bail out if NULL */
- if (rw == NULL) return TEST_ABORTED;
+ if (rw == NULL) {
+ return TEST_ABORTED;
+ }
/* Write test data */
objectsWritten = SDL_WriteBE16(rw, BE16value);
diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c
index 7abad36..dca4d7c 100644
--- a/test/testautomation_stdlib.c
+++ b/test/testautomation_stdlib.c
@@ -191,7 +191,7 @@ stdlib_getsetenv(void *arg)
/* Create a random name. This tests SDL_getenv, since we need to */
/* make sure the variable is not set yet (it shouldn't). */
do {
- for(counter = 0; counter < nameLen; counter++) {
+ for (counter = 0; counter < nameLen; counter++) {
name[counter] = (char)SDLTest_RandomIntegerInRange(65, 90);
}
name[nameLen] = '\0';
diff --git a/test/testautomation_surface.c b/test/testautomation_surface.c
index 9b38066..5479c60 100644
--- a/test/testautomation_surface.c
+++ b/test/testautomation_surface.c
@@ -110,12 +110,16 @@ void _testBlitBlendMode(int mode)
/* Check test surface */
SDLTest_AssertCheck(testSurface != NULL, "Verify testSurface is not NULL");
- if (testSurface == NULL) return;
+ if (testSurface == NULL) {
+ return;
+ }
/* Create sample surface */
face = SDLTest_ImageFace();
SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
- if (face == NULL) return;
+ if (face == NULL) {
+ return;
+ }
/* Reset alpha modulation */
ret = SDL_SetSurfaceAlphaMod(face, 255);
@@ -160,14 +164,16 @@ void _testBlitBlendMode(int mode)
if (mode == -2) {
/* Set color mod. */
ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
- if (ret != 0) checkFailCount2++;
- }
- else if (mode == -3) {
+ if (ret != 0) {
+ checkFailCount2++;
+ }
+ } else if (mode == -3) {
/* Set alpha mod. */
ret = SDL_SetSurfaceAlphaMod( face, (255/ni)*i );
- if (ret != 0) checkFailCount3++;
- }
- else if (mode == -4) {
+ if (ret != 0) {
+ checkFailCount3++;
+ }
+ } else if (mode == -4) {
/* Crazy blending mode magic. */
nmode = (i/4*j/4) % 4;
if (nmode==0) {
@@ -184,14 +190,18 @@ void _testBlitBlendMode(int mode)
return;
}
ret = SDL_SetSurfaceBlendMode( face, bmode );
- if (ret != 0) checkFailCount4++;
+ if (ret != 0) {
+ checkFailCount4++;
+ }
}
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_BlitSurface( face, NULL, testSurface, &rect );
- if (ret != 0) checkFailCount1++;
+ if (ret != 0) {
+ checkFailCount1++;
+ }
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
@@ -231,7 +241,9 @@ surface_testSaveLoadBitmap(void *arg)
/* Create sample surface */
face = SDLTest_ImageFace();
SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
- if (face == NULL) return TEST_ABORTED;
+ if (face == NULL) {
+ return TEST_ABORTED;
+ }
/* Delete test file; ignore errors */
unlink(sampleFilename);
@@ -275,8 +287,9 @@ surface_testSurfaceConversion(void *arg)
/* Create sample surface */
face = SDLTest_ImageFace();
SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
- if (face == NULL)
+ if (face == NULL) {
return TEST_ABORTED;
+ }
/* Set transparent pixel as the pixel at (0,0) */
if (face->format->palette) {
@@ -346,8 +359,9 @@ surface_testCompleteSurfaceConversion(void *arg)
/* Create sample surface */
face = SDLTest_ImageFace();
SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
- if (face == NULL)
+ if (face == NULL) {
return TEST_ABORTED;
+ }
/* Set transparent pixel as the pixel at (0,0) */
if (face->format->palette) {
@@ -756,8 +770,7 @@ surface_testOverflow(void *arg)
SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
- }
- else {
+ } else {
SDLTest_Log("Can't easily overflow size_t on this platform");
}
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index 8d248bf..fe8c4f0 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -836,7 +836,9 @@ video_getSetWindowGrab(void *arg)
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Get state */
originalMouseState = SDL_GetWindowMouseGrab(window);
@@ -980,7 +982,9 @@ video_getWindowId(void *arg)
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Get ID */
id = SDL_GetWindowID(window);
@@ -1034,7 +1038,9 @@ video_getWindowPixelFormat(void *arg)
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Get format */
format = SDL_GetWindowPixelFormat(window);
@@ -1072,7 +1078,9 @@ video_getSetWindowPosition(void *arg)
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
for (xVariation = 0; xVariation < 4; xVariation++) {
for (yVariation = 0; yVariation < 4; yVariation++) {
@@ -1222,11 +1230,15 @@ video_getSetWindowSize(void *arg)
result = SDL_GetDisplayBounds(0, &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
- if (result != 0) return TEST_ABORTED;
+ if (result != 0) {
+ return TEST_ABORTED;
+ }
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
#ifdef __WIN32__
/* Platform clips window size to screen size */
@@ -1386,11 +1398,15 @@ video_getSetWindowMinimumSize(void *arg)
result = SDL_GetDisplayBounds(0, &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
- if (result != 0) return TEST_ABORTED;
+ if (result != 0) {
+ return TEST_ABORTED;
+ }
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
for (wVariation = 0; wVariation < 5; wVariation++) {
for (hVariation = 0; hVariation < 5; hVariation++) {
@@ -1525,11 +1541,15 @@ video_getSetWindowMaximumSize(void *arg)
result = SDL_GetDisplayBounds(0, &display);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
- if (result != 0) return TEST_ABORTED;
+ if (result != 0) {
+ return TEST_ABORTED;
+ }
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
for (wVariation = 0; wVariation < 3; wVariation++) {
for (hVariation = 0; hVariation < 3; hVariation++) {
@@ -1667,7 +1687,9 @@ video_getSetWindowData(void *arg)
/* Call against new test window */
window = _createVideoSuiteTestWindow(title);
- if (window == NULL) return TEST_ABORTED;
+ if (window == NULL) {
+ return TEST_ABORTED;
+ }
/* Create testdata */
datasize = SDLTest_RandomIntegerInRange(1, 32);
@@ -1879,14 +1901,16 @@ video_setWindowCenteredOnDisplay(void *arg)
result = SDL_GetDisplayBounds(0 % displayNum, &display0);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
- if (result != 0)
+ if (result != 0) {
return TEST_ABORTED;
+ }
result = SDL_GetDisplayBounds(1 % displayNum, &display1);
SDLTest_AssertPass("SDL_GetDisplayBounds()");
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
- if (result != 0)
+ if (result != 0) {
return TEST_ABORTED;
+ }
for (xVariation = 0; xVariation < 2; xVariation++) {
for (yVariation = 0; yVariation < 2; yVariation++) {
diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c
index b3ffdbc..d63a38a 100644
--- a/test/testcustomcursor.c
+++ b/test/testcustomcursor.c
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
@@ -293,7 +293,7 @@ main(int argc, char *argv[])
quit(0);
/* keep the compiler happy ... */
- return(0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testdisplayinfo.c b/test/testdisplayinfo.c
index 297632c..89cdbfd 100644
--- a/test/testdisplayinfo.c
+++ b/test/testdisplayinfo.c
@@ -20,8 +20,9 @@
static void
print_mode(const char *prefix, const SDL_DisplayMode *mode)
{
- if (!mode)
+ if (mode == NULL) {
return;
+ }
SDL_Log("%s: fmt=%s w=%d h=%d refresh=%d\n",
prefix, SDL_GetPixelFormatName(mode->format),
diff --git a/test/testdraw2.c b/test/testdraw2.c
index 0df5ba3..e4be559 100644
--- a/test/testdraw2.c
+++ b/test/testdraw2.c
@@ -190,8 +190,9 @@ loop()
}
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
@@ -232,7 +233,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c
index f3636f3..682b5b7 100644
--- a/test/testdrawchessboard.c
+++ b/test/testdrawchessboard.c
@@ -37,11 +37,11 @@ DrawChessBoard()
/* Get the Size of drawing surface */
SDL_RenderGetViewport(renderer, &darea);
- for( ; row < 8; row++)
+ for ( ; row < 8; row++)
{
column = row%2;
x = column;
- for( ; column < 4+(row%2); column++)
+ for ( ; column < 4+(row%2); column++)
{
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
@@ -104,8 +104,7 @@ main(int argc, char *argv[])
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize SDL */
- if(SDL_Init(SDL_INIT_VIDEO) != 0)
- {
+ if (SDL_Init(SDL_INIT_VIDEO) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
return 1;
}
@@ -113,15 +112,13 @@ main(int argc, char *argv[])
/* Create window and renderer for given surface */
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
- if(!window)
- {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
return 1;
}
surface = SDL_GetWindowSurface(window);
renderer = SDL_CreateSoftwareRenderer(surface);
- if(!renderer)
- {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
return 1;
}
diff --git a/test/testdropfile.c b/test/testdropfile.c
index 9521247..a2ce5f9 100644
--- a/test/testdropfile.c
+++ b/test/testdropfile.c
@@ -36,7 +36,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
@@ -93,7 +93,7 @@ main(int argc, char *argv[])
quit(0);
/* keep the compiler happy ... */
- return(0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testerror.c b/test/testerror.c
index c118abd..8992ad5 100644
--- a/test/testerror.c
+++ b/test/testerror.c
@@ -38,7 +38,7 @@ ThreadFunc(void *data)
SDL_Delay(1 * 1000);
}
SDL_Log("Child thread error string: %s\n", SDL_GetError());
- return (0);
+ return 0;
}
int
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(0) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
/* Set the error value for the main thread */
@@ -78,5 +78,5 @@ main(int argc, char *argv[])
SDL_Log("Main thread error string: %s\n", SDL_GetError());
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testevdev.c b/test/testevdev.c
index 22465ff..b762f23 100644
--- a/test/testevdev.c
+++ b/test/testevdev.c
@@ -998,8 +998,7 @@ run_test(void)
if (actual == t->expected) {
printf("\tOK\n");
- }
- else {
+ } else {
printf("\tExpected 0x%08x\n", t->expected);
for (j = 0; device_classes[j].code != 0; j++) {
diff --git a/test/testfile.c b/test/testfile.c
index 25a3092..752cddb 100644
--- a/test/testfile.c
+++ b/test/testfile.c
@@ -76,20 +76,25 @@ main(int argc, char *argv[])
/* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
rwops = SDL_RWFromFile(NULL, NULL);
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile(NULL, "ab+");
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile("something", "");
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile("something", NULL);
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
SDL_Log("test1 OK\n");
/* test 2 : check that inexistent file is not successfully opened/created when required */
@@ -98,29 +103,35 @@ main(int argc, char *argv[])
*/
rwops = SDL_RWFromFile(FBASENAME2, "rb"); /* this file doesn't exist that call must fail */
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile(FBASENAME2, "rb+"); /* this file doesn't exist that call must fail */
- if (rwops)
+ if (rwops) {
RWOP_ERR_QUIT(rwops);
+ }
rwops = SDL_RWFromFile(FBASENAME2, "wb");
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
unlink(FBASENAME2);
rwops = SDL_RWFromFile(FBASENAME2, "wb+");
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
unlink(FBASENAME2);
rwops = SDL_RWFromFile(FBASENAME2, "ab");
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
unlink(FBASENAME2);
rwops = SDL_RWFromFile(FBASENAME2, "ab+");
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
unlink(FBASENAME2);
SDL_Log("test2 OK\n");
@@ -129,153 +140,220 @@ main(int argc, char *argv[])
test : w mode, r mode, w+ mode
*/
rwops = SDL_RWFromFile(FBASENAME1, "wb"); /* write only */
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->write(rwops, "1234567890", 10, 1))
+ }
+ if (1 != rwops->write(rwops, "1234567890", 10, 1)) {
RWOP_ERR_QUIT(rwops);
- if (10 != rwops->write(rwops, "1234567890", 1, 10))
+ }
+ if (10 != rwops->write(rwops, "1234567890", 1, 10)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->write(rwops, "1234567", 1, 7))
+ }
+ if (7 != rwops->write(rwops, "1234567", 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 1, 1))
- RWOP_ERR_QUIT(rwops); /* we are in write only mode */
+ }
+ if (0 != rwops->read(rwops, test_buf, 1, 1)) {
+ RWOP_ERR_QUIT(rwops); /* we are in write only mode */
+ }
+
rwops->close(rwops);
rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exists */
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (20 != rwops->seek(rwops, -7, RW_SEEK_END))
+ }
+ if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->read(rwops, test_buf, 1, 7))
+ }
+ if (7 != rwops->read(rwops, test_buf, 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "1234567", 7))
+ }
+ if (SDL_memcmp(test_buf, "1234567", 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 1, 1))
+ }
+ if (0 != rwops->read(rwops, test_buf, 1, 1)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 10, 100))
+ }
+ if (0 != rwops->read(rwops, test_buf, 10, 100)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR))
+ }
+ if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops);
- if (2 != rwops->read(rwops, test_buf, 10, 3))
+ }
+ if (2 != rwops->read(rwops, test_buf, 10, 3)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "12345678901234567890", 20))
+ }
+ if (SDL_memcmp(test_buf, "12345678901234567890", 20)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->write(rwops, test_buf, 1, 1))
- RWOP_ERR_QUIT(rwops); /* readonly mode */
+ }
+ if (0 != rwops->write(rwops, test_buf, 1, 1)) {
+ RWOP_ERR_QUIT(rwops); /* readonly mode */
+ }
+
rwops->close(rwops);
/* test 3: same with w+ mode */
rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->write(rwops, "1234567890", 10, 1))
+ }
+ if (1 != rwops->write(rwops, "1234567890", 10, 1)) {
RWOP_ERR_QUIT(rwops);
- if (10 != rwops->write(rwops, "1234567890", 1, 10))
+ }
+ if (10 != rwops->write(rwops, "1234567890", 1, 10)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->write(rwops, "1234567", 1, 7))
+ }
+ if (7 != rwops->write(rwops, "1234567", 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->read(rwops, test_buf, 1, 1))
- RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (1 != rwops->read(rwops, test_buf, 1, 1)) {
+ RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
+ }
+
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (20 != rwops->seek(rwops, -7, RW_SEEK_END))
+ }
+ if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->read(rwops, test_buf, 1, 7))
+ }
+ if (7 != rwops->read(rwops, test_buf, 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "1234567", 7))
+ }
+ if (SDL_memcmp(test_buf, "1234567", 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 1, 1))
+ }
+ if (0 != rwops->read(rwops, test_buf, 1, 1)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 10, 100))
+ }
+ if (0 != rwops->read(rwops, test_buf, 10, 100)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR))
+ }
+ if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops);
- if (2 != rwops->read(rwops, test_buf, 10, 3))
+ }
+ if (2 != rwops->read(rwops, test_buf, 10, 3)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "12345678901234567890", 20))
+ }
+ if (SDL_memcmp(test_buf, "12345678901234567890", 20)) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
SDL_Log("test3 OK\n");
/* test 4: same in r+ mode */
rwops = SDL_RWFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->write(rwops, "1234567890", 10, 1))
+ }
+ if (1 != rwops->write(rwops, "1234567890", 10, 1)) {
RWOP_ERR_QUIT(rwops);
- if (10 != rwops->write(rwops, "1234567890", 1, 10))
+ }
+ if (10 != rwops->write(rwops, "1234567890", 1, 10)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->write(rwops, "1234567", 1, 7))
+ }
+ if (7 != rwops->write(rwops, "1234567", 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->read(rwops, test_buf, 1, 1))
- RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (1 != rwops->read(rwops, test_buf, 1, 1)) {
+ RWOP_ERR_QUIT(rwops); /* we are in read/write mode */
+ }
+
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (20 != rwops->seek(rwops, -7, RW_SEEK_END))
+ }
+ if (20 != rwops->seek(rwops, -7, RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->read(rwops, test_buf, 1, 7))
+ }
+ if (7 != rwops->read(rwops, test_buf, 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "1234567", 7))
+ }
+ if (SDL_memcmp(test_buf, "1234567", 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 1, 1))
+ }
+ if (0 != rwops->read(rwops, test_buf, 1, 1)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 10, 100))
+ }
+ if (0 != rwops->read(rwops, test_buf, 10, 100)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR))
+ }
+ if (0 != rwops->seek(rwops, -27, RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops);
- if (2 != rwops->read(rwops, test_buf, 10, 3))
+ }
+ if (2 != rwops->read(rwops, test_buf, 10, 3)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "12345678901234567890", 20))
+ }
+ if (SDL_memcmp(test_buf, "12345678901234567890", 20)) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
SDL_Log("test4 OK\n");
/* test5 : append mode */
rwops = SDL_RWFromFile(FBASENAME1, "ab+"); /* write + read + append */
- if (!rwops)
+ if (rwops == NULL) {
RWOP_ERR_QUIT(rwops);
- if (1 != rwops->write(rwops, "1234567890", 10, 1))
+ }
+ if (1 != rwops->write(rwops, "1234567890", 10, 1)) {
RWOP_ERR_QUIT(rwops);
- if (10 != rwops->write(rwops, "1234567890", 1, 10))
+ }
+ if (10 != rwops->write(rwops, "1234567890", 1, 10)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->write(rwops, "1234567", 1, 7))
+ }
+ if (7 != rwops->write(rwops, "1234567", 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
+ }
- if (1 != rwops->read(rwops, test_buf, 1, 1))
+ if (1 != rwops->read(rwops, test_buf, 1, 1)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ }
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
+ }
- if (20 + 27 != rwops->seek(rwops, -7, RW_SEEK_END))
+ if (20 + 27 != rwops->seek(rwops, -7, RW_SEEK_END)) {
RWOP_ERR_QUIT(rwops);
- if (7 != rwops->read(rwops, test_buf, 1, 7))
+ }
+ if (7 != rwops->read(rwops, test_buf, 1, 7)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "1234567", 7))
+ }
+ if (SDL_memcmp(test_buf, "1234567", 7)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 1, 1))
+ }
+ if (0 != rwops->read(rwops, test_buf, 1, 1)) {
RWOP_ERR_QUIT(rwops);
- if (0 != rwops->read(rwops, test_buf, 10, 100))
+ }
+ if (0 != rwops->read(rwops, test_buf, 10, 100)) {
RWOP_ERR_QUIT(rwops);
+ }
- if (27 != rwops->seek(rwops, -27, RW_SEEK_CUR))
+ if (27 != rwops->seek(rwops, -27, RW_SEEK_CUR)) {
RWOP_ERR_QUIT(rwops);
+ }
- if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET))
+ if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) {
RWOP_ERR_QUIT(rwops);
- if (3 != rwops->read(rwops, test_buf, 10, 3))
+ }
+ if (3 != rwops->read(rwops, test_buf, 10, 3)) {
RWOP_ERR_QUIT(rwops);
- if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30))
+ }
+ if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30)) {
RWOP_ERR_QUIT(rwops);
+ }
rwops->close(rwops);
SDL_Log("test5 OK\n");
cleanup();
diff --git a/test/testfilesystem.c b/test/testfilesystem.c
index d60308d..2f1e494 100644
--- a/test/testfilesystem.c
+++ b/test/testfilesystem.c
@@ -29,7 +29,7 @@ main(int argc, char *argv[])
}
base_path = SDL_GetBasePath();
- if(base_path == NULL){
+ if (base_path == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
SDL_GetError());
} else {
@@ -38,7 +38,7 @@ main(int argc, char *argv[])
}
pref_path = SDL_GetPrefPath("libsdl", "test_filesystem");
- if(pref_path == NULL){
+ if (pref_path == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
SDL_GetError());
} else {
@@ -47,7 +47,7 @@ main(int argc, char *argv[])
}
pref_path = SDL_GetPrefPath(NULL, "test_filesystem");
- if(pref_path == NULL){
+ if (pref_path == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n",
SDL_GetError());
} else {
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c
index 053bea0..56245ad 100644
--- a/test/testgamecontroller.c
+++ b/test/testgamecontroller.c
@@ -98,7 +98,7 @@ static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_IN
static void UpdateWindowTitle()
{
- if (!window) {
+ if (window == NULL) {
return;
}
@@ -190,13 +190,13 @@ static void AddController(int device_index, SDL_bool verbose)
}
controller = SDL_GameControllerOpen(device_index);
- if (!controller) {
+ if (controller == NULL) {
SDL_Log("Couldn't open controller: %s\n", SDL_GetError());
return;
}
controllers = (SDL_GameController **)SDL_realloc(gamecontrollers, (num_controllers + 1) * sizeof(*controllers));
- if (!controllers) {
+ if (controllers == NULL) {
SDL_GameControllerClose(controller);
return;
}
@@ -403,7 +403,7 @@ static void OpenVirtualController()
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
} else {
virtual_joystick = SDL_JoystickOpen(virtual_index);
- if (!virtual_joystick) {
+ if (virtual_joystick == NULL) {
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
}
}
@@ -912,7 +912,7 @@ main(int argc, char *argv[])
button_texture = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL);
axis_texture = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL);
- if (!background_front || !background_back || !button_texture || !axis_texture) {
+ if (background_front == NULL || background_back == NULL || button_texture == NULL || axis_texture == NULL) {
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
return 2;
diff --git a/test/testgeometry.c b/test/testgeometry.c
index fa8de75..39e450a 100644
--- a/test/testgeometry.c
+++ b/test/testgeometry.c
@@ -50,17 +50,17 @@ LoadSprite(const char *file)
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
if (!sprites[i]) {
- return (-1);
+ return -1;
}
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_DestroyTexture(sprites[i]);
- return (-1);
+ return -1;
}
}
/* We're ready to roll. :) */
- return (0);
+ return 0;
}
@@ -99,8 +99,9 @@ loop()
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
@@ -175,7 +176,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
@@ -219,7 +220,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
- if (!sprites) {
+ if (sprites == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
diff --git a/test/testgesture.c b/test/testgesture.c
index 856fd6a..9a2d7bf 100644
--- a/test/testgesture.c
+++ b/test/testgesture.c
@@ -108,7 +108,7 @@ drawCircle(SDL_Surface *screen, float x, float y, float r, unsigned int c)
for (ty = (float) -SDL_fabs(r); ty <= (float) SDL_fabs((int) r); ty++) {
xr = (float) SDL_sqrt(r * r - ty * ty);
if (r > 0) { /* r > 0 ==> filled circle */
- for(tx = -xr + 0.5f; tx <= xr - 0.5f; tx++) {
+ for (tx = -xr + 0.5f; tx <= xr - 0.5f; tx++) {
setpix(screen, x + tx, y + ty, c);
}
} else {
@@ -132,7 +132,7 @@ DrawScreen(SDL_Window *window)
SDL_Surface *screen = SDL_GetWindowSurface(window);
int i;
- if (!screen) {
+ if (screen == NULL) {
return;
}
@@ -272,7 +272,7 @@ loop(void)
int main(int argc, char* argv[])
{
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
diff --git a/test/testgl2.c b/test/testgl2.c
index f259ddc..9bc3ec6 100644
--- a/test/testgl2.c
+++ b/test/testgl2.c
@@ -229,7 +229,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
@@ -405,8 +405,9 @@ main(int argc, char *argv[])
for (i = 0; i < state->num_windows; ++i) {
int w, h;
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_GL_MakeCurrent(state->windows[i], context);
if (update_swap_interval) {
SDL_GL_SetSwapInterval(swap_interval);
diff --git a/test/testgles.c b/test/testgles.c
index 745cf89..1cd09b6 100644
--- a/test/testgles.c
+++ b/test/testgles.c
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
@@ -315,8 +315,9 @@ main(int argc, char *argv[])
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
if (status) {
SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
diff --git a/test/testgles2.c b/test/testgles2.c
index 903f7a8..45e7471 100644
--- a/test/testgles2.c
+++ b/test/testgles2.c
@@ -114,7 +114,7 @@ quit(int rc)
x; \
{ \
GLenum glError = ctx.glGetError(); \
- if(glError != GL_NO_ERROR) { \
+ if (glError != GL_NO_ERROR) { \
SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
quit(1); \
} \
@@ -239,7 +239,7 @@ process_shader(GLuint *shader, const char * source, GLint shader_type)
GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status));
/* Dump debug info (source and log) if compilation failed. */
- if(status != GL_TRUE) {
+ if (status != GL_TRUE) {
ctx.glGetShaderInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
SDL_Log("Shader compilation failed: %s", buffer);
@@ -260,7 +260,7 @@ link_program(struct shader_data *data)
GL_CHECK(ctx.glLinkProgram(data->shader_program));
GL_CHECK(ctx.glGetProgramiv(data->shader_program, GL_LINK_STATUS, &status));
- if(status != GL_TRUE) {
+ if (status != GL_TRUE) {
ctx.glGetProgramInfoLog(data->shader_program, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
SDL_Log("Program linking failed: %s", buffer);
@@ -434,12 +434,24 @@ Render(unsigned int width, unsigned int height, shader_data* data)
data->angle_y += 2;
data->angle_z += 1;
- if(data->angle_x >= 360) data->angle_x -= 360;
- if(data->angle_x < 0) data->angle_x += 360;
- if(data->angle_y >= 360) data->angle_y -= 360;
- if(data->angle_y < 0) data->angle_y += 360;
- if(data->angle_z >= 360) data->angle_z -= 360;
- if(data->angle_z < 0) data->angle_z += 360;
+ if (data->angle_x >= 360) {
+ data->angle_x -= 360;
+ }
+ if (data->angle_x < 0) {
+ data->angle_x += 360;
+ }
+ if (data->angle_y >= 360) {
+ data->angle_y -= 360;
+ }
+ if (data->angle_y < 0) {
+ data->angle_y += 360;
+ }
+ if (data->angle_z >= 360) {
+ data->angle_z -= 360;
+ }
+ if (data->angle_z < 0) {
+ data->angle_z += 360;
+ }
GL_CHECK(ctx.glViewport(0, 0, width, height));
GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
@@ -555,7 +567,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c
index e9e79d6..d2d36f9 100644
--- a/test/testgles2_sdf.c
+++ b/test/testgles2_sdf.c
@@ -117,7 +117,7 @@ quit(int rc)
x; \
{ \
GLenum glError = ctx.glGetError(); \
- if(glError != GL_NO_ERROR) { \
+ if (glError != GL_NO_ERROR) { \
SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
quit(1); \
} \
@@ -154,7 +154,7 @@ process_shader(GLuint *shader, const char * source, GLint shader_type)
GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status));
/* Dump debug info (source and log) if compilation failed. */
- if(status != GL_TRUE) {
+ if (status != GL_TRUE) {
ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr);
@@ -357,10 +357,18 @@ void loop()
}
- if (sym == SDLK_LEFT) g_val -= 0.05;
- if (sym == SDLK_RIGHT) g_val += 0.05;
- if (sym == SDLK_UP) g_angle -= 1;
- if (sym == SDLK_DOWN) g_angle += 1;
+ if (sym == SDLK_LEFT) {
+ g_val -= 0.05;
+ }
+ if (sym == SDLK_RIGHT) {
+ g_val += 0.05;
+ }
+ if (sym == SDLK_UP) {
+ g_angle -= 1;
+ }
+ if (sym == SDLK_DOWN) {
+ g_angle += 1;
+ }
break;
@@ -402,8 +410,7 @@ void loop()
matrix_mvp[1][1] = -2.0f / 480.0;
matrix_mvp[3][1] = 1.0f;
- if (0)
- {
+ if (0) {
float *f = (float *) matrix_mvp;
SDL_Log("-----------------------------------");
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
@@ -466,7 +473,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
@@ -564,8 +571,9 @@ main(int argc, char *argv[])
#if 1
path = GetNearbyFilename(f);
- if (path == NULL)
+ if (path == NULL) {
path = SDL_strdup(f);
+ }
if (path == NULL) {
SDL_Log("out of memory\n");
@@ -573,7 +581,7 @@ main(int argc, char *argv[])
}
tmp = SDL_LoadBMP(path);
- if (tmp == NULL) {
+ if (tmp == NULL) {
SDL_Log("missing image file: %s", path);
exit(-1);
} else {
diff --git a/test/testhaptic.c b/test/testhaptic.c
index 8e92da3..55fe299 100644
--- a/test/testhaptic.c
+++ b/test/testhaptic.c
@@ -78,8 +78,9 @@ main(int argc, char **argv)
/* Try to find matching device */
else {
for (i = 0; i < SDL_NumHaptics(); i++) {
- if (SDL_strstr(SDL_HapticName(i), name) != NULL)
+ if (SDL_strstr(SDL_HapticName(i), name) != NULL) {
break;
+ }
}
if (i >= SDL_NumHaptics()) {
@@ -283,8 +284,9 @@ main(int argc, char **argv)
}
/* Quit */
- if (haptic != NULL)
+ if (haptic != NULL) {
SDL_HapticClose(haptic);
+ }
SDL_Quit();
return 0;
@@ -317,40 +319,55 @@ HapticPrintSupported(SDL_Haptic * ptr)
supported = SDL_HapticQuery(ptr);
SDL_Log(" Supported effects [%d effects, %d playing]:\n",
SDL_HapticNumEffects(ptr), SDL_HapticNumEffectsPlaying(ptr));
- if (supported & SDL_HAPTIC_CONSTANT)
+ if (supported & SDL_HAPTIC_CONSTANT) {
SDL_Log(" constant\n");
- if (supported & SDL_HAPTIC_SINE)
+ }
+ if (supported & SDL_HAPTIC_SINE) {
SDL_Log(" sine\n");
+ }
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* if (supported & SDL_HAPTIC_SQUARE)
SDL_Log(" square\n"); */
- if (supported & SDL_HAPTIC_TRIANGLE)
+ if (supported & SDL_HAPTIC_TRIANGLE) {
SDL_Log(" triangle\n");
- if (supported & SDL_HAPTIC_SAWTOOTHUP)
+ }
+ if (supported & SDL_HAPTIC_SAWTOOTHUP) {
SDL_Log(" sawtoothup\n");
- if (supported & SDL_HAPTIC_SAWTOOTHDOWN)
+ }
+ if (supported & SDL_HAPTIC_SAWTOOTHDOWN) {
SDL_Log(" sawtoothdown\n");
- if (supported & SDL_HAPTIC_RAMP)
+ }
+ if (supported & SDL_HAPTIC_RAMP) {
SDL_Log(" ramp\n");
- if (supported & SDL_HAPTIC_FRICTION)
+ }
+ if (supported & SDL_HAPTIC_FRICTION) {
SDL_Log(" friction\n");
- if (supported & SDL_HAPTIC_SPRING)
+ }
+ if (supported & SDL_HAPTIC_SPRING) {
SDL_Log(" spring\n");
- if (supported & SDL_HAPTIC_DAMPER)
+ }
+ if (supported & SDL_HAPTIC_DAMPER) {
SDL_Log(" damper\n");
- if (supported & SDL_HAPTIC_INERTIA)
+ }
+ if (supported & SDL_HAPTIC_INERTIA) {
SDL_Log(" inertia\n");
- if (supported & SDL_HAPTIC_CUSTOM)
+ }
+ if (supported & SDL_HAPTIC_CUSTOM) {
SDL_Log(" custom\n");
- if (supported & SDL_HAPTIC_LEFTRIGHT)
+ }
+ if (supported & SDL_HAPTIC_LEFTRIGHT) {
SDL_Log(" left/right\n");
+ }
SDL_Log(" Supported capabilities:\n");
- if (supported & SDL_HAPTIC_GAIN)
+ if (supported & SDL_HAPTIC_GAIN) {
SDL_Log(" gain\n");
- if (supported & SDL_HAPTIC_AUTOCENTER)
+ }
+ if (supported & SDL_HAPTIC_AUTOCENTER) {
SDL_Log(" autocenter\n");
- if (supported & SDL_HAPTIC_STATUS)
+ }
+ if (supported & SDL_HAPTIC_STATUS) {
SDL_Log(" status\n");
+ }
}
#else
diff --git a/test/testhittesting.c b/test/testhittesting.c
index c5223a9..24444db 100644
--- a/test/testhittesting.c
+++ b/test/testhittesting.c
@@ -74,8 +74,7 @@ int main(int argc, char **argv)
return 1;
}
- while (!done)
- {
+ while (!done) {
SDL_Event e;
int nothing_to_do = 1;
@@ -108,7 +107,7 @@ int main(int argc, char **argv)
if (e.key.keysym.sym == SDLK_ESCAPE) {
done = 1;
} else if (e.key.keysym.sym == SDLK_x) {
- if (!areas) {
+ if (areas == NULL) {
areas = drag_areas;
numareas = SDL_arraysize(drag_areas);
} else {
diff --git a/test/testhotplug.c b/test/testhotplug.c
index a2fb37b..10b1b1b 100644
--- a/test/testhotplug.c
+++ b/test/testhotplug.c
@@ -37,7 +37,7 @@ main(int argc, char *argv[])
}
}
- if(enable_haptic) {
+ if (enable_haptic) {
init_subsystems |= SDL_INIT_HAPTIC;
}
@@ -57,39 +57,31 @@ main(int argc, char *argv[])
*/
SDL_Log("There are %d joysticks at startup\n", SDL_NumJoysticks());
- if (enable_haptic)
+ if (enable_haptic) {
SDL_Log("There are %d haptic devices at startup\n", SDL_NumHaptics());
+ }
- while(keepGoing)
- {
+ while (keepGoing) {
SDL_Event event;
- while(SDL_PollEvent(&event))
- {
+ while (SDL_PollEvent(&event)) {
switch(event.type)
{
case SDL_QUIT:
keepGoing = SDL_FALSE;
break;
case SDL_JOYDEVICEADDED:
- if (joystick != NULL)
- {
+ if (joystick != NULL) {
SDL_Log("Only one joystick supported by this test\n");
- }
- else
- {
+ } else {
joystick = SDL_JoystickOpen(event.jdevice.which);
instance = SDL_JoystickInstanceID(joystick);
SDL_Log("Joy Added : %" SDL_PRIs32 " : %s\n", event.jdevice.which, SDL_JoystickName(joystick));
- if (enable_haptic)
- {
- if (SDL_JoystickIsHaptic(joystick))
- {
+ if (enable_haptic) {
+ if (SDL_JoystickIsHaptic(joystick)) {
haptic = SDL_HapticOpenFromJoystick(joystick);
- if (haptic)
- {
+ if (haptic) {
SDL_Log("Joy Haptic Opened\n");
- if (SDL_HapticRumbleInit( haptic ) != 0)
- {
+ if (SDL_HapticRumbleInit( haptic ) != 0) {
SDL_Log("Could not init Rumble!: %s\n", SDL_GetError());
SDL_HapticClose(haptic);
haptic = NULL;
@@ -97,21 +89,17 @@ main(int argc, char *argv[])
} else {
SDL_Log("Joy haptic open FAILED!: %s\n", SDL_GetError());
}
- }
- else
- {
+ } else {
SDL_Log("No haptic found\n");
}
}
}
break;
case SDL_JOYDEVICEREMOVED:
- if (instance == event.jdevice.which)
- {
+ if (instance == event.jdevice.which) {
SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
instance = -1;
- if(enable_haptic && haptic)
- {
+ if (enable_haptic && haptic) {
SDL_HapticClose(haptic);
haptic = NULL;
}
@@ -125,13 +113,13 @@ main(int argc, char *argv[])
/*
// SDL_Log("Axis Move: %d\n", event.jaxis.axis);
*/
- if (enable_haptic)
+ if (enable_haptic) {
SDL_HapticRumblePlay(haptic, 0.25, 250);
+ }
break;
case SDL_JOYBUTTONDOWN:
SDL_Log("Button Press: %d\n", event.jbutton.button);
- if(enable_haptic && haptic)
- {
+ if (enable_haptic && haptic) {
SDL_HapticRumblePlay(haptic, 0.25, 250);
}
if (event.jbutton.button == 0) {
diff --git a/test/testiconv.c b/test/testiconv.c
index fc08066..e437fe9 100644
--- a/test/testiconv.c
+++ b/test/testiconv.c
@@ -62,9 +62,9 @@ main(int argc, char *argv[])
fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt");
file = fopen(fname, "rb");
- if (!file) {
+ if (file == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname);
- return (1);
+ return 1;
}
SDL_free(fname);
@@ -93,5 +93,5 @@ main(int argc, char *argv[])
fclose(file);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Total errors: %d\n", errors);
- return (errors ? errors + 1 : 0);
+ return errors ? errors + 1 : 0;
}
diff --git a/test/testime.c b/test/testime.c
index 9a0b525..0d6d4fe 100644
--- a/test/testime.c
+++ b/test/testime.c
@@ -71,12 +71,13 @@ static Uint8 unifontTextureLoaded[UNIFONT_NUM_TEXTURES] = {0};
static Uint8 dehex(char c)
{
- if (c >= '0' && c <= '9')
+ if (c >= '0' && c <= '9') {
return c - '0';
- else if (c >= 'a' && c <= 'f')
+ } else if (c >= 'a' && c <= 'f') {
return c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
+ } else if (c >= 'A' && c <= 'F') {
return c - 'A' + 10;
+ }
return 255;
}
@@ -88,15 +89,16 @@ static Uint8 dehex2(char c1, char c2)
static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np)
{
Uint32 n = 0;
- for (; len > 0; cp++, len--)
- {
+ for (; len > 0; cp++, len--) {
Uint8 c = dehex(*cp);
- if (c == 255)
+ if (c == 255) {
return 0;
+ }
n = (n << 4) | c;
}
- if (np != NULL)
+ if (np != NULL) {
*np = n;
+ }
return 1;
}
@@ -113,8 +115,7 @@ static int unifont_init(const char *fontname)
/* Allocate memory for the glyph data so the file can be closed after initialization. */
unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize);
- if (unifontGlyph == NULL)
- {
+ if (unifontGlyph == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024);
return -1;
}
@@ -122,8 +123,7 @@ static int unifont_init(const char *fontname)
/* Allocate memory for texture pointers for all renderers. */
unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize);
- if (unifontTexture == NULL)
- {
+ if (unifontTexture == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024);
return -1;
}
@@ -136,8 +136,7 @@ static int unifont_init(const char *fontname)
}
hexFile = SDL_RWFromFile(filename, "rb");
SDL_free(filename);
- if (hexFile == NULL)
- {
+ if (hexFile == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname);
return -1;
}
@@ -150,10 +149,10 @@ static int unifont_init(const char *fontname)
Uint32 codepoint;
bytesRead = SDL_RWread(hexFile, hexBuffer, 1, 9);
- if (numGlyphs > 0 && bytesRead == 0)
+ if (numGlyphs > 0 && bytesRead == 0) {
break; /* EOF */
- if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9))
- {
+ }
+ if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
return -1;
}
@@ -167,59 +166,54 @@ static int unifont_init(const char *fontname)
codepointHexSize = 6;
else if (hexBuffer[8] == ':')
codepointHexSize = 8;
- else
- {
+ else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber);
return -1;
}
- if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint))
- {
+ if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber);
return -1;
}
- if (codepoint > UNIFONT_MAX_CODEPOINT)
+ if (codepoint > UNIFONT_MAX_CODEPOINT) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT);
+ }
/* If there was glyph data read in the last file read, move it to the front of the buffer. */
bytesOverread = 8 - codepointHexSize;
- if (codepointHexSize < 8)
+ if (codepointHexSize < 8) {
SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread);
+ }
bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 1, 33 - bytesOverread);
- if (bytesRead < (33 - bytesOverread))
- {
+ if (bytesRead < (33 - bytesOverread)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
return -1;
}
if (hexBuffer[32] == '\n')
glyphWidth = 8;
- else
- {
+ else {
glyphWidth = 16;
bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 1, 32);
- if (bytesRead < 32)
- {
+ if (bytesRead < 32) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
return -1;
}
}
- if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL))
- {
+ if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber);
return -1;
}
- if (codepoint <= UNIFONT_MAX_CODEPOINT)
- {
+ if (codepoint <= UNIFONT_MAX_CODEPOINT) {
if (unifontGlyph[codepoint].width > 0)
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08" SDL_PRIx32 " in hex file on line %d.\n", codepoint, lineNumber);
- else
- {
+ else {
unifontGlyph[codepoint].width = glyphWidth;
/* Pack the hex data into a more compact form. */
- for (i = 0; i < glyphWidth * 2; i++)
+ for (i = 0; i < glyphWidth * 2; i++) {
unifontGlyph[codepoint].data[i] = dehex2(hexBuffer[i * 2], hexBuffer[i * 2 + 1]);
+ }
numGlyphs++;
}
}
@@ -237,20 +231,15 @@ static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width)
int i, j;
Uint8 *row = dst;
- for (i = 0; i < width * 2; i++)
- {
+ for (i = 0; i < width * 2; i++) {
Uint8 data = src[i];
- for (j = 0; j < 8; j++)
- {
- if (data & 0x80)
- {
+ for (j = 0; j < 8; j++) {
+ if (data & 0x80) {
row[0] = textColor.r;
row[1] = textColor.g;
row[2] = textColor.b;
row[3] = textColor.a;
- }
- else
- {
+ } else {
row[0] = 0;
row[1] = 0;
row[2] = 0;
@@ -260,8 +249,7 @@ static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width)
row += 4;
}
- if (width == 8 || (width == 16 && i % 2 == 1))
- {
+ if (width == 8 || (width == 16 && i % 2 == 1)) {
dst += UNIFONT_TEXTURE_PITCH;
row = dst;
}
@@ -273,26 +261,22 @@ static int unifont_load_texture(Uint32 textureID)
int i;
Uint8 * textureRGBA;
- if (textureID >= UNIFONT_NUM_TEXTURES)
- {
+ if (textureID >= UNIFONT_NUM_TEXTURES) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %" SDL_PRIu32 "\n", textureID);
return -1;
}
textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE);
- if (textureRGBA == NULL)
- {
+ if (textureRGBA == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024);
return -1;
}
SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE);
/* Copy the glyphs into memory in RGBA format. */
- for (i = 0; i < UNIFONT_GLYPHS_IN_TEXTURE; i++)
- {
+ for (i = 0; i < UNIFONT_GLYPHS_IN_TEXTURE; i++) {
Uint32 codepoint = UNIFONT_GLYPHS_IN_TEXTURE * textureID + i;
- if (unifontGlyph[codepoint].width > 0)
- {
+ if (unifontGlyph[codepoint].width > 0) {
const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
const size_t offset = (cInTex / UNIFONT_GLYPHS_IN_ROW) * UNIFONT_TEXTURE_PITCH * 16 + (cInTex % UNIFONT_GLYPHS_IN_ROW) * 16 * 4;
unifont_make_rgba(unifontGlyph[codepoint].data, textureRGBA + offset, unifontGlyph[codepoint].width);
@@ -300,22 +284,20 @@ static int unifont_load_texture(Uint32 textureID)
}
/* Create textures and upload the RGBA data from above. */
- for (i = 0; i < state->num_windows; ++i)
- {
+ for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID];
- if (state->windows[i] == NULL || renderer == NULL || tex != NULL)
+ if (state->windows[i] == NULL || renderer == NULL || tex != NULL) {
continue;
+ }
tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH);
- if (tex == NULL)
- {
+ if (tex == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %" SDL_PRIu32 " for renderer %d.\n", textureID, i);
return -1;
}
unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex;
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
- if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0)
- {
+ if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0) {
SDL_Log("unifont error: Failed to update texture %" SDL_PRIu32 " data for renderer %d.\n", textureID, i);
}
}
@@ -340,8 +322,7 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst
}
}
texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID];
- if (texture != NULL)
- {
+ if (texture != NULL) {
const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16;
srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16;
@@ -353,21 +334,22 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst
static void unifont_cleanup()
{
int i, j;
- for (i = 0; i < state->num_windows; ++i)
- {
+ for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL || renderer == NULL)
+ if (state->windows[i] == NULL || renderer == NULL) {
continue;
- for (j = 0; j < UNIFONT_NUM_TEXTURES; j++)
- {
+ }
+ for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) {
SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j];
- if (tex != NULL)
+ if (tex != NULL) {
SDL_DestroyTexture(tex);
+ }
}
}
- for (j = 0; j < UNIFONT_NUM_TEXTURES; j++)
- unifontTextureLoaded[j] = 0;
+ for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) {
+ unifontTextureLoaded[j] = 0;
+ }
SDL_free(unifontTexture);
SDL_free(unifontGlyph);
@@ -395,14 +377,15 @@ char *utf8_next(char *p)
{
size_t len = utf8_length(*p);
size_t i = 0;
- if (!len)
+ if (!len) {
return 0;
+ }
- for (; i < len; ++i)
- {
+ for (; i < len; ++i) {
++p;
- if (!*p)
+ if (!*p) {
return 0;
+ }
}
return p;
}
@@ -410,8 +393,7 @@ char *utf8_next(char *p)
char *utf8_advance(char *p, size_t distance)
{
size_t i = 0;
- for (; i < distance && p; ++i)
- {
+ for (; i < distance && p; ++i) {
p = utf8_next(p);
}
return p;
@@ -421,20 +403,20 @@ Uint32 utf8_decode(char *p, size_t len)
{
Uint32 codepoint = 0;
size_t i = 0;
- if (!len)
+ if (!len) {
return 0;
+ }
- for (; i < len; ++i)
- {
+ for (; i < len; ++i) {
if (i == 0)
codepoint = (0xff >> len) & *p;
- else
- {
+ else {
codepoint <<= 6;
codepoint |= 0x3f & *p;
}
- if (!*p)
+ if (!*p) {
return 0;
+ }
p++;
}
@@ -481,8 +463,7 @@ void _Redraw(int rendererID)
SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a);
SDL_RenderFillRect(renderer,&textRect);
- if (*text)
- {
+ if (*text) {
#ifdef HAVE_SDL_TTF
SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor);
SDL_Texture *texture;
@@ -510,8 +491,7 @@ void _Redraw(int rendererID)
drawnTextRect.y = dstrect.y;
drawnTextRect.h = dstrect.h;
- while ((codepoint = utf8_decode(utext, len = utf8_length(*utext))))
- {
+ while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) {
Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE;
dstrect.x += advance;
drawnTextRect.w += advance;
@@ -522,14 +502,11 @@ void _Redraw(int rendererID)
markedRect.x = textRect.x + drawnTextRect.w;
markedRect.w = textRect.w - drawnTextRect.w;
- if (markedRect.w < 0)
- {
+ if (markedRect.w < 0) {
/* Stop text input because we cannot hold any more characters */
SDL_StopTextInput();
return;
- }
- else
- {
+ } else {
SDL_StartTextInput();
}
@@ -544,17 +521,16 @@ void _Redraw(int rendererID)
SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a);
SDL_RenderFillRect(renderer,&markedRect);
- if (markedText[0])
- {
+ if (markedText[0]) {
#ifdef HAVE_SDL_TTF
SDL_Surface *textSur;
SDL_Texture *texture;
- if (cursor)
- {
+ if (cursor) {
char *p = utf8_advance(markedText, cursor);
char c = 0;
- if (!p)
+ if (p == NULL) {
p = &markedText[SDL_strlen(markedText)];
+ }
c = *p;
*p = 0;
@@ -587,20 +563,19 @@ void _Redraw(int rendererID)
drawnTextRect.y = dstrect.y;
drawnTextRect.h = dstrect.h;
- while ((codepoint = utf8_decode(utext, len = utf8_length(*utext))))
- {
+ while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) {
Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE;
dstrect.x += advance;
drawnTextRect.w += advance;
- if (i < cursor)
+ if (i < cursor) {
cursorRect.x += advance;
+ }
i++;
utext += len;
}
#endif
- if (cursor > 0)
- {
+ if (cursor > 0) {
cursorRect.y = drawnTextRect.y;
cursorRect.h = drawnTextRect.h;
}
@@ -625,8 +600,9 @@ void Redraw()
int i;
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
@@ -648,21 +624,19 @@ int main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;i++) {
SDLTest_CommonArg(state, i);
}
- for (argc--, argv++; argc > 0; argc--, argv++)
- {
+ for (argc--, argv++; argc > 0; argc--, argv++) {
if (SDL_strcmp(argv[0], "--help") == 0) {
usage();
return 0;
}
- else if (SDL_strcmp(argv[0], "--font") == 0)
- {
+ else if (SDL_strcmp(argv[0], "--font") == 0) {
argc--;
argv++;
@@ -685,8 +659,7 @@ int main(int argc, char *argv[])
TTF_Init();
font = TTF_OpenFont(fontname, DEFAULT_PTSIZE);
- if (! font)
- {
+ if (font == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
return -1;
}
@@ -723,42 +696,36 @@ int main(int argc, char *argv[])
break;
case SDLK_BACKSPACE:
/* Only delete text if not in editing mode. */
- if (!markedText[0])
- {
+ if (!markedText[0]) {
size_t textlen = SDL_strlen(text);
do {
- if (textlen==0)
- {
+ if (textlen==0) {
break;
}
- if ((text[textlen-1] & 0x80) == 0x00)
- {
+ if ((text[textlen-1] & 0x80) == 0x00) {
/* One byte */
text[textlen-1]=0x00;
break;
}
- if ((text[textlen-1] & 0xC0) == 0x80)
- {
+ if ((text[textlen-1] & 0xC0) == 0x80) {
/* Byte from the multibyte sequence */
text[textlen-1]=0x00;
textlen--;
}
- if ((text[textlen-1] & 0xC0) == 0xC0)
- {
+ if ((text[textlen-1] & 0xC0) == 0xC0) {
/* First byte of multibyte sequence */
text[textlen-1]=0x00;
break;
}
- } while(1);
+ } while (1);
Redraw();
}
break;
}
- if (done)
- {
+ if (done) {
break;
}
@@ -770,14 +737,15 @@ int main(int argc, char *argv[])
break;
case SDL_TEXTINPUT:
- if (event.text.text[0] == '\0' || event.text.text[0] == '\n' ||
- markedRect.w < 0)
+ if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || markedRect.w < 0) {
break;
+ }
SDL_Log("Keyboard: text input \"%s\"\n", event.text.text);
- if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
+ if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text)) {
SDL_strlcat(text, event.text.text, sizeof(text));
+ }
SDL_Log("text inputed: %s\n", text);
diff --git a/test/testintersections.c b/test/testintersections.c
index 29af8e2..1216adc 100644
--- a/test/testintersections.c
+++ b/test/testintersections.c
@@ -22,7 +22,7 @@
#include "SDL_test_common.h"
-#define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while(0)
+#define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while (0)
#define NUM_OBJECTS 100
static SDLTest_CommonState *state;
@@ -86,10 +86,12 @@ SDL_Rect lines[MAX_LINES];
static int
add_line(int x1, int y1, int x2, int y2)
{
- if (num_lines >= MAX_LINES)
+ if (num_lines >= MAX_LINES) {
return 0;
- if ((x1 == x2) && (y1 == y2))
+ }
+ if ((x1 == x2) && (y1 == y2)) {
return 0;
+ }
SDL_Log("adding line (%d, %d), (%d, %d)\n", x1, y1, x2, y2);
lines[num_lines].x = x1;
@@ -130,15 +132,19 @@ SDL_Rect rects[MAX_RECTS];
static int
add_rect(int x1, int y1, int x2, int y2)
{
- if (num_rects >= MAX_RECTS)
+ if (num_rects >= MAX_RECTS) {
return 0;
- if ((x1 == x2) || (y1 == y2))
+ }
+ if ((x1 == x2) || (y1 == y2)) {
return 0;
+ }
- if (x1 > x2)
+ if (x1 > x2) {
SWAP(int, x1, x2);
- if (y1 > y2)
+ }
+ if (y1 > y2) {
SWAP(int, y1, y2);
+ }
SDL_Log("adding rect (%d, %d), (%d, %d) [%dx%d]\n", x1, y1, x2, y2,
x2 - x1, y2 - y1);
@@ -213,12 +219,12 @@ loop()
mouse_begin_y = event.button.y;
break;
case SDL_MOUSEBUTTONUP:
- if (event.button.button == 3)
- add_line(mouse_begin_x, mouse_begin_y, event.button.x,
- event.button.y);
- if (event.button.button == 1)
- add_rect(mouse_begin_x, mouse_begin_y, event.button.x,
- event.button.y);
+ if (event.button.button == 3) {
+ add_line(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
+ }
+ if (event.button.button == 1) {
+ add_rect(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y);
+ }
break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
@@ -244,8 +250,9 @@ loop()
}
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
@@ -278,7 +285,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
diff --git a/test/testjoystick.c b/test/testjoystick.c
index f058979..e20618c 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -118,7 +118,7 @@ loop(void *arg)
case SDL_JOYDEVICEADDED:
SDL_Log("Joystick device %d added.\n", (int) event.jdevice.which);
- if (!joystick) {
+ if (joystick == NULL) {
joystick = SDL_JoystickOpen(event.jdevice.which);
if (joystick) {
PrintJoystick(joystick);
@@ -144,16 +144,21 @@ loop(void *arg)
case SDL_JOYHATMOTION:
SDL_Log("Joystick %" SDL_PRIs32 " hat %d value:",
event.jhat.which, event.jhat.hat);
- if (event.jhat.value == SDL_HAT_CENTERED)
+ if (event.jhat.value == SDL_HAT_CENTERED) {
SDL_Log(" centered");
- if (event.jhat.value & SDL_HAT_UP)
+ }
+ if (event.jhat.value & SDL_HAT_UP) {
SDL_Log(" up");
- if (event.jhat.value & SDL_HAT_RIGHT)
+ }
+ if (event.jhat.value & SDL_HAT_RIGHT) {
SDL_Log(" right");
- if (event.jhat.value & SDL_HAT_DOWN)
+ }
+ if (event.jhat.value & SDL_HAT_DOWN) {
SDL_Log(" down");
- if (event.jhat.value & SDL_HAT_LEFT)
+ }
+ if (event.jhat.value & SDL_HAT_LEFT) {
SDL_Log(" left");
+ }
SDL_Log("\n");
break;
case SDL_JOYBALLMOTION:
diff --git a/test/testkeys.c b/test/testkeys.c
index 7561eb0..e529359 100644
--- a/test/testkeys.c
+++ b/test/testkeys.c
@@ -36,5 +36,5 @@ main(int argc, char *argv[])
SDL_GetScancodeName(scancode));
}
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testlock.c b/test/testlock.c
index 1210596..b0e7f0c 100644
--- a/test/testlock.c
+++ b/test/testlock.c
@@ -55,8 +55,9 @@ closemutex(int sig)
int i;
SDL_Log("Process %lu: Cleaning up...\n", id == mainthread ? 0 : id);
SDL_AtomicSet(&doterminate, 1);
- for (i = 0; i < 6; ++i)
+ for (i = 0; i < 6; ++i) {
SDL_WaitThread(threads[i], NULL);
+ }
SDL_DestroyMutex(mutex);
exit(sig);
}
@@ -64,8 +65,9 @@ closemutex(int sig)
int SDLCALL
Run(void *data)
{
- if (SDL_ThreadID() == mainthread)
+ if (SDL_ThreadID() == mainthread) {
signal(SIGTERM, closemutex);
+ }
while (!SDL_AtomicGet(&doterminate)) {
SDL_Log("Process %lu ready to work\n", SDL_ThreadID());
if (SDL_LockMutex(mutex) < 0) {
@@ -86,7 +88,7 @@ Run(void *data)
SDL_Log("Process %lu: raising SIGTERM\n", SDL_ThreadID());
raise(SIGTERM);
}
- return (0);
+ return 0;
}
int
@@ -118,11 +120,12 @@ main(int argc, char *argv[])
for (i = 0; i < maxproc; ++i) {
char name[64];
SDL_snprintf(name, sizeof (name), "Worker%d", i);
- if ((threads[i] = SDL_CreateThread(Run, name, NULL)) == NULL)
+ if ((threads[i] = SDL_CreateThread(Run, name, NULL)) == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!\n");
+ }
}
signal(SIGINT, terminate);
Run(NULL);
- return (0); /* Never reached */
+ return 0; /* Never reached */
}
diff --git a/test/testmessage.c b/test/testmessage.c
index c30c18d..88c6725 100644
--- a/test/testmessage.c
+++ b/test/testmessage.c
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
*/
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
{
int status = 0;
@@ -172,8 +172,7 @@ main(int argc, char *argv[])
intptr_t eventNumber = SDL_RegisterEvents(1);
SDL_Thread* thread = SDL_CreateThread(&button_messagebox, "MessageBox", (void*)eventNumber);
- while (SDL_WaitEvent(&event))
- {
+ while (SDL_WaitEvent(&event)) {
if (event.type == eventNumber) {
break;
}
@@ -204,8 +203,7 @@ main(int argc, char *argv[])
quit(1);
}
- while (SDL_WaitEvent(&event))
- {
+ while (SDL_WaitEvent(&event)) {
if (event.type == SDL_QUIT || event.type == SDL_KEYUP) {
break;
}
@@ -213,5 +211,5 @@ main(int argc, char *argv[])
}
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testmouse.c b/test/testmouse.c
index b8fc440..6b3f4ce 100644
--- a/test/testmouse.c
+++ b/test/testmouse.c
@@ -133,15 +133,16 @@ loop(void *arg)
break;
case SDL_MOUSEMOTION:
- if (!active)
+ if (active == NULL) {
break;
+ }
active->x2 = event.motion.x;
active->y2 = event.motion.y;
break;
case SDL_MOUSEBUTTONDOWN:
- if (!active) {
+ if (active == NULL) {
active = SDL_calloc(1, sizeof(*active));
active->x1 = active->x2 = event.button.x;
active->y1 = active->y2 = event.button.y;
@@ -158,8 +159,9 @@ loop(void *arg)
break;
case SDL_MOUSEBUTTONUP:
- if (!active)
+ if (active == NULL) {
break;
+ }
switch (event.button.button) {
case SDL_BUTTON_LEFT: buttons &= ~SDL_BUTTON_LMASK; break;
@@ -210,8 +212,9 @@ loop(void *arg)
/* Objects from mouse clicks */
DrawObjects(renderer);
- if (active)
+ if (active) {
DrawObject(renderer, active);
+ }
SDL_RenderPresent(renderer);
diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c
index 1154b83..e4de228 100644
--- a/test/testmultiaudio.c
+++ b/test/testmultiaudio.c
@@ -39,8 +39,9 @@ play_through_once(void *arg, Uint8 * stream, int len)
Uint8 *waveptr = sound + cbdata->soundpos;
int waveleft = soundlen - cbdata->soundpos;
int cpy = len;
- if (cpy > waveleft)
+ if (cpy > waveleft) {
cpy = waveleft;
+ }
SDL_memcpy(stream, waveptr, cpy);
len -= cpy;
@@ -105,7 +106,7 @@ test_multi_audio(int devcount)
while (!SDL_AtomicGet(&cbd[0].done)) {
#ifdef __ANDROID__
/* Empty queue, some application events would prevent pause. */
- while (SDL_PollEvent(&event)){}
+ while (SDL_PollEvent(&event)) {}
#endif
SDL_Delay(100);
}
@@ -143,7 +144,7 @@ test_multi_audio(int devcount)
}
#ifdef __ANDROID__
/* Empty queue, some application events would prevent pause. */
- while (SDL_PollEvent(&event)){}
+ while (SDL_PollEvent(&event)) {}
#endif
SDL_Delay(100);
@@ -173,7 +174,7 @@ main(int argc, char **argv)
/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
diff --git a/test/testnative.c b/test/testnative.c
index e115089..7cb28a3 100644
--- a/test/testnative.c
+++ b/test/testnative.c
@@ -121,19 +121,19 @@ main(int argc, char *argv[])
break;
}
}
- if (!factory) {
+ if (factory == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver\n",
driver);
quit(2);
}
SDL_Log("Creating native window for %s driver\n", driver);
native_window = factory->CreateNativeWindow(WINDOW_W, WINDOW_H);
- if (!native_window) {
+ if (native_window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create native window\n");
quit(3);
}
window = SDL_CreateWindowFrom(native_window);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window: %s\n", SDL_GetError());
quit(4);
}
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
/* Create the renderer */
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
quit(5);
}
@@ -151,7 +151,7 @@ main(int argc, char *argv[])
SDL_RenderClear(renderer);
sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL);
- if (!sprite) {
+ if (sprite == NULL) {
quit(6);
}
@@ -160,7 +160,7 @@ main(int argc, char *argv[])
SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h);
positions = (SDL_Rect *) SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
velocities = (SDL_Rect *) SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
- if (!positions || !velocities) {
+ if (positions == NULL || velocities == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
diff --git a/test/testoffscreen.c b/test/testoffscreen.c
index e2a8f4b..64219df 100644
--- a/test/testoffscreen.c
+++ b/test/testoffscreen.c
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
width, height, 0);
- if (!window) {
+ if (window == NULL) {
SDL_Log("Couldn't create window: %s\n",
SDL_GetError());
return SDL_FALSE;
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_Log("Couldn't create renderer: %s\n",
SDL_GetError());
return SDL_FALSE;
diff --git a/test/testoverlay2.c b/test/testoverlay2.c
index ab0fd82..c57c160 100644
--- a/test/testoverlay2.c
+++ b/test/testoverlay2.c
@@ -342,21 +342,21 @@ main(int argc, char **argv)
SDL_WINDOWPOS_UNDEFINED,
window_w, window_h,
SDL_WINDOW_RESIZABLE);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
SDL_free(RawMooseData);
quit(4);
}
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
SDL_free(RawMooseData);
quit(4);
}
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
- if (!MooseTexture) {
+ if (MooseTexture == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
SDL_free(RawMooseData);
quit(5);
diff --git a/test/testplatform.c b/test/testplatform.c
index 5eec9f9..bed1af6 100644
--- a/test/testplatform.c
+++ b/test/testplatform.c
@@ -51,33 +51,34 @@ TestTypes(SDL_bool verbose)
int error = 0;
if (badsize(sizeof(Uint8), 1)) {
- if (verbose)
- SDL_Log("sizeof(Uint8) != 1, instead = %u\n",
- (unsigned int)sizeof(Uint8));
+ if (verbose) {
+ SDL_Log("sizeof(Uint8) != 1, instead = %u\n", (unsigned int)sizeof(Uint8));
+ }
++error;
}
if (badsize(sizeof(Uint16), 2)) {
- if (verbose)
- SDL_Log("sizeof(Uint16) != 2, instead = %u\n",
- (unsigned int)sizeof(Uint16));
+ if (verbose) {
+ SDL_Log("sizeof(Uint16) != 2, instead = %u\n", (unsigned int)sizeof(Uint16));
+ }
++error;
}
if (badsize(sizeof(Uint32), 4)) {
- if (verbose)
- SDL_Log("sizeof(Uint32) != 4, instead = %u\n",
- (unsigned int)sizeof(Uint32));
+ if (verbose) {
+ SDL_Log("sizeof(Uint32) != 4, instead = %u\n", (unsigned int)sizeof(Uint32));
+ }
++error;
}
if (badsize(sizeof(Uint64), 8)) {
- if (verbose)
- SDL_Log("sizeof(Uint64) != 8, instead = %u\n",
- (unsigned int)sizeof(Uint64));
+ if (verbose) {
+ SDL_Log("sizeof(Uint64) != 8, instead = %u\n", (unsigned int)sizeof(Uint64));
+ }
++error;
}
- if (verbose && !error)
+ if (verbose && !error) {
SDL_Log("All data types are the expected size.\n");
+ }
- return (error ? 1 : 0);
+ return error ? 1 : 0;
}
int
@@ -169,7 +170,7 @@ TestEndian(SDL_bool verbose)
}
++error;
}
- return (error ? 1 : 0);
+ return error ? 1 : 0;
}
static int TST_allmul (void *a, void *b, int arg, void *result, void *expected)
@@ -376,15 +377,17 @@ Test64Bit (SDL_bool verbose)
unsigned int *rl = (unsigned int *)&result;
if (!t->routine(&t->a, &t->b, t->arg, &result, &t->expected_result)) {
- if (verbose)
- SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n",
- t->operation, al[1], al[0], bl[1], bl[0], t->arg, rl[1], rl[0], el[1], el[0]);
+ if (verbose) {
+ SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n", t->operation, al[1], al[0], bl[1], bl[0],
+ t->arg, rl[1], rl[0], el[1], el[0]);
+ }
++failed;
}
}
- if (verbose && (failed == 0))
+ if (verbose && (failed == 0)) {
SDL_Log("All 64bit instrinsic tests passed\n");
- return (failed ? 1 : 0);
+ }
+ return failed ? 1 : 0;
}
int
@@ -411,7 +414,7 @@ TestCPUInfo(SDL_bool verbose)
SDL_Log("LASX %s\n", SDL_HasLASX()? "detected" : "not detected");
SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM());
}
- return (0);
+ return 0;
}
int
@@ -440,7 +443,7 @@ TestAssertions(SDL_bool verbose)
item = item->next;
}
}
- return (0);
+ return 0;
}
int
diff --git a/test/testqsort.c b/test/testqsort.c
index 29ea056..0bee0f4 100644
--- a/test/testqsort.c
+++ b/test/testqsort.c
@@ -49,8 +49,7 @@ main(int argc, char *argv[])
int iteration;
SDLTest_RandomContext rndctx;
- if (argc > 1)
- {
+ if (argc > 1) {
int success;
Uint64 seed = 0;
if (argv[1][0] == '0' && argv[1][1] == 'x')
@@ -66,9 +65,7 @@ main(int argc, char *argv[])
return 1;
}
SDLTest_RandomInit(&rndctx, (unsigned int)(seed >> 32), (unsigned int)(seed & 0xffffffff));
- }
- else
- {
+ } else {
SDLTest_RandomInitTime(&rndctx);
}
SDL_Log("Using random seed 0x%08x%08x\n", rndctx.x, rndctx.c);
diff --git a/test/testrelative.c b/test/testrelative.c
index 40c670b..c058b82 100644
--- a/test/testrelative.c
+++ b/test/testrelative.c
@@ -35,7 +35,7 @@ DrawRects(SDL_Renderer * renderer)
}
static void
-loop(){
+loop() {
/* Check for events */
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
@@ -51,17 +51,26 @@ loop(){
for (i = 0; i < state->num_windows; ++i) {
SDL_Rect viewport;
SDL_Renderer *renderer = state->renderers[i];
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
SDL_RenderClear(renderer);
/* Wrap the cursor rectangle at the screen edges to keep it visible */
SDL_RenderGetViewport(renderer, &viewport);
- if (rect.x < viewport.x) rect.x += viewport.w;
- if (rect.y < viewport.y) rect.y += viewport.h;
- if (rect.x > viewport.x + viewport.w) rect.x -= viewport.w;
- if (rect.y > viewport.y + viewport.h) rect.y -= viewport.h;
+ if (rect.x < viewport.x) {
+ rect.x += viewport.w;
+ }
+ if (rect.y < viewport.y) {
+ rect.y += viewport.h;
+ }
+ if (rect.x > viewport.x + viewport.w) {
+ rect.x -= viewport.w;
+ }
+ if (rect.y > viewport.y + viewport.h) {
+ rect.y -= viewport.h;
+ }
DrawRects(renderer);
@@ -83,7 +92,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc; ++i) {
@@ -102,7 +111,7 @@ main(int argc, char *argv[])
}
srand((unsigned int)time(NULL));
- if(SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
+ if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
return 3;
}
diff --git a/test/testrendercopyex.c b/test/testrendercopyex.c
index b954499..8d7ed3a 100644
--- a/test/testrendercopyex.c
+++ b/test/testrendercopyex.c
@@ -98,8 +98,9 @@ void loop()
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
Draw(&drawstates[i]);
}
#ifdef __EMSCRIPTEN__
@@ -121,7 +122,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
diff --git a/test/testrendertarget.c b/test/testrendertarget.c
index 0848beb..7143336 100644
--- a/test/testrendertarget.c
+++ b/test/testrendertarget.c
@@ -137,7 +137,7 @@ Draw(DrawState *s)
SDL_RenderGetViewport(s->renderer, &viewport);
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
- if (!target) {
+ if (target == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
return SDL_FALSE;
}
@@ -183,12 +183,17 @@ loop()
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
if (test_composite) {
- if (!DrawComposite(&drawstates[i])) done = 1;
+ if (!DrawComposite(&drawstates[i])) {
+ done = 1;
+ }
} else {
- if (!Draw(&drawstates[i])) done = 1;
+ if (!Draw(&drawstates[i])) {
+ done = 1;
+ }
}
}
#ifdef __EMSCRIPTEN__
@@ -210,7 +215,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
for (i = 1; i < argc;) {
diff --git a/test/testrumble.c b/test/testrumble.c
index 07fc89c..694e940 100644
--- a/test/testrumble.c
+++ b/test/testrumble.c
@@ -79,8 +79,9 @@ main(int argc, char **argv)
/* Try to find matching device */
else {
for (i = 0; i < SDL_NumHaptics(); i++) {
- if (SDL_strstr(SDL_HapticName(i), name) != NULL)
+ if (SDL_strstr(SDL_HapticName(i), name) != NULL) {
break;
+ }
}
if (i >= SDL_NumHaptics()) {
@@ -130,8 +131,9 @@ main(int argc, char **argv)
SDL_Delay(2000);
/* Quit */
- if (haptic != NULL)
+ if (haptic != NULL) {
SDL_HapticClose(haptic);
+ }
SDL_Quit();
return 0;
diff --git a/test/testscale.c b/test/testscale.c
index 0f1d21b..b9a4424 100644
--- a/test/testscale.c
+++ b/test/testscale.c
@@ -89,8 +89,9 @@ loop()
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
Draw(&drawstates[i]);
}
#ifdef __EMSCRIPTEN__
@@ -112,7 +113,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
diff --git a/test/testsem.c b/test/testsem.c
index bac5127..23d2f51 100644
--- a/test/testsem.c
+++ b/test/testsem.c
@@ -117,8 +117,9 @@ TestWaitTimeout(void)
SDL_Log("Wait took %" SDL_PRIu32 " milliseconds\n\n", duration);
/* Check to make sure the return value indicates timed out */
- if (retval != SDL_MUTEX_TIMEDOUT)
+ if (retval != SDL_MUTEX_TIMEDOUT) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n\n", retval, SDL_MUTEX_TIMEDOUT);
+ }
SDL_DestroySemaphore(sem);
}
@@ -135,7 +136,7 @@ TestOverheadUncontended(void)
SDL_Log("Doing %d uncontended Post/Wait operations on semaphore\n", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT);
start_ticks = SDL_GetTicks();
- for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++){
+ for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) {
for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
SDL_SemPost(sem);
}
@@ -157,14 +158,14 @@ ThreadFuncOverheadContended(void *data)
Thread_State *state = (Thread_State *) data;
if (state->flag) {
- while(alive) {
+ while (alive) {
if (SDL_SemTryWait(sem) == SDL_MUTEX_TIMEDOUT) {
++state->content_count;
}
++state->loop_count;
}
} else {
- while(alive) {
+ while (alive) {
/* Timeout needed to allow check on alive flag */
if (SDL_SemWaitTimeout(sem, 50) == SDL_MUTEX_TIMEDOUT) {
++state->content_count;
@@ -251,13 +252,13 @@ main(int argc, char **argv)
if (argc < 2) {
SDL_Log("Usage: %s init_value\n", argv[0]);
- return (1);
+ return 1;
}
/* Load the SDL library */
if (SDL_Init(0) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
signal(SIGTERM, killed);
signal(SIGINT, killed);
@@ -276,5 +277,5 @@ main(int argc, char **argv)
TestOverheadContended(SDL_TRUE);
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testsensor.c b/test/testsensor.c
index 73dd317..4414603 100644
--- a/test/testsensor.c
+++ b/test/testsensor.c
@@ -37,7 +37,7 @@ static const char *GetSensorTypeString(SDL_SensorType type)
static void HandleSensorEvent(SDL_SensorEvent *event)
{
SDL_Sensor *sensor = SDL_SensorFromInstanceID(event->which);
- if (!sensor) {
+ if (sensor == NULL) {
SDL_Log("Couldn't get sensor for sensor event\n");
return;
}
@@ -64,7 +64,7 @@ main(int argc, char **argv)
/* Load the SDL library */
if (SDL_Init(SDL_INIT_SENSOR) < 0) {
SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
num_sensors = SDL_NumSensors();
@@ -117,5 +117,5 @@ main(int argc, char **argv)
}
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testshader.c b/test/testshader.c
index 3c2da59..3b757e2 100644
--- a/test/testshader.c
+++ b/test/testshader.c
@@ -137,7 +137,7 @@ static SDL_bool CompileShader(GLhandleARB shader, const char *source)
glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
info = (char *) SDL_malloc(length + 1);
- if (!info) {
+ if (info == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
} else {
glGetInfoLogARB(shader, length, NULL, info);
@@ -165,7 +165,7 @@ static SDL_bool LinkProgram(ShaderData *data)
glGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
info = (char *) SDL_malloc(length + 1);
- if (!info) {
+ if (info == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
} else {
glGetInfoLogARB(data->program, length, NULL, info);
@@ -463,7 +463,7 @@ int main(int argc, char **argv)
/* Create a 640x480 OpenGL screen */
window = SDL_CreateWindow( "Shader Demo", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL );
- if ( !window ) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s\n", SDL_GetError());
SDL_Quit();
exit(2);
@@ -476,7 +476,7 @@ int main(int argc, char **argv)
}
surface = SDL_LoadBMP("icon.bmp");
- if ( ! surface ) {
+ if (surface == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s\n", SDL_GetError());
SDL_Quit();
exit(3);
diff --git a/test/testshape.c b/test/testshape.c
index 1497528..67fa6f7 100644
--- a/test/testshape.c
+++ b/test/testshape.c
@@ -58,30 +58,32 @@ int main(int argc,char** argv)
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
- if(argc < 2) {
+ if (argc < 2) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Shape requires at least one bitmap file as argument.");
exit(-1);
}
- if(SDL_VideoInit(NULL) == -1) {
+ if (SDL_VideoInit(NULL) == -1) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not initialize SDL video.");
exit(-2);
}
num_pictures = argc - 1;
pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
- if (!pictures) {
+ if (pictures == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory.");
exit(1);
}
- for(i=0;i<num_pictures;i++)
+ for (i = 0; i < num_pictures; i++) {
pictures[i].surface = NULL;
- for(i=0;i<num_pictures;i++) {
+ }
+ for (i=0;i<num_pictures;i++) {
pictures[i].surface = SDL_LoadBMP(argv[i+1]);
pictures[i].name = argv[i+1];
- if(pictures[i].surface == NULL) {
- for(j=0;j<num_pictures;j++)
+ if (pictures[i].surface == NULL) {
+ for (j = 0; j < num_pictures; j++) {
SDL_FreeSurface(pictures[j].surface);
+ }
SDL_free(pictures);
SDL_VideoQuit();
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not load surface from named bitmap file: %s", argv[i+1]);
@@ -89,11 +91,10 @@ int main(int argc,char** argv)
}
format = pictures[i].surface->format;
- if(SDL_ISPIXELFORMAT_ALPHA(format->format)) {
+ if (SDL_ISPIXELFORMAT_ALPHA(format->format)) {
pictures[i].mode.mode = ShapeModeBinarizeAlpha;
pictures[i].mode.parameters.binarizationCutoff = 255;
- }
- else {
+ } else {
pictures[i].mode.mode = ShapeModeColorKey;
pictures[i].mode.parameters.colorKey = black;
}
@@ -104,35 +105,41 @@ int main(int argc,char** argv)
SHAPED_WINDOW_DIMENSION,SHAPED_WINDOW_DIMENSION,
0);
SDL_SetWindowPosition(window, SHAPED_WINDOW_X, SHAPED_WINDOW_Y);
- if(window == NULL) {
- for(i=0;i<num_pictures;i++)
+ if (window == NULL) {
+ for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
+ }
SDL_free(pictures);
SDL_VideoQuit();
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
exit(-4);
}
renderer = SDL_CreateRenderer(window,-1,0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_DestroyWindow(window);
- for(i=0;i<num_pictures;i++)
+ for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
+ }
SDL_free(pictures);
SDL_VideoQuit();
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create rendering context for SDL_Shape window.");
exit(-5);
}
- for(i=0;i<num_pictures;i++)
+ for (i = 0; i < num_pictures; i++) {
pictures[i].texture = NULL;
- for(i=0;i<num_pictures;i++) {
+ }
+ for (i=0;i<num_pictures;i++) {
pictures[i].texture = SDL_CreateTextureFromSurface(renderer,pictures[i].surface);
- if(pictures[i].texture == NULL) {
- for(i=0;i<num_pictures;i++)
- if(pictures[i].texture != NULL)
+ if (pictures[i].texture == NULL) {
+ for (i=0;i<num_pictures;i++) {
+ if (pictures[i].texture != NULL) {
SDL_DestroyTexture(pictures[i].texture);
- for(i=0;i<num_pictures;i++)
+ }
+ }
+ for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
+ }
SDL_free(pictures);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
@@ -153,20 +160,21 @@ int main(int argc,char** argv)
SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
- while(should_exit == 0) {
+ while (should_exit == 0) {
while (SDL_PollEvent(&event)) {
- if(event.type == SDL_KEYDOWN) {
+ if (event.type == SDL_KEYDOWN) {
button_down = 1;
- if(event.key.keysym.sym == SDLK_ESCAPE) {
+ if (event.key.keysym.sym == SDLK_ESCAPE) {
should_exit = 1;
break;
}
}
- if(button_down && event.type == SDL_KEYUP) {
+ if (button_down && event.type == SDL_KEYUP) {
button_down = 0;
current_picture += 1;
- if(current_picture >= num_pictures)
+ if (current_picture >= num_pictures) {
current_picture = 0;
+ }
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name);
SDL_QueryTexture(pictures[current_picture].texture,(Uint32 *)&pixelFormat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);
SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
@@ -182,14 +190,16 @@ int main(int argc,char** argv)
}
/* Free the textures. */
- for(i=0;i<num_pictures;i++)
+ for (i = 0; i < num_pictures; i++) {
SDL_DestroyTexture(pictures[i].texture);
+ }
SDL_DestroyRenderer(renderer);
/* Destroy the window. */
SDL_DestroyWindow(window);
/* Free the original surfaces backing the textures. */
- for(i=0;i<num_pictures;i++)
+ for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
+ }
SDL_free(pictures);
/* Call SDL_VideoQuit() before quitting. */
SDL_VideoQuit();
diff --git a/test/testsprite2.c b/test/testsprite2.c
index a91ddd8..5b63bea 100644
--- a/test/testsprite2.c
+++ b/test/testsprite2.c
@@ -73,17 +73,17 @@ LoadSprite(const char *file)
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
if (!sprites[i]) {
- return (-1);
+ return -1;
}
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_DestroyTexture(sprites[i]);
- return (-1);
+ return -1;
}
}
/* We're ready to roll. :) */
- return (0);
+ return 0;
}
void
@@ -407,8 +407,9 @@ loop()
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
MoveSprites(state->renderers[i], sprites[i]);
}
#ifdef __EMSCRIPTEN__
@@ -442,7 +443,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
@@ -474,7 +475,9 @@ main(int argc, char *argv[])
} else if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
if (argv[i + 1]) {
iterations = SDL_atoi(argv[i + 1]);
- if (iterations < -1) iterations = -1;
+ if (iterations < -1) {
+ iterations = -1;
+ }
consumed = 2;
}
} else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
@@ -527,7 +530,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
- if (!sprites) {
+ if (sprites == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
@@ -543,7 +546,7 @@ main(int argc, char *argv[])
/* Allocate memory for the sprite info */
positions = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
velocities = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
- if (!positions || !velocities) {
+ if (positions == NULL || velocities == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
diff --git a/test/teststreaming.c b/test/teststreaming.c
index dc3ae61..e2ad9c1 100644
--- a/test/teststreaming.c
+++ b/test/teststreaming.c
@@ -161,19 +161,19 @@ main(int argc, char **argv)
SDL_WINDOWPOS_UNDEFINED,
MOOSEPIC_W*4, MOOSEPIC_H*4,
SDL_WINDOW_RESIZABLE);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
quit(3);
}
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
quit(4);
}
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
- if (!MooseTexture) {
+ if (MooseTexture == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
quit(5);
}
diff --git a/test/testthread.c b/test/testthread.c
index ea94dfb..894f994 100644
--- a/test/testthread.c
+++ b/test/testthread.c
@@ -57,14 +57,15 @@ ThreadFunc(void *data)
if (testprio) {
SDL_Log("SDL_SetThreadPriority(%s):%d\n", getprioritystr(prio), SDL_SetThreadPriority(prio));
- if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL)
+ if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL) {
prio = SDL_THREAD_PRIORITY_LOW;
+ }
}
SDL_Delay(1 * 1000);
}
SDL_Log("Thread '%s' exiting!\n", (char *) data);
- return (0);
+ return 0;
}
static void
@@ -88,7 +89,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(0) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
@@ -132,5 +133,5 @@ main(int argc, char *argv[])
raise(SIGTERM);
SDL_Quit(); /* Never reached */
- return (0); /* Never reached */
+ return 0; /* Never reached */
}
diff --git a/test/testtimer.c b/test/testtimer.c
index 126ba3b..5dd17ab 100644
--- a/test/testtimer.c
+++ b/test/testtimer.c
@@ -27,7 +27,7 @@ static Uint32 SDLCALL
ticktock(Uint32 interval, void *param)
{
++ticks;
- return (interval);
+ return interval;
}
static Uint32 SDLCALL
@@ -51,7 +51,7 @@ main(int argc, char *argv[])
if (SDL_Init(SDL_INIT_TIMER) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
@@ -101,14 +101,17 @@ main(int argc, char *argv[])
/* Test multiple timers */
SDL_Log("Testing multiple timers...\n");
t1 = SDL_AddTimer(100, callback, (void *) 1);
- if (!t1)
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 1: %s\n", SDL_GetError());
+ if (!t1) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s\n", SDL_GetError());
+ }
t2 = SDL_AddTimer(50, callback, (void *) 2);
- if (!t2)
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 2: %s\n", SDL_GetError());
+ if (!t2) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s\n", SDL_GetError());
+ }
t3 = SDL_AddTimer(233, callback, (void *) 3);
- if (!t3)
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 3: %s\n", SDL_GetError());
+ if (!t3) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s\n", SDL_GetError());
+ }
/* Wait 10 seconds */
SDL_Log("Waiting 10 seconds\n");
@@ -140,7 +143,7 @@ main(int argc, char *argv[])
SDL_Log("Delay 1 second = %d ms in ticks, %d ms in ticks64, %f ms according to performance counter\n", (int) (now32-start32), (int) (now64-start64), (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
SDL_Quit();
- return (0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testutils.c b/test/testutils.c
index a93afc1..765340b 100644
--- a/test/testutils.c
+++ b/test/testutils.c
@@ -139,7 +139,7 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
}
texture = SDL_CreateTextureFromSurface(renderer, temp);
- if (!texture) {
+ if (texture == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
}
}
diff --git a/test/testver.c b/test/testver.c
index cbbba7e..f452b9c 100644
--- a/test/testver.c
+++ b/test/testver.c
@@ -43,5 +43,5 @@ main(int argc, char *argv[])
linked.major, linked.minor, linked.patch,
SDL_GetRevision());
SDL_Quit();
- return (0);
+ return 0;
}
diff --git a/test/testviewport.c b/test/testviewport.c
index ad5faf7..ecdb430 100644
--- a/test/testviewport.c
+++ b/test/testviewport.c
@@ -103,8 +103,9 @@ loop()
int i;
#ifdef __EMSCRIPTEN__
/* Avoid using delays */
- if(SDL_GetTicks() - wait_start < 1000)
+ if (SDL_GetTicks() - wait_start < 1000) {
return;
+ }
wait_start = SDL_GetTicks();
#endif
/* Check for events */
@@ -121,8 +122,9 @@ loop()
SDL_Log("Current Viewport x=%i y=%i w=%i h=%i", viewport.x, viewport.y, viewport.w, viewport.h);
for (i = 0; i < state->num_windows; ++i) {
- if (state->windows[i] == NULL)
+ if (state->windows[i] == NULL) {
continue;
+ }
/* Draw using viewport */
DrawOnViewport(state->renderers[i]);
@@ -153,7 +155,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
diff --git a/test/testvulkan.c b/test/testvulkan.c
index 4b65179..4fe2c10 100644
--- a/test/testvulkan.c
+++ b/test/testvulkan.c
@@ -233,7 +233,7 @@ static void createInstance(void)
quit(2);
}
extensions = (const char **) SDL_malloc(sizeof(const char *) * extensionCount);
- if (!extensions) {
+ if (extensions == NULL) {
SDL_OutOfMemory();
quit(2);
}
@@ -309,7 +309,7 @@ static void findPhysicalDevice(void)
quit(2);
}
physicalDevices = (VkPhysicalDevice *) SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount);
- if (!physicalDevices) {
+ if (physicalDevices == NULL) {
SDL_OutOfMemory();
quit(2);
}
@@ -331,7 +331,7 @@ static void findPhysicalDevice(void)
VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex];
vkGetPhysicalDeviceProperties(physicalDevice, &vulkanContext->physicalDeviceProperties);
- if(VK_VERSION_MAJOR(vulkanContext->physicalDeviceProperties.apiVersion) < 1) {
+ if (VK_VERSION_MAJOR(vulkanContext->physicalDeviceProperties.apiVersion) < 1) {
continue;
}
vkGetPhysicalDeviceFeatures(physicalDevice, &vulkanContext->physicalDeviceFeatures);
@@ -343,7 +343,7 @@ static void findPhysicalDevice(void)
SDL_free(queueFamiliesProperties);
queueFamiliesPropertiesAllocatedSize = queueFamiliesCount;
queueFamiliesProperties = (VkQueueFamilyProperties *) SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize);
- if (!queueFamiliesProperties) {
+ if (queueFamiliesProperties == NULL) {
SDL_free(physicalDevices);
SDL_free(deviceExtensions);
SDL_OutOfMemory();
@@ -389,8 +389,7 @@ static void findPhysicalDevice(void)
continue;
}
result = vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &deviceExtensionCount, NULL);
- if (result != VK_SUCCESS)
- {
+ if (result != VK_SUCCESS) {
SDL_free(physicalDevices);
SDL_free(queueFamiliesProperties);
SDL_free(deviceExtensions);
@@ -406,7 +405,7 @@ static void findPhysicalDevice(void)
SDL_free(deviceExtensions);
deviceExtensionsAllocatedSize = deviceExtensionCount;
deviceExtensions = SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize);
- if (!deviceExtensions) {
+ if (deviceExtensions == NULL) {
SDL_free(physicalDevices);
SDL_free(queueFamiliesProperties);
SDL_OutOfMemory();
@@ -424,7 +423,7 @@ static void findPhysicalDevice(void)
quit(2);
}
for (i = 0; i < deviceExtensionCount; i++) {
- if(SDL_strcmp(deviceExtensions[i].extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) {
+ if (SDL_strcmp(deviceExtensions[i].extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) {
hasSwapchainExtension = SDL_TRUE;
break;
}
@@ -641,7 +640,7 @@ static SDL_bool createSwapchain(void)
} else {
vulkanContext->surfaceFormat = vulkanContext->surfaceFormats[0];
for (i = 0; i < vulkanContext->surfaceFormatsCount; i++) {
- if(vulkanContext->surfaceFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM) {
+ if (vulkanContext->surfaceFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM) {
vulkanContext->surfaceFormat = vulkanContext->surfaceFormats[i];
break;
}
@@ -687,7 +686,7 @@ static SDL_bool createSwapchain(void)
vkDestroySwapchainKHR(vulkanContext->device, createInfo.oldSwapchain, NULL);
}
- if(result != VK_SUCCESS) {
+ if (result != VK_SUCCESS) {
vulkanContext->swapchain = VK_NULL_HANDLE;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"vkCreateSwapchainKHR(): %s\n",
@@ -756,7 +755,7 @@ static void createCommandBuffers(void)
allocateInfo.commandBufferCount = vulkanContext->swapchainImageCount;
vulkanContext->commandBuffers = (VkCommandBuffer *) SDL_malloc(sizeof(VkCommandBuffer) * vulkanContext->swapchainImageCount);
result = vkAllocateCommandBuffers(vulkanContext->device, &allocateInfo, vulkanContext->commandBuffers);
- if(result != VK_SUCCESS) {
+ if (result != VK_SUCCESS) {
SDL_free(vulkanContext->commandBuffers);
vulkanContext->commandBuffers = NULL;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
@@ -781,8 +780,8 @@ static void createFences(void)
createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
createInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
result = vkCreateFence(vulkanContext->device, &createInfo, NULL, &vulkanContext->fences[i]);
- if(result != VK_SUCCESS) {
- for(; i > 0; i--) {
+ if (result != VK_SUCCESS) {
+ for (; i > 0; i--) {
vkDestroyFence(vulkanContext->device, vulkanContext->fences[i - 1], NULL);
}
SDL_free(vulkanContext->fences);
@@ -851,7 +850,7 @@ static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue *
VkImageSubresourceRange clearRange = {0};
VkResult result = vkResetCommandBuffer(commandBuffer, 0);
- if(result != VK_SUCCESS) {
+ if (result != VK_SUCCESS) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"vkResetCommandBuffer(): %s\n",
getVulkanResultString(result));
@@ -909,7 +908,7 @@ static SDL_bool createNewSwapchainAndSwapchainSpecificStuff(void)
destroySwapchainAndSwapchainSpecificStuff(SDL_FALSE);
getSurfaceCaps();
getSurfaceFormats();
- if(!createSwapchain()) {
+ if (!createSwapchain()) {
return SDL_FALSE;
}
createCommandPool();
@@ -925,7 +924,7 @@ static void initVulkan(void)
SDL_Vulkan_LoadLibrary(NULL);
vulkanContexts = (VulkanContext *) SDL_calloc(state->num_windows, sizeof (VulkanContext));
- if (!vulkanContexts) {
+ if (vulkanContexts == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
quit(2);
}
@@ -1000,8 +999,9 @@ static SDL_bool render(void)
if (!vulkanContext->swapchain) {
SDL_bool retval = createNewSwapchainAndSwapchainSpecificStuff();
- if(!retval)
+ if (!retval) {
SDL_Delay(100);
+ }
return retval;
}
result = vkAcquireNextImageKHR(vulkanContext->device,
@@ -1068,7 +1068,7 @@ static SDL_bool render(void)
quit(2);
}
SDL_Vulkan_GetDrawableSize(vulkanContext->window, &w, &h);
- if(w != (int)vulkanContext->swapchainSize.width || h != (int)vulkanContext->swapchainSize.height) {
+ if (w != (int)vulkanContext->swapchainSize.width || h != (int)vulkanContext->swapchainSize.height) {
return createNewSwapchainAndSwapchainSpecificStuff();
}
return SDL_TRUE;
@@ -1087,7 +1087,7 @@ int main(int argc, char **argv)
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if(!state) {
+ if (state == NULL) {
return 1;
}
@@ -1117,7 +1117,7 @@ int main(int argc, char **argv)
while (!done) {
/* Check for events */
frames++;
- while(SDL_PollEvent(&event)) {
+ while (SDL_PollEvent(&event)) {
/* Need to destroy the swapchain before the window created
* by SDL.
*/
diff --git a/test/testwm2.c b/test/testwm2.c
index eeb8d8e..7fe8238 100644
--- a/test/testwm2.c
+++ b/test/testwm2.c
@@ -264,7 +264,7 @@ main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
- if (!state) {
+ if (state == NULL) {
return 1;
}
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
quit(0);
/* keep the compiler happy ... */
- return(0);
+ return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/test/testyuv.c b/test/testyuv.c
index df0d943..a094906 100644
--- a/test/testyuv.c
+++ b/test/testyuv.c
@@ -25,9 +25,7 @@
/* Return true if the YUV format is packed pixels */
static SDL_bool is_packed_yuv_format(Uint32 format)
{
- return (format == SDL_PIXELFORMAT_YUY2 ||
- format == SDL_PIXELFORMAT_UYVY ||
- format == SDL_PIXELFORMAT_YVYU);
+ return format == SDL_PIXELFORMAT_YUY2 || format == SDL_PIXELFORMAT_UYVY || format == SDL_PIXELFORMAT_YVYU;
}
/* Create a surface with a good pattern for verifying YUV conversion */
@@ -79,7 +77,7 @@ static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch,
SDL_bool result = SDL_FALSE;
rgb = (Uint8 *)SDL_malloc(size);
- if (!rgb) {
+ if (rgb == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory");
return SDL_FALSE;
}
@@ -130,7 +128,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch)
int yuv1_pitch, yuv2_pitch;
int result = -1;
- if (!pattern || !yuv1 || !yuv2) {
+ if (pattern == NULL || yuv1 == NULL || yuv2 == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces");
goto done;
}
@@ -332,7 +330,7 @@ main(int argc, char **argv)
filename = "testyuv.bmp";
}
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0);
- if (!original) {
+ if (original == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
return 3;
}
@@ -344,7 +342,7 @@ main(int argc, char **argv)
pitch = CalculateYUVPitch(yuv_format, original->w);
converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format);
- if (!converted) {
+ if (converted == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
return 3;
}
@@ -361,13 +359,13 @@ main(int argc, char **argv)
SDL_WINDOWPOS_UNDEFINED,
original->w, original->h,
0);
- if (!window) {
+ if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
return 4;
}
renderer = SDL_CreateRenderer(window, -1, 0);
- if (!renderer) {
+ if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
return 4;
}
@@ -402,8 +400,7 @@ main(int argc, char **argv)
}
{ int done = 0;
- while ( !done )
- {
+ while ( !done ) {
SDL_Event event;
while (SDL_PollEvent(&event) > 0) {
if (event.type == SDL_QUIT) {
diff --git a/test/testyuv_cvt.c b/test/testyuv_cvt.c
index ed354d8..f058f5c 100644
--- a/test/testyuv_cvt.c
+++ b/test/testyuv_cvt.c
@@ -17,7 +17,7 @@
static float clip3(float x, float y, float z)
{
- return ((z < x) ? x : ((z > y) ? y : z));
+ return (z < x) ? x : ((z > y) ? y : z);
}
static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
@@ -68,8 +68,9 @@ static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int mo
if (luminance != 100) {
yuv[0] = yuv[0] * luminance / 100;
- if (yuv[0] > 255)
+ if (yuv[0] > 255) {
yuv[0] = 255;
+ }
}
}
@@ -291,7 +292,7 @@ int CalculateYUVPitch(Uint32 format, int width)
case SDL_PIXELFORMAT_YUY2:
case SDL_PIXELFORMAT_UYVY:
case SDL_PIXELFORMAT_YVYU:
- return 4*((width + 1)/2);
+ return 4 * ((width + 1) / 2);
default:
return 0;
}
diff --git a/test/torturethread.c b/test/torturethread.c
index d76f077..8c67569 100644
--- a/test/torturethread.c
+++ b/test/torturethread.c
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
/* Load the SDL library */
if (SDL_Init(0) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
- return (1);
+ return 1;
}
signal(SIGSEGV, SIG_DFL);
@@ -109,5 +109,5 @@ main(int argc, char *argv[])
SDL_WaitThread(threads[i], NULL);
}
SDL_Quit();
- return (0);
+ return 0;
}