[前][次][番号順一覧][スレッド一覧]

ruby-changes:43183

From: nobu <ko1@a...>
Date: Thu, 2 Jun 2016 12:05:45 +0900 (JST)
Subject: [ruby-changes:43183] nobu:r55257 (trunk): crypt.c: suppress warnings

nobu	2016-06-02 12:05:40 +0900 (Thu, 02 Jun 2016)

  New Revision: 55257

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55257

  Log:
    crypt.c: suppress warnings
    
    * missing/crypt.c (SPE): make unsigned so that literal integers do
      not exceed 32bit signed integer limit.

  Modified files:
    trunk/missing/crypt.c
    trunk/missing/des_tables.c
Index: missing/crypt.c
===================================================================
--- missing/crypt.c	(revision 55256)
+++ missing/crypt.c	(revision 55257)
@@ -323,7 +323,7 @@ typedef struct { https://github.com/ruby/ruby/blob/trunk/missing/crypt.c#L323
 	C_block	IE3264[32/CHUNKBITS][1<<CHUNKBITS];
 
 	/* Table that combines the S, P, and E operations.  */
-	long SPE[2][8][64];
+	unsigned long SPE[2][8][64];
 
 	/* compressed/interleaved => final permutation table */
 	C_block CF6464[64/CHUNKBITS][1<<CHUNKBITS];
@@ -505,7 +505,7 @@ des_cipher_r(const unsigned char *in, un https://github.com/ruby/ruby/blob/trunk/missing/crypt.c#L505
 #if defined(pdp11)
 	register int j;
 #endif
-	register long L0, L1, R0, R1, k;
+	register unsigned long L0, L1, R0, R1, k;
 	register const C_block *kp;
 	register int ks_inc, loop_count;
 	C_block B;
@@ -554,7 +554,7 @@ des_cipher_r(const unsigned char *in, un https://github.com/ruby/ruby/blob/trunk/missing/crypt.c#L554
 		loop_count = 8;
 		do {
 
-#define	SPTAB(t, i)	(*(const long *)((const unsigned char *)(t) + (i)*(sizeof(long)/4)))
+#define	SPTAB(t, i)	(*(const unsigned long *)((const unsigned char *)(t) + (i)*(sizeof(long)/4)))
 #if defined(gould)
 			/* use this if B.b[i] is evaluated just once ... */
 #define	DOXOR(x,y,i)	(x)^=SPTAB(SPE[0][(i)],B.b[(i)]); (y)^=SPTAB(SPE[1][(i)],B.b[(i)]);
@@ -922,7 +922,7 @@ main(void) https://github.com/ruby/ruby/blob/trunk/missing/crypt.c#L922
 	printf("};\n\n");
 
 	printf("/* Table that combines the S, P, and E operations.  */\n");
-	printf("static const long SPE[2][8][64] = {\n");
+	printf("static const unsigned long SPE[2][8][64] = {\n");
 	for (i = 0; i < numberof(SPE); ++i) {
 		printf("\t{\n");
 		for (j = 0; j < numberof(SPE[0]); ++j) {
@@ -930,7 +930,7 @@ main(void) https://github.com/ruby/ruby/blob/trunk/missing/crypt.c#L930
 			printf("\t\t{");
 			for (k = 0; k < numberof(SPE[0][0]); ++k) {
 				if (r == 0) printf("\n\t\t\t");
-				printf("%10ld,", SPE[i][j][k]);
+				printf("%#10lx,", SPE[i][j][k]);
 				if (++r == 4) r = 0;
 			}
 			printf("\n\t\t},\n");
Index: missing/des_tables.c
===================================================================
--- missing/des_tables.c	(revision 55256)
+++ missing/des_tables.c	(revision 55257)
@@ -1023,297 +1023,297 @@ static const C_block	IE3264[32/CHUNKBITS https://github.com/ruby/ruby/blob/trunk/missing/des_tables.c#L1023
 };
 
 /* Table that combines the S, P, and E operations.  */
-static const long SPE[2][8][64] = {
+static const unsigned long SPE[2][8][64] = {
 	{
 		{
-			2148040704,2147483648,         0,2148040704,
-			         0,2148040704,2147483648,         0,
-			2148040704,2148040704,2147483648,    557056,
-			    557056,         0,         0,2147483648,
-			2147483648,         0,    557056,2148040704,
-			2148040704,2147483648,    557056,    557056,
-			         0,    557056,2148040704,2147483648,
-			    557056,    557056,2147483648,         0,
-			         0,2148040704,    557056,2147483648,
-			2148040704,2147483648,    557056,    557056,
-			2147483648,    557056,2148040704,         0,
-			2148040704,         0,         0,2147483648,
-			2148040704,2148040704,2147483648,    557056,
-			         0,    557056,2147483648,         0,
-			2147483648,         0,    557056,2148040704,
-			         0,2147483648,    557056,2148040704,
-		},
-		{
-			 142606352,         0, 142606336,         0,
-			        16, 142606352, 142606336, 142606336,
-			 142606336,        16,        16, 142606336,
-			        16, 142606336,         0,        16,
-			         0, 142606352,        16, 142606336,
-			 142606352,         0,         0,        16,
-			 142606352, 142606352, 142606336,        16,
-			         0,         0, 142606352, 142606352,
-			        16, 142606336, 142606336, 142606352,
-			 142606352,        16,        16,         0,
-			         0, 142606352,         0,        16,
-			 142606336,         0, 142606352, 142606352,
-			 142606336, 142606336,         0,        16,
-			        16, 142606352, 142606336,         0,
-			        16,         0, 142606352, 142606336,
-			 142606352,        16,         0, 142606336,
-		},
-		{
-			         0,1073745920,      4096,      4096,
-			1073741824,         0,      4096,1073745920,
-			      4096,1073741824,1073741824,         0,
-			1073745920,      4096,         0,1073741824,
-			         0,1073741824,1073745920,      4096,
-			      4096,1073745920,1073741824,         0,
-			1073741824,      4096,1073745920,1073741824,
-			1073745920,         0,         0,1073745920,
-			1073745920,      4096,         0,1073741824,
-			      4096,1073741824,1073741824,      4096,
-			         0,1073745920,1073745920,1073741824,
-			1073741824,         0,1073745920,         0,
-			1073745920,         0,         0,1073745920,
-			1073741824,      4096,      4096,1073745920,
-			      4096,         0,1073741824,      4096,
-			         0,1073745920,      4096,1073741824,
-		},
-		{
-			   1048584,   1048576,         8,   1048584,
-			         0,         0,   1048584,         8,
-			   1048576,         8,         0,   1048584,
-			         8,   1048584,         0,         0,
-			         8,   1048576,   1048576,         8,
-			   1048576,   1048584,         0,   1048576,
-			   1048584,         0,         8,   1048576,
-			   1048576,         8,   1048584,         0,
-			         8,   1048584,         0,         8,
-			   1048576,   1048576,         8,         0,
-			   1048584,         0,   1048576,         8,
-			         0,         8,   1048576,   1048576,
-			         0,   1048584,   1048584,         0,
-			   1048584,         8,   1048576,   1048584,
-			         8,   1048576,         0,   1048584,
-			   1048584,         0,         8,   1048576,
-		},
-		{
-			         0, 268435456,    278528, 268714016,
-			 268435488,    278528, 268714016, 268435456,
-			 268435456,        32,        32, 268713984,
-			    278560, 268435488, 268713984,         0,
-			 268713984,         0, 268435488,    278560,
-			    278528, 268714016,         0,        32,
-			        32,    278560, 268714016, 268435488,
-			 268435456,    278528,    278560, 268713984,
-			 268713984,    278560, 268435488, 268435456,
-			 268435456,        32,        32,    278528,
-			         0, 268713984, 268714016,         0,
-			 268714016,         0,    278528, 268435488,
-			    278560,    278528,         0, 268714016,
-			 268435488, 268713984,    278560, 268435456,
-			 268713984, 268435488,    278528,    278560,
-			        32, 268714016, 268435456,        32,
-		},
-		{
-			      1088,      1088,         0,   2097152,
-			      1088,   2097152,   2098240,         0,
-			   2098240,   2098240,   2097152,         0,
-			   2097152,      1088,         0,   2098240,
-			         0,   2098240,      1088,         0,
-			   2097152,      1088,   2097152,      1088,
-			   2098240,         0,         0,   2098240,
-			      1088,   2097152,   2098240,   2097152,
-			   2098240,         0,   2097152,   2098240,
-			   2097152,      1088,         0,   2097152,
-			         0,   2097152,      1088,         0,
-			      1088,   2098240,   2097152,      1088,
-			   2098240,   2097152,         0,   2098240,
-			      1088,         0,   2098240,         0,
-			   2097152,      1088,   2098240,   2097152,
-			         0,   2098240,      1088,      1088,
-		},
-		{
-			  71303168,      8192,      8192,         4,
-			  71311364,  71303172,  71311360,         0,
-			         0,      8196,      8196,  71303168,
-			         4,  71311360,  71303168,      8196,
-			      8196,  71303168,  71303172,  71311364,
-			         0,      8192,         4,  71311360,
-			  71303172,  71311364,  71311360,         4,
-			  71311364,  71303172,      8192,         0,
-			  71311364,  71303168,  71303172,      8196,
-			  71303168,      8192,         0,  71303172,
-			      8196,  71311364,  71311360,         0,
-			      8192,         4,         4,      8192,
-			         0,      8196,      8192,  71311360,
-			      8196,  71303168,  71311364,         0,
-			  71311360,         4,  71303172,  71311364,
-			         4,  71311360,  71303168,  71303172,
-		},
-		{
-			      2176, 536870912, 536873088,         0,
-			 536870912,      2176,         0, 536873088,
-			      2176,         0, 536870912, 536873088,
-			 536873088, 536873088,      2176,         0,
-			 536870912, 536873088,      2176, 536870912,
-			 536873088,      2176,         0, 536870912,
-			         0,         0, 536873088,      2176,
-			         0, 536870912, 536870912,      2176,
-			         0, 536870912,      2176, 536873088,
-			 536873088,         0,         0, 536870912,
-			      2176, 536873088, 536870912,      2176,
-			 536870912,      2176,      2176, 536870912,
-			 536873088,         0,         0,      2176,
-			 536870912, 536873088, 536873088,         0,
-			      2176, 536870912, 536873088,         0,
-			         0,      2176, 536870912, 536873088,
+			0x80088000,0x80000000,         0,0x80088000,
+			         0,0x80088000,0x80000000,         0,
+			0x80088000,0x80088000,0x80000000,   0x88000,
+			   0x88000,         0,         0,0x80000000,
+			0x80000000,         0,   0x88000,0x80088000,
+			0x80088000,0x80000000,   0x88000,   0x88000,
+			         0,   0x88000,0x80088000,0x80000000,
+			   0x88000,   0x88000,0x80000000,         0,
+			         0,0x80088000,   0x88000,0x80000000,
+			0x80088000,0x80000000,   0x88000,   0x88000,
+			0x80000000,   0x88000,0x80088000,         0,
+			0x80088000,         0,         0,0x80000000,
+			0x80088000,0x80088000,0x80000000,   0x88000,
+			         0,   0x88000,0x80000000,         0,
+			0x80000000,         0,   0x88000,0x80088000,
+			         0,0x80000000,   0x88000,0x80088000,
+		},
+		{
+			 0x8800010,         0, 0x8800000,         0,
+			      0x10, 0x8800010, 0x8800000, 0x8800000,
+			 0x8800000,      0x10,      0x10, 0x8800000,
+			      0x10, 0x8800000,         0,      0x10,
+			         0, 0x8800010,      0x10, 0x8800000,
+			 0x8800010,         0,         0,      0x10,
+			 0x8800010, 0x8800010, 0x8800000,      0x10,
+			         0,         0, 0x8800010, 0x8800010,
+			      0x10, 0x8800000, 0x8800000, 0x8800010,
+			 0x8800010,      0x10,      0x10,         0,
+			         0, 0x8800010,         0,      0x10,
+			 0x8800000,         0, 0x8800010, 0x8800010,
+			 0x8800000, 0x8800000,         0,      0x10,
+			      0x10, 0x8800010, 0x8800000,         0,
+			      0x10,         0, 0x8800010, 0x8800000,
+			 0x8800010,      0x10,         0, 0x8800000,
+		},
+		{
+			         0,0x40001000,    0x1000,    0x1000,
+			0x40000000,         0,    0x1000,0x40001000,
+			    0x1000,0x40000000,0x40000000,         0,
+			0x40001000,    0x1000,         0,0x40000000,
+			         0,0x40000000,0x40001000,    0x1000,
+			    0x1000,0x40001000,0x40000000,         0,
+			0x40000000,    0x1000,0x40001000,0x40000000,
+			0x40001000,         0,         0,0x40001000,
+			0x40001000,    0x1000,         0,0x40000000,
+			    0x1000,0x40000000,0x40000000,    0x1000,
+			         0,0x40001000,0x40001000,0x40000000,
+			0x40000000,         0,0x40001000,         0,
+			0x40001000,         0,         0,0x40001000,
+			0x40000000,    0x1000,    0x1000,0x40001000,
+			    0x1000,         0,0x40000000,    0x1000,
+			         0,0x40001000,    0x1000,0x40000000,
+		},
+		{
+			  0x100008,  0x100000,       0x8,  0x100008,
+			         0,         0,  0x100008,       0x8,
+			  0x100000,       0x8,         0,  0x100008,
+			       0x8,  0x100008,         0,         0,
+			       0x8,  0x100000,  0x100000,       0x8,
+			  0x100000,  0x100008,         0,  0x100000,
+			  0x100008,         0,       0x8,  0x100000,
+			  0x100000,       0x8,  0x100008,         0,
+			       0x8,  0x100008,         0,       0x8,
+			  0x100000,  0x100000,       0x8,         0,
+			  0x100008,         0,  0x100000,       0x8,
+			         0,       0x8,  0x100000,  0x100000,
+			         0,  0x100008,  0x100008,         0,
+			  0x100008,       0x8,  0x100000,  0x100008,
+			       0x8,  0x100000,         0,  0x100008,
+			  0x100008,         0,       0x8,  0x100000,
+		},
+		{
+			         0,0x10000000,   0x44000,0x10044020,
+			0x10000020,   0x44000,0x10044020,0x10000000,
+			0x10000000,      0x20,      0x20,0x10044000,
+			   0x44020,0x10000020,0x10044000,         0,
+			0x10044000,         0,0x10000020,   0x44020,
+			   0x44000,0x10044020,         0,      0x20,
+			      0x20,   0x44020,0x10044020,0x10000020,
+			0x10000000,   0x44000,   0x44020,0x10044000,
+			0x10044000,   0x44020,0x10000020,0x10000000,
+			0x10000000,      0x20,      0x20,   0x44000,
+			         0,0x10044000,0x10044020,         0,
+			0x10044020,         0,   0x44000,0x10000020,
+			   0x44020,   0x44000,         0,0x10044020,
+			0x10000020,0x10044000,   0x44020,0x10000000,
+			0x10044000,0x10000020,   0x44000,   0x44020,
+			      0x20,0x10044020,0x10000000,      0x20,
+		},
+		{
+			     0x440,     0x440,         0,  0x200000,
+			     0x440,  0x200000,  0x200440,         0,
+			  0x200440,  0x200440,  0x200000,         0,
+			  0x200000,     0x440,         0,  0x200440,
+			         0,  0x200440,     0x440,         0,
+			  0x200000,     0x440,  0x200000,     0x440,
+			  0x200440,         0,         0,  0x200440,
+			     0x440,  0x200000,  0x200440,  0x200000,
+			  0x200440,         0,  0x200000,  0x200440,
+			  0x200000,     0x440,         0,  0x200000,
+			         0,  0x200000,     0x440,         0,
+			     0x440,  0x200440,  0x200000,     0x440,
+			  0x200440,  0x200000,         0,  0x200440,
+			     0x440,         0,  0x200440,         0,
+			  0x200000,     0x440,  0x200440,  0x200000,
+			         0,  0x200440,     0x440,     0x440,
+		},
+		{
+			 0x4400000,    0x2000,    0x2000,       0x4,
+			 0x4402004, 0x4400004, 0x4402000,         0,
+			         0,    0x2004,    0x2004, 0x4400000,
+			       0x4, 0x4402000, 0x4400000,    0x2004,
+			    0x2004, 0x4400000, 0x4400004, 0x4402004,
+			         0,    0x2000,       0x4, 0x4402000,
+			 0x4400004, 0x4402004, 0x4402000,       0x4,
+			 0x4402004, 0x4400004,    0x2000,         0,
+			 0x4402004, 0x4400000, 0x4400004,    0x2004,
+			 0x4400000,    0x2000,         0, 0x4400004,
+			    0x2004, 0x4402004, 0x4402000,         0,
+			    0x2000,       0x4,       0x4,    0x2000,
+			         0,    0x2004,    0x2000, 0x4402000,
+			    0x2004, 0x4400000, 0x4402004,         0,
+			 0x4402000,       0x4, 0x4400004, 0x4402004,
+			       0x4, 0x4402000, 0x4400000, 0x4400004,
+		},
+		{
+			     0x880,0x20000000,0x20000880,         0,
+			0x20000000,     0x880,         0,0x20000880,
+			     0x880,         0,0x20000000,0x20000880,
+			0x20000880,0x20000880,     0x880,         0,
+			0x20000000,0x20000880,     0x880,0x20000000,
+			0x20000880,     0x880,         0,0x20000000,
+			         0,         0,0x20000880,     0x880,
+			         0,0x20000000,0x20000000,     0x880,
+			         0,0x20000000,     0x880,0x20000880,
+			0x20000880,         0,         0,0x20000000,
+			     0x880,0x20000880,0x20000000,     0x880,
+			0x20000000,     0x880,     0x880,0x20000000,
+			0x20000880,         0,         0,     0x880,
+			0x20000000,0x20000880,0x20000880,         0,
+			     0x880,0x20000000,0x20000880,         0,
+			         0,     0x880,0x20000000,0x20000880,
 		},
 	},
 	{
 		{
-			      8200,         8, 536879104, 536879112,
-			      8192, 536870920, 536870920, 536879104,
-			 536870920,      8200,      8200, 536870912,
-			 536879104,      8192,         0, 536870920,
-			         8, 536870912,      8192,         8,
-			 536879112,      8200, 536870912,      8192,
-			 536870912,         0,         8, 536879112,
-			         0, 536879104, 536879112,         0,
-			         0, 536879112,      8192, 536870920,
-			      8200,         8, 536870912,      8192,
-			 536879112,         0,         8, 536879104,
-			 536870920, 536870912, 536879104,      8200,
-			 536879112,         8,      8200, 536879104,
-			      8192, 536870912, 536870920,         0,
-			         8,      8192, 536879104,      8200,
-			 536870912, 536879112,         0, 536870920,
-		},
-		{
-			  71303184,         0,        16,  71303184,
-			  71303168,         0,  71303168,        16,
-			         0,  71303184,         0,  71303168,
-			        16,  71303184,  71303184,         0,
-			        16,  71303168,  71303184,         0,
-			        16,  71303168,         0,        16,
-			  71303168,        16,  71303184,  71303168,
-			  71303168,        16,         0,  71303184,
-			        16,  71303184,  71303168,        16,
-			  71303184,        16,  71303168,         0,
-			  71303168,         0,        16,  71303184,
-			         0,  71303168,        16,  71303168,
-			  71303184,         0,         0,  71303168,
-			         0,  71303184,        16,  71303184,
-			  71303184,        16,         0,  71303168,
-			  71303168,         0,  71303184,        16,
-		},
-		{
-			 268713984,    278532,         0, 268713984,
-			 268435460,    278528, 268713984,         4,
-			    278528,         4,    278532, 268435456,
-			 268713988, 268435456, 268435456, 268713988,
-			         0, 268435460,    278532,         0,
-			 268435456, 268713988,         4, 268713984,
-			 268713988,    278528, 268435460,    278532,
-			         4,         0,    278528, 268435460,
-			    278532,         0, 268435456,         4,
-			 268435456, 268435460,    278532, 268713984,
-			         0,    278532,         4, 268713988,
-			 268435460,    278528, 268713988, 268435456,
-			 268435460, 268713984,    278528, 268713988,
-			         4,    278528, 268713984,         4,
-			    278528,         0, 268713988, 268435456,
-			 268713984, 268435460,         0,    278532,
-		},
-		{
-			2147484736,   1048576,2147483648,2148533312,
-			         0,   1049664,2148532224,2147484736,
-			   1049664,2148532224,   1048576,2147483648,
-			2148532224,2147484736,      1088,   1048576,
-			2148533312,      1088,         0,2147483648,
-			      1088,2148532224,   1049664,         0,
-			2147483648,         0,2147484736,   1049664,
-			   1048576,2148533312,2148533312,      1088,
-			2148533312,2147483648,      1088,2148532224,
-			      1088,   1048576,2147483648,   1049664,
-			2148532224,         0,         0,2147484736,
-			         0,2148533312,   1049664,         0,
-			   1048576,2148533312,2147484736,      1088,
-			2148533312,2147483648,   1048576,2147484736,
-			2147484736,      1088,   1049664,2148532224,
-			2147483648,   1048576,2148532224,   1049664,
-		},
-		{
-			    557056,         0,         0,    557056,
-			    557056,    557056,         0,    557056,
-			         0,         0,    557056,         0,
-			    557056,    557056,    557056,         0,
-			         0,    557056,         0,         0,
-			    557056,         0,         0,    557056,
-			         0,    557056,    557056,         0,
-			    557056,         0,         0,    557056,
-			    557056,    557056,         0,    557056,
-			         0,         0,    557056,    557056,
-			    557056,         0,    557056,         0,
-			         0,    557056,         0,         0,
-			    557056,         0,         0,    557056,
-			    557056,    557056,         0,         0,
-			         0,    557056,    557056,         0,
-			         0,         0,    557056,    557056,
-		},
-		{
-			 142606336,        32,         0, 142606368,
-			        32,         0, 142606336,        32,
-			         0, 142606368,        32, 142606336,
-			 142606336, 142606336, 142606368,        32,
-			        32, 142606336, 142606368,         0,
-			         0,         0, 142606368, 142606368,
-			 142606368, 142606368, 142606336,         0,
-			         0,        32,        32, 142606336,
-			         0, 142606336, 142606336,        32,
-			 142606368,        32,         0, 142606336,
-			 142606336,         0, 142606368,        32,
-			        32, 142606368,        32,         0,
-			 142606368,        32,        32, 142606336,
-			 142606336, 142606368,        32,         0,
-			         0, 142606336, 142606336, 142606368,
-			 142606368,  (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]