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

Commit3f03f74

Browse files
committed
Update int28out and out8out and _in_ functions to handle trailing zeros
properly.
1 parent752314e commit3f03f74

File tree

10 files changed

+60
-38
lines changed

10 files changed

+60
-38
lines changed

‎src/backend/utils/adt/int.c

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.29 2000/01/1005:23:47 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.30 2000/01/1015:41:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -29,6 +29,7 @@
2929
* fix me when we figure out what we want to do about ANSIfication...
3030
*/
3131

32+
#include<ctype.h>
3233
#include"postgres.h"
3334
#ifdefHAVE_LIMITS_H
3435
#include<limits.h>
@@ -90,10 +91,15 @@ int28in(char *intString)
9091
{
9192
if (sscanf(intString,"%hd",&result[slot])!=1)
9293
break;
93-
do
94+
while (*intString&&isspace(*intString))
95+
intString++;
96+
while (*intString&& !isspace(*intString))
9497
intString++;
95-
while (*intString&&*intString!=' ')
9698
}
99+
while (*intString&&isspace(*intString))
100+
intString++;
101+
if (*intString)
102+
elog(ERROR,"int28 value has too many values");
97103
while (slot<INDEX_MAX_KEYS)
98104
result[slot++]=0;
99105

@@ -104,31 +110,36 @@ int28in(char *intString)
104110
*int28out- converts internal form to "num num ..."
105111
*/
106112
char*
107-
int28out(int16*shs)
113+
int28out(int16*int2Array)
108114
{
109-
intnum;
110-
int16*sp;
115+
intnum,maxnum;
111116
char*rp;
112117
char*result;
113118

114-
if (shs==NULL)
119+
if (int2Array==NULL)
115120
{
116121
result= (char*)palloc(2);
117122
result[0]='-';
118123
result[1]='\0';
119124
returnresult;
120125
}
121-
rp=result= (char*)palloc(INDEX_MAX_KEYS*7);
122-
/* assumes sign, 5 digits, ' ' */
123-
sp=shs;
124-
for (num=INDEX_MAX_KEYS;num!=0;num--)
126+
127+
/* find last non-zero value in vector */
128+
for (maxnum=INDEX_MAX_KEYS-1;maxnum >=0;maxnum--)
129+
if (int2Array[maxnum]!=0)
130+
break;
131+
132+
/* assumes sign, 5 digits, ' ' */
133+
rp=result= (char*)palloc(maxnum*7+1);
134+
for (num=0;num <=maxnum;num++)
125135
{
126-
itoa(*sp++,rp);
136+
if (num!=0)
137+
*rp++=' ';
138+
ltoa(int2Array[num],rp);
127139
while (*++rp!='\0')
128140
;
129-
*rp++=' ';
130141
}
131-
*--rp='\0';
142+
*rp='\0';
132143
returnresult;
133144
}
134145

‎src/backend/utils/adt/oid.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.30 2000/01/1005:23:47 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.31 2000/01/1015:41:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414

1515

16+
#include<ctype.h>
1617
#include"postgres.h"
1718
#include"utils/builtins.h"
1819

@@ -41,10 +42,15 @@ oid8in(char *oidString)
4142
{
4243
if (sscanf(oidString,"%u",&result[slot])!=1)
4344
break;
44-
do
45+
while (*oidString&&isspace(*oidString))
46+
oidString++;
47+
while (*oidString&& !isspace(*oidString))
4548
oidString++;
46-
while (*oidString&&*oidString!=' ')
4749
}
50+
while (*oidString&&isspace(*oidString))
51+
oidString++;
52+
if (*oidString)
53+
elog(ERROR,"oid8 value has too many values");
4854
while (slot<INDEX_MAX_KEYS)
4955
result[slot++]=0;
5056

@@ -57,8 +63,7 @@ oid8in(char *oidString)
5763
char*
5864
oid8out(Oid*oidArray)
5965
{
60-
intnum;
61-
Oid*sp;
66+
intnum,maxnum;
6267
char*rp;
6368
char*result;
6469

@@ -70,17 +75,22 @@ oid8out(Oid *oidArray)
7075
returnresult;
7176
}
7277

78+
/* find last non-zero value in vector */
79+
for (maxnum=INDEX_MAX_KEYS-1;maxnum >=0;maxnum--)
80+
if (oidArray[maxnum]!=0)
81+
break;
82+
7383
/* assumes sign, 10 digits, ' ' */
74-
rp=result= (char*)palloc(INDEX_MAX_KEYS*12);
75-
sp=oidArray;
76-
for (num=INDEX_MAX_KEYS;num!=0;num--)
84+
rp=result= (char*)palloc(maxnum*12+1);
85+
for (num=0;num <=maxnum;num++)
7786
{
78-
ltoa(*sp++,rp);
87+
if (num!=0)
88+
*rp++=' ';
89+
ltoa(oidArray[num],rp);
7990
while (*++rp!='\0')
8091
;
81-
*rp++=' ';
8292
}
83-
*--rp='\0';
93+
*rp='\0';
8494
returnresult;
8595
}
8696

‎src/interfaces/ecpg/lib/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.54 1999/12/16 06:53:10 meskes Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.55 2000/01/10 15:41:27 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= ecpg
1414
SO_MAJOR_VERSION= 3
15-
SO_MINOR_VERSION=0.9
15+
SO_MINOR_VERSION=1.0
1616

1717
SRCDIR= @top_srcdir@
1818
include$(SRCDIR)/Makefile.global

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SRCDIR= ../../..
22
include$(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
5-
MINOR_VERSION=6
5+
MINOR_VERSION=7
66
PATCHLEVEL=14
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION)\

‎src/interfaces/libpgeasy/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# Makefile for pgeasy library
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/interfaces/libpgeasy/Attic/Makefile.in,v 1.4 1999/12/16 01:25:16 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/interfaces/libpgeasy/Attic/Makefile.in,v 1.5 2000/01/10 15:41:28 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
NAME= pgeasy
1212
SO_MAJOR_VERSION= 2
13-
SO_MINOR_VERSION=0
13+
SO_MINOR_VERSION=1
1414

1515
SRCDIR= @top_srcdir@
1616
include$(SRCDIR)/Makefile.global

‎src/interfaces/libpgtcl/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.37 1999/12/16 01:25:17 momjian Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.38 2000/01/10 15:41:29 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= pgtcl
1414
SO_MAJOR_VERSION= 2
15-
SO_MINOR_VERSION=0
15+
SO_MINOR_VERSION=1
1616

1717
SRCDIR= @top_srcdir@
1818
include$(SRCDIR)/Makefile.global

‎src/interfaces/libpq++/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.19 1999/12/16 01:25:20 momjian Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.20 2000/01/10 15:41:31 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= pq++
1414
SO_MAJOR_VERSION= 3
15-
SO_MINOR_VERSION=0
15+
SO_MINOR_VERSION=1
1616

1717
SRCDIR= @top_srcdir@
1818
include$(SRCDIR)/Makefile.global

‎src/interfaces/libpq/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.50 1999/12/16 01:25:19 momjian Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.51 2000/01/10 15:41:30 momjian Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= pq
1414
SO_MAJOR_VERSION= 2
15-
SO_MINOR_VERSION=0
15+
SO_MINOR_VERSION=1
1616

1717
SRCDIR= @top_srcdir@
1818
include$(SRCDIR)/Makefile.global

‎src/interfaces/odbc/Version.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION = 0.25
1+
VERSION = 0.26
22
EXTVER = .0
33

44
SO_MAJOR_VERSION = 0
5-
SO_MINOR_VERSION =25
5+
SO_MINOR_VERSION =26

‎src/tools/RELEASE_CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ update documentation
1717
psql help in psqlHelp.c
1818
man pages
1919
sgml docs
20+
update VERSION numbers of interfaces

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp