mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Compile and warning cleanup
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.9 1996/11/06 10:30:38 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.10 1996/11/08 05:59:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,15 +47,19 @@ static char *_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
|
||||
func_ptr inputproc, Oid typelem, char typdelim,
|
||||
int typlen, bool typbyval, char typalign,
|
||||
int *nbytes);
|
||||
#ifdef LOARRAY
|
||||
static char *_ReadLOArray(char *str, int *nbytes, int *fd, bool *chunkFlag,
|
||||
int ndim, int dim[], int baseSize);
|
||||
#endif
|
||||
static void _CopyArrayEls(char **values, char *p, int nitems, int typlen,
|
||||
char typalign, bool typbyval);
|
||||
static void system_cache_lookup(Oid element_type, bool input, int *typlen,
|
||||
bool *typbyval, char *typdelim, Oid *typelem, Oid *proc,
|
||||
char *typalign);
|
||||
static Datum _ArrayCast(char *value, bool byval, int len);
|
||||
#ifdef LOARRAY
|
||||
static char *_AdvanceBy1word(char *str, char **word);
|
||||
#endif
|
||||
static void _ArrayRange(int st[], int endp[], int bsize, char *destPtr,
|
||||
ArrayType *array, int from);
|
||||
static int _ArrayClipCount(int stI[], int endpI[], ArrayType *array);
|
||||
@@ -63,8 +67,6 @@ static void _LOArrayRange(int st[], int endp[], int bsize, int srcfd,
|
||||
int destfd, ArrayType *array, int isSrcLO, bool *isNull);
|
||||
static void _ReadArray (int st[], int endp[], int bsize, int srcfd, int destfd,
|
||||
ArrayType *array, int isDestLO, bool *isNull);
|
||||
static char *_array_set(ArrayType *array, struct varlena *indx_str,
|
||||
struct varlena *dataPtr);
|
||||
static ArrayCastAndSet(char *src, bool typbyval, int typlen, char *dest);
|
||||
|
||||
|
||||
@@ -90,7 +92,7 @@ array_in(char *string, /* input array in external form */
|
||||
int i, nitems, dummy;
|
||||
int32 nbytes;
|
||||
char *dataPtr;
|
||||
ArrayType *retval;
|
||||
ArrayType *retval = NULL;
|
||||
int ndim, dim[MAXDIM], lBound[MAXDIM];
|
||||
char typalign;
|
||||
|
||||
@@ -407,6 +409,7 @@ _ReadArrayStr(char *arrayStr,
|
||||
* Read data about an array to be stored as a large object
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef LOARRAY
|
||||
static char *
|
||||
_ReadLOArray(char *str,
|
||||
int *nbytes,
|
||||
@@ -460,6 +463,7 @@ _ReadLOArray(char *str,
|
||||
}
|
||||
return(retStr);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_CopyArrayEls(char **values,
|
||||
@@ -659,8 +663,8 @@ array_ref(ArrayType *array,
|
||||
bool *isNull)
|
||||
{
|
||||
int i, ndim, *dim, *lb, offset, nbytes;
|
||||
struct varlena *v;
|
||||
char *retval;
|
||||
struct varlena *v = NULL;
|
||||
char *retval = NULL;
|
||||
|
||||
if (array == (ArrayType *) NULL) RETURN_NULL;
|
||||
if (arraylen > 0) {
|
||||
@@ -684,7 +688,7 @@ array_ref(ArrayType *array,
|
||||
|
||||
if (ARR_IS_LO(array)) {
|
||||
char * lo_name;
|
||||
int fd;
|
||||
int fd = 0;
|
||||
|
||||
/* We are assuming fixed element lengths here */
|
||||
offset *= elmlen;
|
||||
@@ -786,8 +790,8 @@ array_clip(ArrayType *array,
|
||||
#ifdef LOARRAY
|
||||
char * lo_name;
|
||||
#endif
|
||||
char * newname;
|
||||
int fd, newfd, isDestLO = true, rsize;
|
||||
char *newname = NULL;
|
||||
int fd = 0, newfd = 0, isDestLO = true, rsize;
|
||||
|
||||
if (len < 0)
|
||||
elog(WARN, "array_clip: array of variable length objects not supported");
|
||||
@@ -863,7 +867,7 @@ array_clip(ArrayType *array,
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* array_set :
|
||||
* array_set :
|
||||
* This routine sets the value of an array location (specified by an index array)
|
||||
* to a new value specified by "dataPtr".
|
||||
* result :
|
||||
@@ -908,7 +912,7 @@ array_set(ArrayType *array,
|
||||
offset = GetOffset( n, dim, lb, indx);
|
||||
|
||||
if (ARR_IS_LO(array)) {
|
||||
int fd;
|
||||
int fd = 0;
|
||||
struct varlena *v;
|
||||
|
||||
/* We are assuming fixed element lengths here */
|
||||
@@ -1017,7 +1021,7 @@ array_assgn(ArrayType *array,
|
||||
elog(WARN, "lowerIndex larger than upperIndx");
|
||||
|
||||
if (ARR_IS_LO(array)) {
|
||||
int fd, newfd;
|
||||
int fd = 0, newfd = 0;
|
||||
|
||||
#ifdef LOARRAY
|
||||
char * lo_name;
|
||||
@@ -1156,6 +1160,7 @@ ArrayCastAndSet(char *src,
|
||||
return(inc);
|
||||
}
|
||||
|
||||
#ifdef LOARRAY
|
||||
static char *
|
||||
_AdvanceBy1word(char *str, char **word)
|
||||
{
|
||||
@@ -1173,6 +1178,7 @@ _AdvanceBy1word(char *str, char **word)
|
||||
retstr = NULL;
|
||||
return retstr;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[])
|
||||
@@ -1371,7 +1377,7 @@ _LOtransfer(char **destfd,
|
||||
{
|
||||
#define MAX_READ (512 * 1024)
|
||||
#define min(a, b) (a < b ? a : b)
|
||||
struct varlena *v;
|
||||
struct varlena *v = NULL;
|
||||
int tmp, inc, resid;
|
||||
|
||||
inc = nitems*size;
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.3 1996/11/06 10:30:40 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.4 1996/11/08 05:59:40 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include <libpq/be-fsstubs.h>
|
||||
@@ -46,12 +49,14 @@ static int _FindBestChunk(int size, int dmax[], int dbest[], int dim,
|
||||
int A[MAXPAT][MAXDIM+1], int N);
|
||||
static int get_next(int d[], int k, int C, int dmax[]);
|
||||
static void initialize_info(CHUNK_INFO *A, int ndim, int dim[], int chunk[]);
|
||||
#ifdef LOARRAY
|
||||
static void _ConvertToChunkFile(int n, int baseSize, int dim[], int C[],
|
||||
int srcfd, int destfd);
|
||||
static void read_chunk(int chunk_no[], int C[], char a_chunk[], int srcfd,
|
||||
int n, int baseSize, int PX[], int dist[]);
|
||||
static int write_chunk(struct varlena * a_chunk, int ofile);
|
||||
static int seek_and_read(int pos, int size, char buff[], int fp, int from);
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
* _ChunkArray ---
|
||||
@@ -71,7 +76,9 @@ _ChunkArray(int fd,
|
||||
int *nbytes,
|
||||
char *chunkfile)
|
||||
{
|
||||
int cfd;
|
||||
#ifdef LOARRAY
|
||||
int cfd = 0;
|
||||
#endif
|
||||
int chunk[MAXDIM], csize;
|
||||
bool reorgFlag;
|
||||
|
||||
@@ -86,17 +93,20 @@ _ChunkArray(int fd,
|
||||
chunkfile = _array_newLO( &cfd, fileFlag );
|
||||
else
|
||||
cfd = LOopen(chunkfile, O_RDONLY);
|
||||
#endif
|
||||
if (cfd < 0)
|
||||
elog(WARN, "Enable to open chunk file");
|
||||
elog(WARN, "Unable to open chunk file");
|
||||
#endif
|
||||
|
||||
strcpy (cInfo.lo_name, chunkfile);
|
||||
|
||||
/* find chunk size */
|
||||
csize = GetChunkSize(afd, ndim, dim, baseSize, chunk);
|
||||
|
||||
#ifdef LOARRAY
|
||||
if (reorgFlag)
|
||||
/* copy data from input file to chunked file */
|
||||
_ConvertToChunkFile(ndim, baseSize, dim, chunk, fd, cfd);
|
||||
#endif
|
||||
|
||||
initialize_info(&cInfo, ndim, dim, chunk);
|
||||
*nbytes = sizeof(CHUNK_INFO);
|
||||
@@ -231,8 +241,10 @@ get_next(int d[], int k, int C, int dmax[])
|
||||
return(1);
|
||||
}
|
||||
|
||||
#ifdef LOARRAY
|
||||
static char a_chunk[_PAGE_SIZE_ + 4]; /* 4 since a_chunk is in
|
||||
varlena format */
|
||||
#endif
|
||||
|
||||
static void
|
||||
initialize_info(CHUNK_INFO *A, int ndim, int dim[], int chunk[])
|
||||
@@ -254,6 +266,7 @@ initialize_info(CHUNK_INFO *A, int ndim, int dim[], int chunk[])
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef LOARRAY
|
||||
static void
|
||||
_ConvertToChunkFile(int n,
|
||||
int baseSize,
|
||||
@@ -337,7 +350,7 @@ read_chunk(int chunk_no[],
|
||||
static int
|
||||
write_chunk(struct varlena * a_chunk, int ofile)
|
||||
{
|
||||
int got_n;
|
||||
int got_n = 0;
|
||||
#ifdef LOARRAY
|
||||
got_n = LOwrite (ofile, a_chunk);
|
||||
#endif
|
||||
@@ -354,7 +367,7 @@ write_chunk(struct varlena * a_chunk, int ofile)
|
||||
static int
|
||||
seek_and_read(int pos, int size, char buff[], int fp, int from)
|
||||
{
|
||||
struct varlena *v;
|
||||
struct varlena *v = NULL;
|
||||
|
||||
/* Assuming only one file */
|
||||
if ( lo_lseek(fp, pos, from ) < 0)
|
||||
@@ -369,6 +382,7 @@ seek_and_read(int pos, int size, char buff[], int fp, int from)
|
||||
return(1);
|
||||
|
||||
}
|
||||
#endif /* LOARRAY */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* _ReadChunkArray --
|
||||
@@ -453,7 +467,7 @@ _ReadChunkArray(int st[],
|
||||
for (i = 0; i < n; range[i++] = 0);
|
||||
j = n-1; bptr *= bsize;
|
||||
if (isDestLO) {
|
||||
if (lo_lseek(destfp, bptr, SEEK_SET) < 0)
|
||||
if (lo_lseek((int)destfp, bptr, SEEK_SET) < 0)
|
||||
RETURN_NULL;
|
||||
}
|
||||
else
|
||||
@@ -480,7 +494,7 @@ _ReadChunkArray(int st[],
|
||||
block_seek += cdist[j];
|
||||
bptr += adist[j]*bsize;
|
||||
if (isDestLO) {
|
||||
if (lo_lseek(destfp, bptr, SEEK_SET) < 0)
|
||||
if (lo_lseek((int)destfp, bptr, SEEK_SET) < 0)
|
||||
RETURN_NULL;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.2 1996/11/06 06:49:47 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.3 1996/11/08 05:59:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ datumGetSize(Datum value, Oid type, bool byVal, Size len)
|
||||
{
|
||||
|
||||
struct varlena *s;
|
||||
Size size;
|
||||
Size size = 0;
|
||||
|
||||
if (byVal) {
|
||||
if (len >= 0 && len <= sizeof(Datum)) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.4 1996/11/06 10:30:51 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.5 1996/11/08 05:59:43 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ char *
|
||||
filename_in(char *file)
|
||||
{
|
||||
char *str, *getenv();
|
||||
int ind;
|
||||
int ind = 0;
|
||||
|
||||
/*
|
||||
* XXX - HACK CITY --- REDO
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.6 1996/11/06 06:49:51 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.7 1996/11/08 05:59:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -589,8 +589,9 @@ qmktime(struct tm *tp)
|
||||
* correction
|
||||
*/
|
||||
if (day > nmdays[mon])
|
||||
if (mon != 2 || year % 4 == 0 &&
|
||||
(year % 100 != 0 || year % 400 == 0) && day > 29)
|
||||
if (mon != 2 ||
|
||||
(year % 4 == 0 &&
|
||||
((year % 100 != 0 || year % 400 == 0)) && day > 29))
|
||||
return -1; /* day too large for month */
|
||||
|
||||
/* split year into century and year-of-century */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.2 1996/11/06 06:49:59 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.3 1996/11/08 05:59:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ int32 regprocin(char *proname)
|
||||
HeapScanDesc procscan;
|
||||
HeapTuple proctup;
|
||||
ScanKeyData key;
|
||||
RegProcedure result;
|
||||
RegProcedure result = (Oid)0;
|
||||
bool isnull;
|
||||
|
||||
if (proname == NULL)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.2 1996/11/06 06:50:01 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.3 1996/11/08 05:59:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ SetDefine(char *querystr, char *typename)
|
||||
char *procname = GENERICSETNAME;
|
||||
char *fileName = "-";
|
||||
char realprocname[16];
|
||||
HeapTuple tup, newtup;
|
||||
HeapTuple tup, newtup = NULL;
|
||||
Form_pg_proc proc;
|
||||
Relation procrel;
|
||||
int i;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.7 1996/11/06 06:50:07 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.8 1996/11/08 05:59:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ byteaout(struct varlena *vlena)
|
||||
vp = vlena->vl_dat;
|
||||
for (i = vlena->vl_len - sizeof(int32); i != 0; i--) /* varlena? */
|
||||
if (*vp == '\\') {
|
||||
*vp++;
|
||||
vp++;
|
||||
*rp++ = '\\';
|
||||
*rp++ = '\\';
|
||||
} else if (isascii(*vp) && isprint(*vp))
|
||||
|
||||
Reference in New Issue
Block a user