Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46d7ae7

Browse files
committed
Add intended Array.java file that accidentally was patched into the
wrong directory.
1 parentd39ec83 commit46d7ae7

File tree

2 files changed

+57
-59
lines changed

2 files changed

+57
-59
lines changed

‎src/backend/libpq/md5.c

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
*PRIVATE FUNCTIONS
2525
*/
2626

27-
typedefunsignedcharunsigned8;
28-
typedefunsignedintunsigned32;
29-
typedefunsigned longunsigned64;
30-
3127
#ifdefFRONTEND
3228
#undef palloc
3329
#definepalloc malloc
@@ -39,50 +35,52 @@ typedef unsigned long unsigned64;
3935
*The returned array is allocated using malloc. the caller should free it
4036
* when it is no longer needed.
4137
*/
42-
staticunsigned8*
43-
createPaddedCopyWithLength(unsigned8*b,unsigned32*l)
38+
staticuint8*
39+
createPaddedCopyWithLength(uint8*b,uint32*l)
4440
{
45-
unsigned8*ret;
46-
unsigned32q;
47-
unsigned32len,newLen448;
48-
unsigned64len64;
41+
uint8*ret;
42+
uint32q;
43+
uint32len,newLen448;
44+
uint32len_high,len_low;/* 64-bit value split into 32-bit sections */
4945

5046
len= ((b==NULL) ?0 :*l);
5147
newLen448=len+64- (len %64)-8;
5248
if (newLen448 <=len)
5349
newLen448+=64;
5450

5551
*l=newLen448+8;
56-
if ((ret= (unsigned8*)malloc(sizeof(unsigned8)**l))==NULL)
52+
if ((ret= (uint8*)malloc(sizeof(uint8)**l))==NULL)
5753
returnNULL;
5854

5955
if (b!=NULL)
60-
memcpy(ret,b,sizeof(unsigned8)*len);
56+
memcpy(ret,b,sizeof(uint8)*len);
6157

6258
/* pad */
6359
ret[len]=0x80;
6460
for (q=len+1;q<newLen448;q++)
6561
ret[q]=0x00;
6662

6763
/* append length as a 64 bit bitcount */
68-
len64=len;
69-
len64 <<=3;
64+
len_low=len;
65+
/* split into two 32-bit values */
66+
/* we only look at the bottom 32-bits */
67+
len_high=len >>29;
68+
len_low <<=3;
7069
q=newLen448;
71-
ret[q++]= (len64&0xFF);
72-
len64 >>=8;
73-
ret[q++]= (len64&0xFF);
74-
len64 >>=8;
75-
ret[q++]= (len64&0xFF);
76-
len64 >>=8;
77-
ret[q++]= (len64&0xFF);
78-
len64 >>=8;
79-
ret[q++]= (len64&0xFF);
80-
len64 >>=8;
81-
ret[q++]= (len64&0xFF);
82-
len64 >>=8;
83-
ret[q++]= (len64&0xFF);
84-
len64 >>=8;
85-
ret[q]= (len64&0xFF);
70+
ret[q++]= (len_low&0xff);
71+
len_low >>=8;
72+
ret[q++]= (len_low&0xff);
73+
len_low >>=8;
74+
ret[q++]= (len_low&0xff);
75+
len_low >>=8;
76+
ret[q++]= (len_low&0xff);
77+
ret[q++]= (len_high&0xff);
78+
len_high >>=8;
79+
ret[q++]= (len_high&0xff);
80+
len_high >>=8;
81+
ret[q++]= (len_high&0xff);
82+
len_high >>=8;
83+
ret[q]= (len_high&0xff);
8684

8785
returnret;
8886
}
@@ -94,9 +92,9 @@ createPaddedCopyWithLength(unsigned8 *b, unsigned32 *l)
9492
#defineROT_LEFT(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
9593

9694
staticvoid
97-
doTheRounds(unsigned32X[16],unsigned32state[4])
95+
doTheRounds(uint32X[16],uint32state[4])
9896
{
99-
unsigned32a,b,c,d;
97+
uint32a,b,c,d;
10098

10199
a=state[0];
102100
b=state[1];
@@ -182,13 +180,13 @@ doTheRounds(unsigned32 X[16], unsigned32 state[4])
182180
}
183181

184182
staticint
185-
calculateDigestFromBuffer(unsigned8*b,unsigned32len,unsigned8sum[16])
183+
calculateDigestFromBuffer(uint8*b,uint32len,uint8sum[16])
186184
{
187-
registerunsigned32i,j,k,newI;
188-
unsigned32l;
189-
unsigned8*input;
190-
registerunsigned32*wbp;
191-
unsigned32workBuff[16],state[4];
185+
registeruint32i,j,k,newI;
186+
uint32l;
187+
uint8*input;
188+
registeruint32*wbp;
189+
uint32workBuff[16],state[4];
192190

193191
l=len;
194192

@@ -223,19 +221,19 @@ calculateDigestFromBuffer(unsigned8 *b, unsigned32 len, unsigned8 sum[16])
223221
j=0;
224222
for (i=0;i<4;i++) {
225223
k=state[i];
226-
sum[j++]= (k&0xFF);
224+
sum[j++]= (k&0xff);
227225
k >>=8;
228-
sum[j++]= (k&0xFF);
226+
sum[j++]= (k&0xff);
229227
k >>=8;
230-
sum[j++]= (k&0xFF);
228+
sum[j++]= (k&0xff);
231229
k >>=8;
232-
sum[j++]= (k&0xFF);
230+
sum[j++]= (k&0xff);
233231
}
234232
return1;
235233
}
236234

237235
staticvoid
238-
bytesToHex(unsigned8b[16],char*s)
236+
bytesToHex(uint8b[16],char*s)
239237
{
240238
staticchar*hex="0123456789abcdef";
241239
intq,w;
@@ -280,9 +278,9 @@ bytesToHex(unsigned8 b[16], char *s)
280278
bool
281279
md5_hash(constvoid*buff,size_tlen,char*hexsum)
282280
{
283-
unsigned8sum[16];
281+
uint8sum[16];
284282

285-
if (!calculateDigestFromBuffer((unsigned8*)buff,len,sum))
283+
if (!calculateDigestFromBuffer((uint8*)buff,len,sum))
286284
return false;
287285

288286
bytesToHex(sum,hexsum);

‎src/interfaces/jdbc/org/postgresql/jdbc2/Array.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ public Object getArray(long index, int count, Map map) throws SQLException {
169169
}
170170

171171
publicintgetBaseType()throwsSQLException {
172-
returnconn.getSQLType(getBaseTypeName());
172+
returnField.getSQLType(getBaseTypeName());
173173
}
174174

175175
publicStringgetBaseTypeName()throwsSQLException {
176-
StringfType =field.getPGType();
176+
StringfType =field.getTypeName();
177177
if(fType.charAt(0) =='_' )
178178
fType =fType.substring(1);
179179
returnfType;
@@ -195,24 +195,24 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
195195
Objectarray =getArray(index,count,map );
196196
Vectorrows =newVector();
197197
Field[]fields =newField[2];
198-
fields[0] =newField(conn,"INDEX",conn.getOID("int2"),2);
198+
fields[0] =newField(conn,"INDEX",field.getOID("int2"),2);
199199
switch (getBaseType() )
200200
{
201201
caseTypes.BIT:
202202
boolean[]booleanArray = (boolean[])array;
203-
fields[1] =newField(conn,"VALUE",conn.getOID("bool"),1);
203+
fields[1] =newField(conn,"VALUE",field.getOID("bool"),1);
204204
for(inti=0;i<booleanArray.length;i++ ) {
205205
byte[][]tuple =newbyte[2][0];
206206
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
207207
tuple[1] =conn.getEncoding().encode( (booleanArray[i]?"YES":"NO") );// Value
208208
rows.addElement(tuple);
209209
}
210210
caseTypes.SMALLINT:
211-
fields[1] =newField(conn,"VALUE",conn.getOID("int2"),2);
211+
fields[1] =newField(conn,"VALUE",field.getOID("int2"),2);
212212
caseTypes.INTEGER:
213213
int[]intArray = (int[])array;
214214
if(fields[1] ==null )
215-
fields[1] =newField(conn,"VALUE",conn.getOID("int4"),4);
215+
fields[1] =newField(conn,"VALUE",field.getOID("int4"),4);
216216
for(inti=0;i<intArray.length;i++ ) {
217217
byte[][]tuple =newbyte[2][0];
218218
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -222,7 +222,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
222222
break;
223223
caseTypes.BIGINT:
224224
long[]longArray = (long[])array;
225-
fields[1] =newField(conn,"VALUE",conn.getOID("int8"),8);
225+
fields[1] =newField(conn,"VALUE",field.getOID("int8"),8);
226226
for(inti=0;i<longArray.length;i++ ) {
227227
byte[][]tuple =newbyte[2][0];
228228
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -232,7 +232,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
232232
break;
233233
caseTypes.NUMERIC:
234234
BigDecimal[]bdArray = (BigDecimal[])array;
235-
fields[1] =newField(conn,"VALUE",conn.getOID("numeric"), -1);
235+
fields[1] =newField(conn,"VALUE",field.getOID("numeric"), -1);
236236
for(inti=0;i<bdArray.length;i++ ) {
237237
byte[][]tuple =newbyte[2][0];
238238
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -242,7 +242,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
242242
break;
243243
caseTypes.REAL:
244244
float[]floatArray = (float[])array;
245-
fields[1] =newField(conn,"VALUE",conn.getOID("float4"),4);
245+
fields[1] =newField(conn,"VALUE",field.getOID("float4"),4);
246246
for(inti=0;i<floatArray.length;i++ ) {
247247
byte[][]tuple =newbyte[2][0];
248248
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -252,7 +252,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
252252
break;
253253
caseTypes.DOUBLE:
254254
double[]doubleArray = (double[])array;
255-
fields[1] =newField(conn,"VALUE",conn.getOID("float8"),8);
255+
fields[1] =newField(conn,"VALUE",field.getOID("float8"),8);
256256
for(inti=0;i<doubleArray.length;i++ ) {
257257
byte[][]tuple =newbyte[2][0];
258258
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -261,11 +261,11 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
261261
}
262262
break;
263263
caseTypes.CHAR:
264-
fields[1] =newField(conn,"VALUE",conn.getOID("char"),1);
264+
fields[1] =newField(conn,"VALUE",field.getOID("char"),1);
265265
caseTypes.VARCHAR:
266266
String[]strArray = (String[])array;
267267
if(fields[1] ==null )
268-
fields[1] =newField(conn,"VALUE",conn.getOID("varchar"), -1);
268+
fields[1] =newField(conn,"VALUE",field.getOID("varchar"), -1);
269269
for(inti=0;i<strArray.length;i++ ) {
270270
byte[][]tuple =newbyte[2][0];
271271
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -275,7 +275,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
275275
break;
276276
caseTypes.DATE:
277277
java.sql.Date[]dateArray = (java.sql.Date[])array;
278-
fields[1] =newField(conn,"VALUE",conn.getOID("date"),4);
278+
fields[1] =newField(conn,"VALUE",field.getOID("date"),4);
279279
for(inti=0;i<dateArray.length;i++ ) {
280280
byte[][]tuple =newbyte[2][0];
281281
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -285,7 +285,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
285285
break;
286286
caseTypes.TIME:
287287
java.sql.Time[]timeArray = (java.sql.Time[])array;
288-
fields[1] =newField(conn,"VALUE",conn.getOID("time"),8);
288+
fields[1] =newField(conn,"VALUE",field.getOID("time"),8);
289289
for(inti=0;i<timeArray.length;i++ ) {
290290
byte[][]tuple =newbyte[2][0];
291291
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index
@@ -295,7 +295,7 @@ public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
295295
break;
296296
caseTypes.TIMESTAMP:
297297
java.sql.Timestamp[]timestampArray = (java.sql.Timestamp[])array;
298-
fields[1] =newField(conn,"VALUE",conn.getOID("timestamp"),8);
298+
fields[1] =newField(conn,"VALUE",field.getOID("timestamp"),8);
299299
for(inti=0;i<timestampArray.length;i++ ) {
300300
byte[][]tuple =newbyte[2][0];
301301
tuple[0] =conn.getEncoding().encode(Integer.toString((int)index+i) );// Index

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp