diff --git a/include/Nazara/Core/Unicode.hpp b/include/Nazara/Core/Unicode.hpp index 313e93b5e..e5f8119bf 100644 --- a/include/Nazara/Core/Unicode.hpp +++ b/include/Nazara/Core/Unicode.hpp @@ -25,58 +25,58 @@ namespace Nz enum Category : UInt16 { // Category not handled by Nazara - Category_NoCategory = 0, + Category_NoCategory = 0, // Letters - Category_Letter = 0x01, // L - Category_Letter_Lowercase = Category_Letter | 0x0100, // Ll - Category_Letter_Modifier = Category_Letter | 0x0200, // Lm - Category_Letter_Other = Category_Letter | 0x0400, // Lo - Category_Letter_Titlecase = Category_Letter | 0x0800, // Lt - Category_Letter_Uppercase = Category_Letter | 0x1000, // Lu + Category_Letter = 0x01, // L + Category_Letter_Lowercase = Category_Letter | 0x0100, // Ll + Category_Letter_Modifier = Category_Letter | 0x0200, // Lm + Category_Letter_Other = Category_Letter | 0x0400, // Lo + Category_Letter_Titlecase = Category_Letter | 0x0800, // Lt + Category_Letter_Uppercase = Category_Letter | 0x1000, // Lu // Marks - Category_Mark = 0x02, // M - Category_Mark_Enclosing = Category_Mark | 0x100, // Me - Category_Mark_NonSpacing = Category_Mark | 0x200, // Mn - Category_Mark_SpacingCombining = Category_Mark | 0x400, // Mc + Category_Mark = 0x02, // M + Category_Mark_Enclosing = Category_Mark | 0x100, // Me + Category_Mark_NonSpacing = Category_Mark | 0x200, // Mn + Category_Mark_SpacingCombining = Category_Mark | 0x400, // Mc // Numbers - Category_Number = 0x04, // N - Category_Number_DecimalDigit = Category_Number | 0x100, // Nd - Category_Number_Letter = Category_Number | 0x200, // Nl - Category_Number_Other = Category_Number | 0x400, // No + Category_Number = 0x04, // N + Category_Number_DecimalDigit = Category_Number | 0x100, // Nd + Category_Number_Letter = Category_Number | 0x200, // Nl + Category_Number_Other = Category_Number | 0x400, // No // Others - Category_Other = 0x08, // C - Category_Other_Control = Category_Other | 0x0100, // Cc - Category_Other_Format = Category_Other | 0x0200, // Cf - Category_Other_NotAssigned = Category_Other | 0x0400, // Cn - Category_Other_PrivateUse = Category_Other | 0x0800, // Co - Category_Other_Surrogate = Category_Other | 0x1000, // Cs + Category_Other = 0x08, // C + Category_Other_Control = Category_Other | 0x0100, // Cc + Category_Other_Format = Category_Other | 0x0200, // Cf + Category_Other_NotAssigned = Category_Other | 0x0400, // Cn + Category_Other_PrivateUse = Category_Other | 0x0800, // Co + Category_Other_Surrogate = Category_Other | 0x1000, // Cs // Punctuations - Category_Punctuation = 0x10, // P - Category_Punctuation_Close = Category_Punctuation | 0x0100, // Pe - Category_Punctuation_Connector = Category_Punctuation | 0x0200, // Pc - Category_Punctuation_Dash = Category_Punctuation | 0x0400, // Pd - Category_Punctuation_FinalQuote = Category_Punctuation | 0x0800, // Pf - Category_Punctuation_InitialQuote = Category_Punctuation | 0x1000, // Pi - Category_Punctuation_Open = Category_Punctuation | 0x2000, // Ps - Category_Punctuation_Other = Category_Punctuation | 0x4000, // Po + Category_Punctuation = 0x10, // P + Category_Punctuation_Close = Category_Punctuation | 0x0100, // Pe + Category_Punctuation_Connector = Category_Punctuation | 0x0200, // Pc + Category_Punctuation_Dash = Category_Punctuation | 0x0400, // Pd + Category_Punctuation_FinalQuote = Category_Punctuation | 0x0800, // Pf + Category_Punctuation_InitialQuote = Category_Punctuation | 0x1000, // Pi + Category_Punctuation_Open = Category_Punctuation | 0x2000, // Ps + Category_Punctuation_Other = Category_Punctuation | 0x4000, // Po // Spaces - Category_Separator = 0x20, // Z - Category_Separator_Line = Category_Separator | 0x0100, // Zl - Category_Separator_Paragraph = Category_Separator | 0x0200, // Zp - Category_Separator_Space = Category_Separator | 0x0400, // Zs + Category_Separator = 0x20, // Z + Category_Separator_Line = Category_Separator | 0x0100, // Zl + Category_Separator_Paragraph = Category_Separator | 0x0200, // Zp + Category_Separator_Space = Category_Separator | 0x0400, // Zs // Symbols - Category_Symbol = 0x40, // S - Category_Symbol_Currency = Category_Symbol | 0x0100, // Sc - Category_Symbol_Math = Category_Symbol | 0x0200, // Sm - Category_Symbol_Modifier = Category_Symbol | 0x0400, // Sk - Category_Symbol_Other = Category_Symbol | 0x0800 // So + Category_Symbol = 0x40, // S + Category_Symbol_Currency = Category_Symbol | 0x0100, // Sc + Category_Symbol_Math = Category_Symbol | 0x0200, // Sm + Category_Symbol_Modifier = Category_Symbol | 0x0400, // Sk + Category_Symbol_Other = Category_Symbol | 0x0800 // So }; enum Direction : UInt8 diff --git a/src/Nazara/Core/Hash/MD5.cpp b/src/Nazara/Core/Hash/MD5.cpp index 97902ede7..88870750e 100644 --- a/src/Nazara/Core/Hash/MD5.cpp +++ b/src/Nazara/Core/Hash/MD5.cpp @@ -34,67 +34,67 @@ #define T_MASK (static_cast(~0)) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) -#define T3 0x242070db +#define T3 0x242070db #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) -#define T6 0x4787c62a +#define T6 0x4787c62a #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) -#define T9 0x698098d8 +#define T9 0x698098d8 #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) -#define T13 0x6b901122 +#define T13 0x6b901122 #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) -#define T16 0x49b40821 +#define T16 0x49b40821 #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) -#define T19 0x265e5a51 +#define T19 0x265e5a51 #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) -#define T22 0x02441453 +#define T22 0x02441453 #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) -#define T25 0x21e1cde6 +#define T25 0x21e1cde6 #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) -#define T28 0x455a14ed +#define T28 0x455a14ed #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) -#define T31 0x676f02d9 +#define T31 0x676f02d9 #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) -#define T35 0x6d9d6122 +#define T35 0x6d9d6122 #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) -#define T38 0x4bdecfa9 +#define T38 0x4bdecfa9 #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) -#define T41 0x289b7ec6 +#define T41 0x289b7ec6 #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) -#define T44 0x04881d05 +#define T44 0x04881d05 #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) -#define T47 0x1fa27cf8 +#define T47 0x1fa27cf8 #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) -#define T50 0x432aff97 +#define T50 0x432aff97 #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) -#define T53 0x655b59c3 +#define T53 0x655b59c3 #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) -#define T57 0x6fa87e4f +#define T57 0x6fa87e4f #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) -#define T60 0x4e0811a1 +#define T60 0x4e0811a1 #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) -#define T63 0x2ad7d2bb +#define T63 0x2ad7d2bb #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) namespace Nz diff --git a/src/Nazara/Core/Hash/SHA/Internal.cpp b/src/Nazara/Core/Hash/SHA/Internal.cpp index 2c98ffe98..f87070b7d 100644 --- a/src/Nazara/Core/Hash/SHA/Internal.cpp +++ b/src/Nazara/Core/Hash/SHA/Internal.cpp @@ -3,9 +3,9 @@ // For conditions of distribution and use, see copyright notice in Config.hpp /* - * FILE: sha2.c - * AUTHOR: Aaron D. Gifford - * http://www.aarongifford.com/computers/sha.html + * FILE: sha2.c + * AUTHOR: Aaron D. Gifford + * http://www.aarongifford.com/computers/sha.html * * Copyright (c) 2000-2003, Aaron D. Gifford * All rights reserved. @@ -48,13 +48,13 @@ namespace Nz /*** ENDIAN REVERSAL MACROS *******************************************/ #ifdef NAZARA_LITTLE_ENDIAN - #define REVERSE32(w,x) { \ + #define REVERSE32(w,x) { \ UInt32 tmp = (w); \ tmp = (tmp >> 16) | (tmp << 16); \ (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ } - #define REVERSE64(w,x) { \ + #define REVERSE64(w,x) { \ UInt64 tmp = (w); \ tmp = (tmp >> 32) | (tmp << 32); \ tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ @@ -69,7 +69,7 @@ namespace Nz * unsigned 128-bit integer (represented using a two-element array of * 64-bit words): */ - #define ADDINC128(w,n) { \ + #define ADDINC128(w,n) { \ (w)[0] += static_cast(n); \ if ((w)[0] < (n)) { \ (w)[1]++; \ @@ -97,32 +97,32 @@ namespace Nz * unexpected side-effects if used without taking this into account. */ /* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ - #define SHR(b,x) ((x) >> (b)) + #define SHR(b,x) ((x) >> (b)) /* 32-bit Rotate-right (used in SHA-256): */ - #define ROTR32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) + #define ROTR32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) /* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ - #define ROTR64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) + #define ROTR64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) /* 32-bit Rotate-left (used in SHA-1): */ - #define ROTL32(b,x) (((x) << (b)) | ((x) >> (32 - (b)))) + #define ROTL32(b,x) (((x) << (b)) | ((x) >> (32 - (b)))) /* Two logical functions used in SHA-1, SHA-254, SHA-256, SHA-384, and SHA-512: */ - #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) - #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + #define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) + #define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) /* Function used in SHA-1: */ - #define Parity(x,y,z) ((x) ^ (y) ^ (z)) + #define Parity(x,y,z) ((x) ^ (y) ^ (z)) /* Four logical functions used in SHA-256: */ - #define Sigma0_256(x) (ROTR32(2, (x)) ^ ROTR32(13, (x)) ^ ROTR32(22, (x))) - #define Sigma1_256(x) (ROTR32(6, (x)) ^ ROTR32(11, (x)) ^ ROTR32(25, (x))) - #define sigma0_256(x) (ROTR32(7, (x)) ^ ROTR32(18, (x)) ^ SHR( 3 , (x))) - #define sigma1_256(x) (ROTR32(17, (x)) ^ ROTR32(19, (x)) ^ SHR( 10, (x))) + #define Sigma0_256(x) (ROTR32(2, (x)) ^ ROTR32(13, (x)) ^ ROTR32(22, (x))) + #define Sigma1_256(x) (ROTR32(6, (x)) ^ ROTR32(11, (x)) ^ ROTR32(25, (x))) + #define sigma0_256(x) (ROTR32(7, (x)) ^ ROTR32(18, (x)) ^ SHR( 3 , (x))) + #define sigma1_256(x) (ROTR32(17, (x)) ^ ROTR32(19, (x)) ^ SHR( 10, (x))) /* Four of six logical functions used in SHA-384 and SHA-512: */ - #define Sigma0_512(x) (ROTR64(28, (x)) ^ ROTR64(34, (x)) ^ ROTR64(39, (x))) - #define Sigma1_512(x) (ROTR64(14, (x)) ^ ROTR64(18, (x)) ^ ROTR64(41, (x))) - #define sigma0_512(x) (ROTR64( 1, (x)) ^ ROTR64( 8, (x)) ^ SHR( 7, (x))) - #define sigma1_512(x) (ROTR64(19, (x)) ^ ROTR64(61, (x)) ^ SHR( 6, (x))) + #define Sigma0_512(x) (ROTR64(28, (x)) ^ ROTR64(34, (x)) ^ ROTR64(39, (x))) + #define Sigma1_512(x) (ROTR64(14, (x)) ^ ROTR64(18, (x)) ^ ROTR64(41, (x))) + #define sigma0_512(x) (ROTR64( 1, (x)) ^ ROTR64( 8, (x)) ^ SHR( 7, (x))) + #define sigma1_512(x) (ROTR64(19, (x)) ^ ROTR64(61, (x)) ^ SHR( 6, (x))) /*** INTERNAL FUNCTION PROTOTYPES *************************************/ @@ -140,10 +140,10 @@ namespace Nz /*** SHA2 INITIAL HASH VALUES AND CONSTANTS ***************************/ /* Hash constant words K for SHA-1: */ - #define K1_0_TO_19 0x5a827999UL - #define K1_20_TO_39 0x6ed9eba1UL - #define K1_40_TO_59 0x8f1bbcdcUL - #define K1_60_TO_79 0xca62c1d6UL + #define K1_0_TO_19 0x5a827999UL + #define K1_20_TO_39 0x6ed9eba1UL + #define K1_40_TO_59 0x8f1bbcdcUL + #define K1_60_TO_79 0xca62c1d6UL /* Initial hash value H for SHA-1: */ const static UInt32 sha1_initial_hash_value[5] = { @@ -278,45 +278,45 @@ namespace Nz #ifdef NAZARA_LITTLE_ENDIAN - #define ROUND1_0_TO_15(a,b,c,d,e) \ - REVERSE32(*data++, W1[j]); \ + #define ROUND1_0_TO_15(a,b,c,d,e) \ + REVERSE32(*data++, W1[j]); \ (e) = ROTL32(5, (a)) + Ch((b), (c), (d)) + (e) + \ - K1_0_TO_19 + W1[j]; \ - (b) = ROTL32(30, (b)); \ + K1_0_TO_19 + W1[j]; \ + (b) = ROTL32(30, (b)); \ j++; #else // NAZARA_LITTLE_ENDIAN - #define ROUND1_0_TO_15(a,b,c,d,e) \ + #define ROUND1_0_TO_15(a,b,c,d,e) \ (e) = ROTL32(5, (a)) + Ch((b), (c), (d)) + (e) + \ - K1_0_TO_19 + ( W1[j] = *data++ ); \ - (b) = ROTL32(30, (b)); \ + K1_0_TO_19 + ( W1[j] = *data++ ); \ + (b) = ROTL32(30, (b)); \ j++; #endif // NAZARA_LITTLE_ENDIAN - #define ROUND1_16_TO_19(a,b,c,d,e) \ - T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ - (e) = ROTL32(5, a) + Ch(b,c,d) + e + K1_0_TO_19 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ - (b) = ROTL32(30, b); \ + #define ROUND1_16_TO_19(a,b,c,d,e) \ + T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ + (e) = ROTL32(5, a) + Ch(b,c,d) + e + K1_0_TO_19 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ + (b) = ROTL32(30, b); \ j++; - #define ROUND1_20_TO_39(a,b,c,d,e) \ - T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ - (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_20_TO_39 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ - (b) = ROTL32(30, b); \ + #define ROUND1_20_TO_39(a,b,c,d,e) \ + T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ + (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_20_TO_39 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ + (b) = ROTL32(30, b); \ j++; - #define ROUND1_40_TO_59(a,b,c,d,e) \ - T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ - (e) = ROTL32(5, a) + Maj(b,c,d) + e + K1_40_TO_59 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ - (b) = ROTL32(30, b); \ + #define ROUND1_40_TO_59(a,b,c,d,e) \ + T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ + (e) = ROTL32(5, a) + Maj(b,c,d) + e + K1_40_TO_59 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ + (b) = ROTL32(30, b); \ j++; - #define ROUND1_60_TO_79(a,b,c,d,e) \ - T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ - (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_60_TO_79 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ - (b) = ROTL32(30, b); \ + #define ROUND1_60_TO_79(a,b,c,d,e) \ + T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \ + (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_60_TO_79 + ( W1[j&0x0f] = ROTL32(1, T1) ); \ + (b) = ROTL32(30, b); \ j++; namespace @@ -325,7 +325,7 @@ namespace Nz { UInt32 a, b, c, d, e; UInt32 T1, *W1; - int j; + int j; W1 = reinterpret_cast(context->s1.buffer); @@ -559,7 +559,7 @@ namespace Nz #ifdef NAZARA_LITTLE_ENDIAN - #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ REVERSE32(*data++, W256[j]); \ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ K256[j] + W256[j]; \ @@ -569,7 +569,7 @@ namespace Nz #else // NAZARA_LITTLE_ENDIAN - #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ K256[j] + (W256[j] = *data++); \ (d) += T1; \ @@ -578,7 +578,7 @@ namespace Nz #endif // NAZARA_LITTLE_ENDIAN - #define ROUND256(a,b,c,d,e,f,g,h) \ + #define ROUND256(a,b,c,d,e,f,g,h) \ s0 = W256[(j+1)&0x0f]; \ s0 = sigma0_256(s0); \ s1 = W256[(j+14)&0x0f]; \ @@ -593,7 +593,7 @@ namespace Nz { UInt32 a, b, c, d, e, f, g, h; UInt32 T1, *W256; - int j; + int j; W256 = reinterpret_cast(context->s256.buffer); @@ -819,7 +819,7 @@ namespace Nz /* Unrolled SHA-512 round macros: */ #ifdef NAZARA_LITTLE_ENDIAN - #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ REVERSE64(*data++, W512[j]); \ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ K512[j] + W512[j]; \ @@ -830,7 +830,7 @@ namespace Nz #else // NAZARA_LITTLE_ENDIAN - #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ K512[j] + (W512[j] = *data++); \ (d) += T1; \ @@ -839,7 +839,7 @@ namespace Nz #endif // NAZARA_LITTLE_ENDIAN - #define ROUND512(a,b,c,d,e,f,g,h) \ + #define ROUND512(a,b,c,d,e,f,g,h) \ s0 = W512[(j+1)&0x0f]; \ s0 = sigma0_512(s0); \ s1 = W512[(j+14)&0x0f]; \ @@ -854,7 +854,7 @@ namespace Nz { UInt64 a, b, c, d, e, f, g, h, s0, s1; UInt64 T1, *W512 = reinterpret_cast(context->s512.buffer); - int j; + int j; /* Initialize registers with the prev. intermediate value */ a = context->s512.state[0]; diff --git a/src/Nazara/Core/Hash/Whirlpool.cpp b/src/Nazara/Core/Hash/Whirlpool.cpp index 7345e69a4..0f592b5af 100644 --- a/src/Nazara/Core/Hash/Whirlpool.cpp +++ b/src/Nazara/Core/Hash/Whirlpool.cpp @@ -14,10 +14,10 @@ * Vincent Rijmen. * * See - * P.S.L.M. Barreto, V. Rijmen, - * ``The Whirlpool hashing function,'' - * NESSIE submission, 2000 (tweaked version, 2001), - * + * P.S.L.M. Barreto, V. Rijmen, + * ``The Whirlpool hashing function,'' + * NESSIE submission, 2000 (tweaked version, 2001), + * * * @author Paulo S.L.M. Barreto * @author Vincent Rijmen. @@ -36,8 +36,8 @@ * * - Generation of ISO/IEC 10118-3 test vectors. * - Bug fix: nonzero carry was ignored when tallying the data length - * (this bug apparently only manifested itself when feeding data - * in pieces rather than in a single chunk at once). + * (this bug apparently only manifested itself when feeding data + * in pieces rather than in a single chunk at once). * - Support for MS Visual C++ 64-bit integer arithmetic. * * Differences from version 1.0: @@ -765,7 +765,7 @@ namespace Nz digest[4] = static_cast(m_hash[i] >> 24); digest[5] = static_cast(m_hash[i] >> 16); digest[6] = static_cast(m_hash[i] >> 8); - digest[7] = static_cast(m_hash[i] ); + digest[7] = static_cast(m_hash[i] ); digest += 8; } @@ -791,7 +791,7 @@ namespace Nz NAZARA_USE_ANONYMOUS_NAMESPACE int i, r; - UInt64 K[8]; // the round key + UInt64 K[8]; // the round key UInt64 block[8]; // mu(buffer) UInt64 state[8]; // the cipher state UInt64 L[8]; @@ -801,14 +801,14 @@ namespace Nz for (i = 0; i < 8; i++, buffer += 8) { block[i] = - ((static_cast(buffer[0]) ) << 56) ^ + ((static_cast(buffer[0]) ) << 56) ^ ((static_cast(buffer[1]) & 0xFFL) << 48) ^ ((static_cast(buffer[2]) & 0xFFL) << 40) ^ ((static_cast(buffer[3]) & 0xFFL) << 32) ^ ((static_cast(buffer[4]) & 0xFFL) << 24) ^ ((static_cast(buffer[5]) & 0xFFL) << 16) ^ ((static_cast(buffer[6]) & 0xFFL) << 8) ^ - ((static_cast(buffer[7]) & 0xFFL) ); + ((static_cast(buffer[7]) & 0xFFL) ); } // compute and apply K^0 to the cipher state @@ -826,84 +826,84 @@ namespace Nz { // compute K^r from K^{r-1} L[0] = - C0[static_cast(K[0] >> 56) ] ^ + C0[static_cast(K[0] >> 56) ] ^ C1[static_cast(K[7] >> 48) & 0xFF] ^ C2[static_cast(K[6] >> 40) & 0xFF] ^ C3[static_cast(K[5] >> 32) & 0xFF] ^ C4[static_cast(K[4] >> 24) & 0xFF] ^ C5[static_cast(K[3] >> 16) & 0xFF] ^ C6[static_cast(K[2] >> 8) & 0xFF] ^ - C7[static_cast(K[1] ) & 0xFF] ^ + C7[static_cast(K[1] ) & 0xFF] ^ rc[r]; L[1] = - C0[static_cast(K[1] >> 56) ] ^ + C0[static_cast(K[1] >> 56) ] ^ C1[static_cast(K[0] >> 48) & 0xFF] ^ C2[static_cast(K[7] >> 40) & 0xFF] ^ C3[static_cast(K[6] >> 32) & 0xFF] ^ C4[static_cast(K[5] >> 24) & 0xFF] ^ C5[static_cast(K[4] >> 16) & 0xFF] ^ C6[static_cast(K[3] >> 8) & 0xFF] ^ - C7[static_cast(K[2] ) & 0xFF]; + C7[static_cast(K[2] ) & 0xFF]; L[2] = - C0[static_cast(K[2] >> 56) ] ^ + C0[static_cast(K[2] >> 56) ] ^ C1[static_cast(K[1] >> 48) & 0xFF] ^ C2[static_cast(K[0] >> 40) & 0xFF] ^ C3[static_cast(K[7] >> 32) & 0xFF] ^ C4[static_cast(K[6] >> 24) & 0xFF] ^ C5[static_cast(K[5] >> 16) & 0xFF] ^ C6[static_cast(K[4] >> 8) & 0xFF] ^ - C7[static_cast(K[3] ) & 0xFF]; + C7[static_cast(K[3] ) & 0xFF]; L[3] = - C0[static_cast(K[3] >> 56) ] ^ + C0[static_cast(K[3] >> 56) ] ^ C1[static_cast(K[2] >> 48) & 0xFF] ^ C2[static_cast(K[1] >> 40) & 0xFF] ^ C3[static_cast(K[0] >> 32) & 0xFF] ^ C4[static_cast(K[7] >> 24) & 0xFF] ^ C5[static_cast(K[6] >> 16) & 0xFF] ^ C6[static_cast(K[5] >> 8) & 0xFF] ^ - C7[static_cast(K[4] ) & 0xFF]; + C7[static_cast(K[4] ) & 0xFF]; L[4] = - C0[static_cast(K[4] >> 56) ] ^ + C0[static_cast(K[4] >> 56) ] ^ C1[static_cast(K[3] >> 48) & 0xFF] ^ C2[static_cast(K[2] >> 40) & 0xFF] ^ C3[static_cast(K[1] >> 32) & 0xFF] ^ C4[static_cast(K[0] >> 24) & 0xFF] ^ C5[static_cast(K[7] >> 16) & 0xFF] ^ C6[static_cast(K[6] >> 8) & 0xFF] ^ - C7[static_cast(K[5] ) & 0xFF]; + C7[static_cast(K[5] ) & 0xFF]; L[5] = - C0[static_cast(K[5] >> 56) ] ^ + C0[static_cast(K[5] >> 56) ] ^ C1[static_cast(K[4] >> 48) & 0xFF] ^ C2[static_cast(K[3] >> 40) & 0xFF] ^ C3[static_cast(K[2] >> 32) & 0xFF] ^ C4[static_cast(K[1] >> 24) & 0xFF] ^ C5[static_cast(K[0] >> 16) & 0xFF] ^ C6[static_cast(K[7] >> 8) & 0xFF] ^ - C7[static_cast(K[6] ) & 0xFF]; + C7[static_cast(K[6] ) & 0xFF]; L[6] = - C0[static_cast(K[6] >> 56) ] ^ + C0[static_cast(K[6] >> 56) ] ^ C1[static_cast(K[5] >> 48) & 0xFF] ^ C2[static_cast(K[4] >> 40) & 0xFF] ^ C3[static_cast(K[3] >> 32) & 0xFF] ^ C4[static_cast(K[2] >> 24) & 0xFF] ^ C5[static_cast(K[1] >> 16) & 0xFF] ^ C6[static_cast(K[0] >> 8) & 0xFF] ^ - C7[static_cast(K[7] ) & 0xFF]; + C7[static_cast(K[7] ) & 0xFF]; L[7] = - C0[static_cast(K[7] >> 56) ] ^ + C0[static_cast(K[7] >> 56) ] ^ C1[static_cast(K[6] >> 48) & 0xFF] ^ C2[static_cast(K[5] >> 40) & 0xFF] ^ C3[static_cast(K[4] >> 32) & 0xFF] ^ C4[static_cast(K[3] >> 24) & 0xFF] ^ C5[static_cast(K[2] >> 16) & 0xFF] ^ C6[static_cast(K[1] >> 8) & 0xFF] ^ - C7[static_cast(K[0] ) & 0xFF]; + C7[static_cast(K[0] ) & 0xFF]; K[0] = L[0]; K[1] = L[1]; @@ -916,89 +916,89 @@ namespace Nz // apply the r-th round transformation L[0] = - C0[static_cast(state[0] >> 56) ] ^ + C0[static_cast(state[0] >> 56) ] ^ C1[static_cast(state[7] >> 48) & 0xFF] ^ C2[static_cast(state[6] >> 40) & 0xFF] ^ C3[static_cast(state[5] >> 32) & 0xFF] ^ C4[static_cast(state[4] >> 24) & 0xFF] ^ C5[static_cast(state[3] >> 16) & 0xFF] ^ C6[static_cast(state[2] >> 8) & 0xFF] ^ - C7[static_cast(state[1] ) & 0xFF] ^ + C7[static_cast(state[1] ) & 0xFF] ^ K[0]; L[1] = - C0[static_cast(state[1] >> 56) ] ^ + C0[static_cast(state[1] >> 56) ] ^ C1[static_cast(state[0] >> 48) & 0xFF] ^ C2[static_cast(state[7] >> 40) & 0xFF] ^ C3[static_cast(state[6] >> 32) & 0xFF] ^ C4[static_cast(state[5] >> 24) & 0xFF] ^ C5[static_cast(state[4] >> 16) & 0xFF] ^ C6[static_cast(state[3] >> 8) & 0xFF] ^ - C7[static_cast(state[2] ) & 0xFF] ^ + C7[static_cast(state[2] ) & 0xFF] ^ K[1]; L[2] = - C0[static_cast(state[2] >> 56) ] ^ + C0[static_cast(state[2] >> 56) ] ^ C1[static_cast(state[1] >> 48) & 0xFF] ^ C2[static_cast(state[0] >> 40) & 0xFF] ^ C3[static_cast(state[7] >> 32) & 0xFF] ^ C4[static_cast(state[6] >> 24) & 0xFF] ^ C5[static_cast(state[5] >> 16) & 0xFF] ^ C6[static_cast(state[4] >> 8) & 0xFF] ^ - C7[static_cast(state[3] ) & 0xFF] ^ + C7[static_cast(state[3] ) & 0xFF] ^ K[2]; L[3] = - C0[static_cast(state[3] >> 56) ] ^ + C0[static_cast(state[3] >> 56) ] ^ C1[static_cast(state[2] >> 48) & 0xFF] ^ C2[static_cast(state[1] >> 40) & 0xFF] ^ C3[static_cast(state[0] >> 32) & 0xFF] ^ C4[static_cast(state[7] >> 24) & 0xFF] ^ C5[static_cast(state[6] >> 16) & 0xFF] ^ C6[static_cast(state[5] >> 8) & 0xFF] ^ - C7[static_cast(state[4] ) & 0xFF] ^ + C7[static_cast(state[4] ) & 0xFF] ^ K[3]; L[4] = - C0[static_cast(state[4] >> 56) ] ^ + C0[static_cast(state[4] >> 56) ] ^ C1[static_cast(state[3] >> 48) & 0xFF] ^ C2[static_cast(state[2] >> 40) & 0xFF] ^ C3[static_cast(state[1] >> 32) & 0xFF] ^ C4[static_cast(state[0] >> 24) & 0xFF] ^ C5[static_cast(state[7] >> 16) & 0xFF] ^ C6[static_cast(state[6] >> 8) & 0xFF] ^ - C7[static_cast(state[5] ) & 0xFF] ^ + C7[static_cast(state[5] ) & 0xFF] ^ K[4]; L[5] = - C0[static_cast(state[5] >> 56) ] ^ + C0[static_cast(state[5] >> 56) ] ^ C1[static_cast(state[4] >> 48) & 0xFF] ^ C2[static_cast(state[3] >> 40) & 0xFF] ^ C3[static_cast(state[2] >> 32) & 0xFF] ^ C4[static_cast(state[1] >> 24) & 0xFF] ^ C5[static_cast(state[0] >> 16) & 0xFF] ^ C6[static_cast(state[7] >> 8) & 0xFF] ^ - C7[static_cast(state[6] ) & 0xFF] ^ + C7[static_cast(state[6] ) & 0xFF] ^ K[5]; L[6] = - C0[static_cast(state[6] >> 56) ] ^ + C0[static_cast(state[6] >> 56) ] ^ C1[static_cast(state[5] >> 48) & 0xFF] ^ C2[static_cast(state[4] >> 40) & 0xFF] ^ C3[static_cast(state[3] >> 32) & 0xFF] ^ C4[static_cast(state[2] >> 24) & 0xFF] ^ C5[static_cast(state[1] >> 16) & 0xFF] ^ C6[static_cast(state[0] >> 8) & 0xFF] ^ - C7[static_cast(state[7] ) & 0xFF] ^ + C7[static_cast(state[7] ) & 0xFF] ^ K[6]; L[7] = - C0[static_cast(state[7] >> 56) ] ^ + C0[static_cast(state[7] >> 56) ] ^ C1[static_cast(state[6] >> 48) & 0xFF] ^ C2[static_cast(state[5] >> 40) & 0xFF] ^ C3[static_cast(state[4] >> 32) & 0xFF] ^ C4[static_cast(state[3] >> 24) & 0xFF] ^ C5[static_cast(state[2] >> 16) & 0xFF] ^ C6[static_cast(state[1] >> 8) & 0xFF] ^ - C7[static_cast(state[0] ) & 0xFF] ^ + C7[static_cast(state[0] ) & 0xFF] ^ K[7]; state[0] = L[0]; diff --git a/src/Nazara/Core/Posix/HardwareInfoImpl.cpp b/src/Nazara/Core/Posix/HardwareInfoImpl.cpp index b9be624ec..710938872 100644 --- a/src/Nazara/Core/Posix/HardwareInfoImpl.cpp +++ b/src/Nazara/Core/Posix/HardwareInfoImpl.cpp @@ -53,7 +53,7 @@ namespace Nz::PlatformImpl return true; // cpuid is always supported on x86_64 arch #elif defined(NAZARA_ARCH_x86) && (defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL)) int supported; - asm volatile (" pushfl\n" + asm volatile (" pushfl\n" " pop %%eax\n" " mov %%eax, %%ecx\n" " xor $0x200000, %%eax\n" diff --git a/src/Nazara/Graphics/Systems/RenderSystem.cpp b/src/Nazara/Graphics/Systems/RenderSystem.cpp index 5605319fd..5c16b2ccd 100644 --- a/src/Nazara/Graphics/Systems/RenderSystem.cpp +++ b/src/Nazara/Graphics/Systems/RenderSystem.cpp @@ -444,7 +444,7 @@ namespace Nz return; const auto& lightEntry = light->GetLightEntry(lightIndex); - lightEntity->lightIndices[lightIndex] = m_pipeline->RegisterLight(lightEntry.light.get(), lightEntry.renderMask); + lightEntity->lightIndices[lightIndex] = m_pipeline->RegisterLight(lightEntry.light.get(), lightEntry.renderMask); }); lightEntity->onLightDetach.Connect(entityLight.OnLightDetach, [this, lightEntity](LightComponent* light, std::size_t lightIndex) diff --git a/src/Nazara/JoltPhysics3D/JoltPhysWorld3D.cpp b/src/Nazara/JoltPhysics3D/JoltPhysWorld3D.cpp index 953ae88d8..393e3760b 100644 --- a/src/Nazara/JoltPhysics3D/JoltPhysWorld3D.cpp +++ b/src/Nazara/JoltPhysics3D/JoltPhysWorld3D.cpp @@ -47,7 +47,7 @@ namespace DitchMeAsap class ObjectLayerPairFilterImpl : public ObjectLayerPairFilter { public: - virtual bool ShouldCollide(ObjectLayer inObject1, ObjectLayer inObject2) const override + virtual bool ShouldCollide(ObjectLayer inObject1, ObjectLayer inObject2) const override { switch (inObject1) { @@ -86,12 +86,12 @@ namespace DitchMeAsap mObjectToBroadPhase[Layers::MOVING] = BroadPhaseLayers::MOVING; } - virtual uint GetNumBroadPhaseLayers() const override + virtual uint GetNumBroadPhaseLayers() const override { return BroadPhaseLayers::NUM_LAYERS; } - virtual BroadPhaseLayer GetBroadPhaseLayer(ObjectLayer inLayer) const override + virtual BroadPhaseLayer GetBroadPhaseLayer(ObjectLayer inLayer) const override { JPH_ASSERT(inLayer < Layers::NUM_LAYERS); return mObjectToBroadPhase[inLayer]; @@ -102,21 +102,21 @@ namespace DitchMeAsap { switch ((BroadPhaseLayer::Type)inLayer) { - case (BroadPhaseLayer::Type)BroadPhaseLayers::NON_MOVING: return "NON_MOVING"; - case (BroadPhaseLayer::Type)BroadPhaseLayers::MOVING: return "MOVING"; - default: JPH_ASSERT(false); return "INVALID"; + case (BroadPhaseLayer::Type)BroadPhaseLayers::NON_MOVING: return "NON_MOVING"; + case (BroadPhaseLayer::Type)BroadPhaseLayers::MOVING: return "MOVING"; + default: JPH_ASSERT(false); return "INVALID"; } } #endif // JPH_EXTERNAL_PROFILE || JPH_PROFILE_ENABLED private: - BroadPhaseLayer mObjectToBroadPhase[Layers::NUM_LAYERS]; + BroadPhaseLayer mObjectToBroadPhase[Layers::NUM_LAYERS]; }; /// Class that determines if an object layer can collide with a broadphase layer class ObjectVsBroadPhaseLayerFilterImpl : public ObjectVsBroadPhaseLayerFilter { public: - virtual bool ShouldCollide(ObjectLayer inLayer1, BroadPhaseLayer inLayer2) const override + virtual bool ShouldCollide(ObjectLayer inLayer1, BroadPhaseLayer inLayer2) const override { switch (inLayer1) { @@ -136,7 +136,7 @@ namespace DitchMeAsap { public: // See: ContactListener - virtual ValidateResult OnContactValidate(const Body& inBody1, const Body& inBody2, RVec3Arg inBaseOffset, const CollideShapeResult& inCollisionResult) override + virtual ValidateResult OnContactValidate(const Body& inBody1, const Body& inBody2, RVec3Arg inBaseOffset, const CollideShapeResult& inCollisionResult) override { cout << "Contact validate callback" << endl; @@ -144,17 +144,17 @@ namespace DitchMeAsap return ValidateResult::AcceptAllContactsForThisBodyPair; } - virtual void OnContactAdded(const Body& inBody1, const Body& inBody2, const ContactManifold& inManifold, ContactSettings& ioSettings) override + virtual void OnContactAdded(const Body& inBody1, const Body& inBody2, const ContactManifold& inManifold, ContactSettings& ioSettings) override { cout << "A contact was added" << endl; } - virtual void OnContactPersisted(const Body& inBody1, const Body& inBody2, const ContactManifold& inManifold, ContactSettings& ioSettings) override + virtual void OnContactPersisted(const Body& inBody1, const Body& inBody2, const ContactManifold& inManifold, ContactSettings& ioSettings) override { cout << "A contact was persisted" << endl; } - virtual void OnContactRemoved(const SubShapeIDPair& inSubShapePair) override + virtual void OnContactRemoved(const SubShapeIDPair& inSubShapePair) override { cout << "A contact was removed" << endl; } diff --git a/src/Nazara/Network/AlgorithmNetwork.cpp b/src/Nazara/Network/AlgorithmNetwork.cpp index edf9775b1..a3955e8ab 100644 --- a/src/Nazara/Network/AlgorithmNetwork.cpp +++ b/src/Nazara/Network/AlgorithmNetwork.cpp @@ -236,7 +236,7 @@ namespace Nz // OK, there should be no correctly formed strings which are miscategorized, // and now any format errors will be found out as we continue parsing // according to plan. - if (!detectedIPv6) //try to parse as IPv4 + if (!detectedIPv6) //try to parse as IPv4 { // 4 dotted quad decimal; optional port if there is a colon // since there are just 4, and because the last one can be terminated @@ -271,7 +271,7 @@ namespace Nz // A further form allows an ipv4 dotted quad instead of the last two // 16-bit quantities, but only if in the ipv4 space ::ffff:x:x . - if (openBracketPtr) // start past the open bracket, if it exists + if (openBracketPtr) // start past the open bracket, if it exists addressPtr = openBracketPtr + 1; resultPtr = result; @@ -282,7 +282,7 @@ namespace Nz for (i = 0; i < 8; ++i) // we've got up to 8 of these, so we will use a loop { const char* savedPtr = addressPtr; - unsigned int value; // get value; these are hex + unsigned int value; // get value; these are hex if (!Detail::ParseHexadecimal(addressPtr, &value, &addressPtr)) // if empty, we are zero compressing; note the loc { if (zeroLoc) //there can be only one! diff --git a/src/Nazara/Utility/Formats/GIFLoader.cpp b/src/Nazara/Utility/Formats/GIFLoader.cpp index d902ac605..3b9dd5d03 100644 --- a/src/Nazara/Utility/Formats/GIFLoader.cpp +++ b/src/Nazara/Utility/Formats/GIFLoader.cpp @@ -653,7 +653,7 @@ namespace Nz std::size_t transparentIndex = std::numeric_limits::max(); Time time; UInt64 streamOffset; - UInt8 disposalMethod = 0; + UInt8 disposalMethod = 0; }; struct ImageDecodingData diff --git a/xmake/actions/checkfiles.lua b/xmake/actions/checkfiles.lua index 6c5e2d007..de6ca1e1c 100644 --- a/xmake/actions/checkfiles.lua +++ b/xmake/actions/checkfiles.lua @@ -889,6 +889,72 @@ on_run(function () end }) + -- No tab character should exist after indentation + table.insert(checks, { + Name = "tab outside of indent", + Check = function (moduleName) + local files = table.join( + os.files("include/Nazara/" .. moduleName .. "/**.hpp"), + os.files("include/Nazara/" .. moduleName .. "/**.inl"), + os.files("src/Nazara/" .. moduleName .. "/**.hpp"), + os.files("src/Nazara/" .. moduleName .. "/**.inl"), + os.files("src/Nazara/" .. moduleName .. "/**.cpp") + ) + + local fixes = {} + + for _, filePath in pairs(files) do + local lines = GetFile(filePath) + + local fileFixes = {} + for i = 1, #lines do + local start = lines[i]:match("\t*[^\t+]()\t") + if start then + table.insert(fileFixes, { line = i, start = start }) + end + end + + if #fileFixes > 0 then + print(filePath .. " has tab character outside of indentation") + table.insert(fixes, { + File = filePath, + Func = function (lines) + for _, fix in ipairs(fileFixes) do + -- compute indent taking tabs into account + local function ComputeIndent(str, i) + local indent = 0 + for i = 1, i do + if str:sub(i, i) == "\t" then + -- round up to tabSize (4) + indent = ((indent + 4) // 4) * 4 + else + indent = indent + 1 + end + end + + return indent + end + + lines[fix.line] = lines[fix.line]:gsub("()\t", function (pos) + if pos < fix.start then + return + end + local indent = ComputeIndent(lines[fix.line], pos - 1) + local indent2 = ComputeIndent(lines[fix.line], pos) + return string.rep(" ", indent2 - indent) + end) + end + + UpdateFile(filePath, lines) + end + }) + end + end + + return fixes + end + }) + local shouldFix = option.get("fix") or false for _, check in pairs(checks) do