Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8a65b820
Commit
8a65b820
authored
Sep 24, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress signed-vs-unsigned-char warnings in contrib.
parent
88896855
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
124 additions
and
105 deletions
+124
-105
contrib/dbase/dbf.c
contrib/dbase/dbf.c
+13
-12
contrib/dbase/dbf.h
contrib/dbase/dbf.h
+6
-6
contrib/dbase/dbf2pg.c
contrib/dbase/dbf2pg.c
+3
-3
contrib/ltree/ltree_io.c
contrib/ltree/ltree_io.c
+1
-1
contrib/ltree/ltxtquery_io.c
contrib/ltree/ltxtquery_io.c
+1
-1
contrib/pgcrypto/crypt-des.c
contrib/pgcrypto/crypt-des.c
+6
-6
contrib/pgcrypto/crypt-md5.c
contrib/pgcrypto/crypt-md5.c
+12
-12
contrib/pgcrypto/pgcrypto.c
contrib/pgcrypto/pgcrypto.c
+20
-14
contrib/pgcrypto/pgp-decrypt.c
contrib/pgcrypto/pgp-decrypt.c
+2
-2
contrib/pgcrypto/pgp-pgsql.c
contrib/pgcrypto/pgp-pgsql.c
+19
-12
contrib/pgcrypto/px-crypt.c
contrib/pgcrypto/px-crypt.c
+2
-2
contrib/tsearch2/dict_snowball.c
contrib/tsearch2/dict_snowball.c
+1
-1
contrib/tsearch2/gistidx.c
contrib/tsearch2/gistidx.c
+1
-1
contrib/tsearch2/ispell/spell.c
contrib/tsearch2/ispell/spell.c
+36
-31
contrib/tsearch2/query.c
contrib/tsearch2/query.c
+1
-1
No files found.
contrib/dbase/dbf.c
View file @
8a65b820
...
...
@@ -20,7 +20,7 @@
/* open a dbf-file, get it's field-info and store this information */
dbhead
*
dbf_open
(
u_
char
*
file
,
int
flags
)
dbf_open
(
char
*
file
,
int
flags
)
{
int
file_no
;
dbhead
*
dbh
;
...
...
@@ -200,7 +200,7 @@ dbf_put_fields(dbhead * dbh)
}
int
dbf_add_field
(
dbhead
*
dbh
,
u_
char
*
name
,
u_char
type
,
dbf_add_field
(
dbhead
*
dbh
,
char
*
name
,
u_char
type
,
u_char
length
,
u_char
dec
)
{
f_descr
*
ptr
;
...
...
@@ -232,7 +232,7 @@ dbf_add_field(dbhead * dbh, u_char *name, u_char type,
}
dbhead
*
dbf_open_new
(
u_
char
*
name
,
int
flags
)
dbf_open_new
(
char
*
name
,
int
flags
)
{
dbhead
*
dbh
;
...
...
@@ -339,7 +339,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
end
--
;
i
--
;
}
strncpy
(
fields
[
t
].
db_contents
,
dbffield
,
i
);
strncpy
(
(
char
*
)
fields
[
t
].
db_contents
,
(
char
*
)
dbffield
,
i
);
fields
[
t
].
db_contents
[
i
]
=
'\0'
;
}
else
...
...
@@ -351,7 +351,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
end
++
;
i
--
;
}
strncpy
(
fields
[
t
].
db_contents
,
end
,
i
);
strncpy
(
(
char
*
)
fields
[
t
].
db_contents
,
(
char
*
)
end
,
i
);
fields
[
t
].
db_contents
[
i
]
=
'\0'
;
}
...
...
@@ -419,7 +419,7 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
u_char
*
data
,
end
=
0x1a
;
double
fl
;
u_
char
foo
[
128
],
char
foo
[
128
],
format
[
32
];
/* offset: offset in file for this record
...
...
@@ -473,11 +473,12 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
/* Handle text */
if
(
rec
[
t
].
db_type
==
'C'
)
{
if
(
strlen
(
rec
[
t
].
db_contents
)
>
rec
[
t
].
db_flen
)
if
(
strlen
(
(
char
*
)
rec
[
t
].
db_contents
)
>
rec
[
t
].
db_flen
)
length
=
rec
[
t
].
db_flen
;
else
length
=
strlen
(
rec
[
t
].
db_contents
);
strncpy
(
data
+
idx
,
rec
[
t
].
db_contents
,
length
);
length
=
strlen
((
char
*
)
rec
[
t
].
db_contents
);
strncpy
((
char
*
)
data
+
idx
,
(
char
*
)
rec
[
t
].
db_contents
,
length
);
}
else
{
...
...
@@ -485,18 +486,18 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
/* Numeric is special, because of real numbers */
if
((
rec
[
t
].
db_type
==
'N'
)
&&
(
rec
[
t
].
db_dec
!=
0
))
{
fl
=
atof
(
rec
[
t
].
db_contents
);
fl
=
atof
(
(
char
*
)
rec
[
t
].
db_contents
);
snprintf
(
format
,
32
,
"%%.%df"
,
rec
[
t
].
db_dec
);
snprintf
(
foo
,
128
,
format
,
fl
);
}
else
strncpy
(
foo
,
rec
[
t
].
db_contents
,
128
);
strncpy
(
foo
,
(
char
*
)
rec
[
t
].
db_contents
,
128
);
if
(
strlen
(
foo
)
>
rec
[
t
].
db_flen
)
length
=
rec
[
t
].
db_flen
;
else
length
=
strlen
(
foo
);
h
=
rec
[
t
].
db_flen
-
length
;
strncpy
(
data
+
idx
+
h
,
foo
,
length
);
strncpy
(
(
char
*
)
(
data
+
idx
+
h
)
,
foo
,
length
);
}
}
idx
+=
rec
[
t
].
db_flen
;
...
...
contrib/dbase/dbf.h
View file @
8a65b820
...
...
@@ -60,7 +60,7 @@ typedef struct
typedef
struct
{
u_
char
dbf_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
char
dbf_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
u_char
dbf_type
;
/* field-type */
u_char
dbf_reserved
[
4
];
/* some reserved stuff */
u_char
dbf_flen
;
/* field-length */
...
...
@@ -73,7 +73,7 @@ typedef struct
typedef
struct
{
u_
char
db_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
char
db_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
u_char
db_type
;
/* field-type */
u_char
db_flen
;
/* field-length */
u_char
db_dec
;
/* number of decimal positions */
...
...
@@ -107,7 +107,7 @@ typedef struct
typedef
struct
{
u_
char
db_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
char
db_name
[
DBF_NAMELEN
];
/* field-name terminated with \0 */
u_char
db_type
;
/* field-type */
u_char
db_flen
;
/* field-length */
u_char
db_dec
;
/* number of decimal positions */
...
...
@@ -116,12 +116,12 @@ typedef struct
/* prototypes for functions */
extern
dbhead
*
dbf_open
(
u_
char
*
file
,
int
flags
);
extern
dbhead
*
dbf_open
(
char
*
file
,
int
flags
);
extern
int
dbf_write_head
(
dbhead
*
dbh
);
extern
int
dbf_put_fields
(
dbhead
*
dbh
);
extern
int
dbf_add_field
(
dbhead
*
dbh
,
u_
char
*
name
,
u_char
type
,
extern
int
dbf_add_field
(
dbhead
*
dbh
,
char
*
name
,
u_char
type
,
u_char
length
,
u_char
dec
);
extern
dbhead
*
dbf_open_new
(
u_
char
*
name
,
int
flags
);
extern
dbhead
*
dbf_open_new
(
char
*
name
,
int
flags
);
extern
void
dbf_close
(
dbhead
*
dbh
);
extern
int
dbf_get_record
(
dbhead
*
dbh
,
field
*
fields
,
u_long
rec
);
extern
field
*
dbf_build_record
(
dbhead
*
dbh
);
...
...
contrib/dbase/dbf2pg.c
View file @
8a65b820
...
...
@@ -434,11 +434,11 @@ do_inserts(PGconn *conn, char *table, dbhead * dbh)
* separator */
if
(
upper
)
strtoupper
(
fields
[
h
].
db_contents
);
strtoupper
(
(
char
*
)
fields
[
h
].
db_contents
);
if
(
lower
)
strtolower
(
fields
[
h
].
db_contents
);
strtolower
(
(
char
*
)
fields
[
h
].
db_contents
);
foo
=
fields
[
h
].
db_contents
;
foo
=
(
char
*
)
fields
[
h
].
db_contents
;
#ifdef HAVE_ICONV_H
if
(
charset_from
)
foo
=
convert_charset
(
foo
);
...
...
contrib/ltree/ltree_io.c
View file @
8a65b820
...
...
@@ -469,7 +469,7 @@ lquery_in(PG_FUNCTION_ARGS)
cur
->
totallen
+=
MAXALIGN
(
LVAR_HDRSIZE
+
lptr
->
len
);
lrptr
->
len
=
lptr
->
len
;
lrptr
->
flag
=
lptr
->
flag
;
lrptr
->
val
=
ltree_crc32_sz
(
(
uint8
*
)
lptr
->
start
,
lptr
->
len
);
lrptr
->
val
=
ltree_crc32_sz
(
lptr
->
start
,
lptr
->
len
);
memcpy
(
lrptr
->
name
,
lptr
->
start
,
lptr
->
len
);
lptr
++
;
lrptr
=
LVAR_NEXT
(
lrptr
);
...
...
contrib/ltree/ltxtquery_io.c
View file @
8a65b820
...
...
@@ -171,7 +171,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"word is too long"
)));
pushquery
(
state
,
type
,
ltree_crc32_sz
(
(
uint8
*
)
strval
,
lenval
),
pushquery
(
state
,
type
,
ltree_crc32_sz
(
strval
,
lenval
),
state
->
curop
-
state
->
op
,
lenval
,
flag
);
while
(
state
->
curop
-
state
->
op
+
lenval
+
1
>=
state
->
lenop
)
...
...
contrib/pgcrypto/crypt-des.c
View file @
8a65b820
...
...
@@ -651,9 +651,9 @@ px_crypt_des(const char *key, const char *setting)
r0
,
r1
,
keybuf
[
2
];
uint8
*
p
,
*
q
;
static
uint8
output
[
21
];
char
*
p
;
uint8
*
q
;
static
char
output
[
21
];
if
(
!
des_initialised
)
des_init
();
...
...
@@ -669,7 +669,7 @@ px_crypt_des(const char *key, const char *setting)
if
((
*
q
++
=
*
key
<<
1
))
key
++
;
}
if
(
des_setkey
((
uint8
*
)
keybuf
))
if
(
des_setkey
((
char
*
)
keybuf
))
return
(
NULL
);
#ifndef DISABLE_XDES
...
...
@@ -690,7 +690,7 @@ px_crypt_des(const char *key, const char *setting)
/*
* Encrypt the key with itself.
*/
if
(
des_cipher
((
uint8
*
)
keybuf
,
(
uint8
*
)
keybuf
,
0L
,
1
))
if
(
des_cipher
((
char
*
)
keybuf
,
(
char
*
)
keybuf
,
0L
,
1
))
return
(
NULL
);
/*
...
...
@@ -700,7 +700,7 @@ px_crypt_des(const char *key, const char *setting)
while
(
q
-
(
uint8
*
)
keybuf
-
8
&&
*
key
)
*
q
++
^=
*
key
++
<<
1
;
if
(
des_setkey
((
uint8
*
)
keybuf
))
if
(
des_setkey
((
char
*
)
keybuf
))
return
(
NULL
);
}
strncpy
(
output
,
setting
,
9
);
...
...
contrib/pgcrypto/crypt-md5.c
View file @
8a65b820
...
...
@@ -8,7 +8,7 @@
*
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
*
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.
4 2005/07/11 15:07:59
tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.
5 2005/09/24 19:14:04
tgl Exp $
*/
#include "postgres.h"
...
...
@@ -63,18 +63,18 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
err
=
px_find_digest
(
"md5"
,
&
ctx1
);
/* The password first, since that is what is most unknown */
px_md_update
(
ctx
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx
,
(
uint8
*
)
pw
,
strlen
(
pw
));
/* Then our magic string */
px_md_update
(
ctx
,
magic
,
strlen
(
magic
));
px_md_update
(
ctx
,
(
uint8
*
)
magic
,
strlen
(
magic
));
/* Then the raw salt */
px_md_update
(
ctx
,
sp
,
sl
);
px_md_update
(
ctx
,
(
uint8
*
)
sp
,
sl
);
/* Then just as many characters of the MD5(pw,salt,pw) */
px_md_update
(
ctx1
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
sp
,
sl
);
px_md_update
(
ctx1
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
(
uint8
*
)
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
(
uint8
*
)
sp
,
sl
);
px_md_update
(
ctx1
,
(
uint8
*
)
pw
,
strlen
(
pw
));
px_md_finish
(
ctx1
,
final
);
for
(
pl
=
strlen
(
pw
);
pl
>
0
;
pl
-=
MD5_SIZE
)
px_md_update
(
ctx
,
final
,
pl
>
MD5_SIZE
?
MD5_SIZE
:
pl
);
...
...
@@ -87,7 +87,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
if
(
i
&
1
)
px_md_update
(
ctx
,
final
,
1
);
else
px_md_update
(
ctx
,
pw
,
1
);
px_md_update
(
ctx
,
(
uint8
*
)
pw
,
1
);
/* Now make the output string */
strcpy
(
passwd
,
magic
);
...
...
@@ -105,20 +105,20 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
{
px_md_reset
(
ctx1
);
if
(
i
&
1
)
px_md_update
(
ctx1
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
(
uint8
*
)
pw
,
strlen
(
pw
));
else
px_md_update
(
ctx1
,
final
,
MD5_SIZE
);
if
(
i
%
3
)
px_md_update
(
ctx1
,
sp
,
sl
);
px_md_update
(
ctx1
,
(
uint8
*
)
sp
,
sl
);
if
(
i
%
7
)
px_md_update
(
ctx1
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
(
uint8
*
)
pw
,
strlen
(
pw
));
if
(
i
&
1
)
px_md_update
(
ctx1
,
final
,
MD5_SIZE
);
else
px_md_update
(
ctx1
,
pw
,
strlen
(
pw
));
px_md_update
(
ctx1
,
(
uint8
*
)
pw
,
strlen
(
pw
));
px_md_finish
(
ctx1
,
final
);
}
...
...
contrib/pgcrypto/pgcrypto.c
View file @
8a65b820
...
...
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.1
8 2005/03/21 05:19:55 neilc
Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.1
9 2005/09/24 19:14:04 tgl
Exp $
*/
#include "postgres.h"
...
...
@@ -75,8 +75,8 @@ pg_digest(PG_FUNCTION_ARGS)
arg
=
PG_GETARG_BYTEA_P
(
0
);
len
=
VARSIZE
(
arg
)
-
VARHDRSZ
;
px_md_update
(
md
,
VARDATA
(
arg
),
len
);
px_md_finish
(
md
,
VARDATA
(
res
));
px_md_update
(
md
,
(
uint8
*
)
VARDATA
(
arg
),
len
);
px_md_finish
(
md
,
(
uint8
*
)
VARDATA
(
res
));
px_md_free
(
md
);
PG_FREE_IF_COPY
(
arg
,
0
);
...
...
@@ -144,9 +144,9 @@ pg_hmac(PG_FUNCTION_ARGS)
len
=
VARSIZE
(
arg
)
-
VARHDRSZ
;
klen
=
VARSIZE
(
key
)
-
VARHDRSZ
;
px_hmac_init
(
h
,
VARDATA
(
key
),
klen
);
px_hmac_update
(
h
,
VARDATA
(
arg
),
len
);
px_hmac_finish
(
h
,
VARDATA
(
res
));
px_hmac_init
(
h
,
(
uint8
*
)
VARDATA
(
key
),
klen
);
px_hmac_update
(
h
,
(
uint8
*
)
VARDATA
(
arg
),
len
);
px_hmac_finish
(
h
,
(
uint8
*
)
VARDATA
(
res
));
px_hmac_free
(
h
);
PG_FREE_IF_COPY
(
arg
,
0
);
...
...
@@ -346,9 +346,10 @@ pg_encrypt(PG_FUNCTION_ARGS)
rlen
=
px_combo_encrypt_len
(
c
,
dlen
);
res
=
palloc
(
VARHDRSZ
+
rlen
);
err
=
px_combo_init
(
c
,
VARDATA
(
key
),
klen
,
NULL
,
0
);
err
=
px_combo_init
(
c
,
(
uint8
*
)
VARDATA
(
key
),
klen
,
NULL
,
0
);
if
(
!
err
)
err
=
px_combo_encrypt
(
c
,
VARDATA
(
data
),
dlen
,
VARDATA
(
res
),
&
rlen
);
err
=
px_combo_encrypt
(
c
,
(
uint8
*
)
VARDATA
(
data
),
dlen
,
(
uint8
*
)
VARDATA
(
res
),
&
rlen
);
px_combo_free
(
c
);
PG_FREE_IF_COPY
(
data
,
0
);
...
...
@@ -397,9 +398,10 @@ pg_decrypt(PG_FUNCTION_ARGS)
rlen
=
px_combo_decrypt_len
(
c
,
dlen
);
res
=
palloc
(
VARHDRSZ
+
rlen
);
err
=
px_combo_init
(
c
,
VARDATA
(
key
),
klen
,
NULL
,
0
);
err
=
px_combo_init
(
c
,
(
uint8
*
)
VARDATA
(
key
),
klen
,
NULL
,
0
);
if
(
!
err
)
err
=
px_combo_decrypt
(
c
,
VARDATA
(
data
),
dlen
,
VARDATA
(
res
),
&
rlen
);
err
=
px_combo_decrypt
(
c
,
(
uint8
*
)
VARDATA
(
data
),
dlen
,
(
uint8
*
)
VARDATA
(
res
),
&
rlen
);
px_combo_free
(
c
);
...
...
@@ -452,9 +454,11 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
rlen
=
px_combo_encrypt_len
(
c
,
dlen
);
res
=
palloc
(
VARHDRSZ
+
rlen
);
err
=
px_combo_init
(
c
,
VARDATA
(
key
),
klen
,
VARDATA
(
iv
),
ivlen
);
err
=
px_combo_init
(
c
,
(
uint8
*
)
VARDATA
(
key
),
klen
,
(
uint8
*
)
VARDATA
(
iv
),
ivlen
);
if
(
!
err
)
px_combo_encrypt
(
c
,
VARDATA
(
data
),
dlen
,
VARDATA
(
res
),
&
rlen
);
px_combo_encrypt
(
c
,
(
uint8
*
)
VARDATA
(
data
),
dlen
,
(
uint8
*
)
VARDATA
(
res
),
&
rlen
);
px_combo_free
(
c
);
...
...
@@ -508,9 +512,11 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
rlen
=
px_combo_decrypt_len
(
c
,
dlen
);
res
=
palloc
(
VARHDRSZ
+
rlen
);
err
=
px_combo_init
(
c
,
VARDATA
(
key
),
klen
,
VARDATA
(
iv
),
ivlen
);
err
=
px_combo_init
(
c
,
(
uint8
*
)
VARDATA
(
key
),
klen
,
(
uint8
*
)
VARDATA
(
iv
),
ivlen
);
if
(
!
err
)
px_combo_decrypt
(
c
,
VARDATA
(
data
),
dlen
,
VARDATA
(
res
),
&
rlen
);
px_combo_decrypt
(
c
,
(
uint8
*
)
VARDATA
(
data
),
dlen
,
(
uint8
*
)
VARDATA
(
res
),
&
rlen
);
px_combo_free
(
c
);
...
...
contrib/pgcrypto/pgp-decrypt.c
View file @
8a65b820
...
...
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.
4 2005/07/18 17:09:01
tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.
5 2005/09/24 19:14:04
tgl Exp $
*/
#include "postgres.h"
...
...
@@ -792,7 +792,7 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt)
break
;
}
if
(
res
>=
0
&&
got_cr
)
res
=
mbuf_append
(
dst
,
"
\r
"
,
1
);
res
=
mbuf_append
(
dst
,
(
const
uint8
*
)
"
\r
"
,
1
);
return
res
;
}
...
...
contrib/pgcrypto/pgp-pgsql.c
View file @
8a65b820
...
...
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.
4 2005/08/13 02:06:20 momjian
Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.
5 2005/09/24 19:14:04 tgl
Exp $
*/
#include "postgres.h"
...
...
@@ -94,7 +94,7 @@ static void add_block_entropy(PX_MD *md, text *data)
uint8
sha1
[
20
];
px_md_reset
(
md
);
px_md_update
(
md
,
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
px_md_update
(
md
,
(
uint8
*
)
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
px_md_finish
(
md
,
sha1
);
px_add_entropy
(
sha1
,
20
);
...
...
@@ -151,14 +151,14 @@ static text *convert_charset(text *src, int cset_from, int cset_to)
int
src_len
=
VARSIZE
(
src
)
-
VARHDRSZ
;
int
dst_len
;
unsigned
char
*
dst
;
unsigned
char
*
csrc
=
VARDATA
(
src
);
unsigned
char
*
csrc
=
(
unsigned
char
*
)
VARDATA
(
src
);
text
*
res
;
dst
=
pg_do_encoding_conversion
(
csrc
,
src_len
,
cset_from
,
cset_to
);
if
(
dst
==
csrc
)
return
src
;
dst_len
=
strlen
(
dst
);
dst_len
=
strlen
(
(
char
*
)
dst
);
res
=
palloc
(
dst_len
+
VARHDRSZ
);
memcpy
(
VARDATA
(
res
),
dst
,
dst_len
);
VARATT_SIZEP
(
res
)
=
VARHDRSZ
+
dst_len
;
...
...
@@ -398,7 +398,8 @@ static int parse_args(PGP_Context *ctx, uint8 *args, int arg_len,
static
MBuf
*
create_mbuf_from_vardata
(
text
*
data
)
{
return
mbuf_create_from_data
(
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
return
mbuf_create_from_data
((
uint8
*
)
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
}
static
void
...
...
@@ -410,7 +411,8 @@ init_work(PGP_Context **ctx_p, int is_text,
fill_expect
(
ex
,
is_text
);
if
(
err
==
0
&&
args
!=
NULL
)
err
=
parse_args
(
*
ctx_p
,
VARDATA
(
args
),
VARSIZE
(
args
)
-
VARHDRSZ
,
ex
);
err
=
parse_args
(
*
ctx_p
,
(
uint8
*
)
VARDATA
(
args
),
VARSIZE
(
args
)
-
VARHDRSZ
,
ex
);
if
(
err
)
{
...
...
@@ -474,7 +476,8 @@ encrypt_internal(int is_pubenc, int is_text,
mbuf_free
(
kbuf
);
}
else
err
=
pgp_set_symkey
(
ctx
,
VARDATA
(
key
),
VARSIZE
(
key
)
-
VARHDRSZ
);
err
=
pgp_set_symkey
(
ctx
,
(
uint8
*
)
VARDATA
(
key
),
VARSIZE
(
key
)
-
VARHDRSZ
);
/*
* encrypt
...
...
@@ -532,7 +535,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
init_work
(
&
ctx
,
need_text
,
args
,
&
ex
);
src
=
mbuf_create_from_data
(
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
src
=
mbuf_create_from_data
((
uint8
*
)
VARDATA
(
data
),
VARSIZE
(
data
)
-
VARHDRSZ
);
dst
=
mbuf_create
(
VARSIZE
(
data
)
+
2048
);
/*
...
...
@@ -550,7 +554,7 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
MBuf
*
kbuf
;
if
(
keypsw
)
{
psw
=
VARDATA
(
keypsw
);
psw
=
(
uint8
*
)
VARDATA
(
keypsw
);
psw_len
=
VARSIZE
(
keypsw
)
-
VARHDRSZ
;
}
kbuf
=
create_mbuf_from_vardata
(
key
);
...
...
@@ -558,7 +562,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
mbuf_free
(
kbuf
);
}
else
err
=
pgp_set_symkey
(
ctx
,
VARDATA
(
key
),
VARSIZE
(
key
)
-
VARHDRSZ
);
err
=
pgp_set_symkey
(
ctx
,
(
uint8
*
)
VARDATA
(
key
),
VARSIZE
(
key
)
-
VARHDRSZ
);
/*
* decrypt
...
...
@@ -846,7 +851,8 @@ pg_armor(PG_FUNCTION_ARGS)
guess_len
=
pgp_armor_enc_len
(
data_len
);
res
=
palloc
(
VARHDRSZ
+
guess_len
);
res_len
=
pgp_armor_encode
(
VARDATA
(
data
),
data_len
,
VARDATA
(
res
));
res_len
=
pgp_armor_encode
((
uint8
*
)
VARDATA
(
data
),
data_len
,
(
uint8
*
)
VARDATA
(
res
));
if
(
res_len
>
guess_len
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
),
...
...
@@ -875,7 +881,8 @@ pg_dearmor(PG_FUNCTION_ARGS)
guess_len
=
pgp_armor_dec_len
(
data_len
);
res
=
palloc
(
VARHDRSZ
+
guess_len
);
res_len
=
pgp_armor_decode
(
VARDATA
(
data
),
data_len
,
VARDATA
(
res
));
res_len
=
pgp_armor_decode
((
uint8
*
)
VARDATA
(
data
),
data_len
,
(
uint8
*
)
VARDATA
(
res
));
if
(
res_len
<
0
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
),
...
...
contrib/pgcrypto/px-crypt.c
View file @
8a65b820
...
...
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.1
3 2005/08/13 02:06:20 momjian
Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.1
4 2005/09/24 19:14:04 tgl
Exp $
*/
#include "postgres.h"
...
...
@@ -152,7 +152,7 @@ px_gen_salt(const char *salt_type, char *buf, int rounds)
return
PXE_BAD_SALT_ROUNDS
;
}
res
=
px_get_pseudo_random_bytes
(
rbuf
,
g
->
input_len
);
res
=
px_get_pseudo_random_bytes
(
(
uint8
*
)
rbuf
,
g
->
input_len
);
if
(
res
<
0
)
return
res
;
...
...
contrib/tsearch2/dict_snowball.c
View file @
8a65b820
...
...
@@ -111,7 +111,7 @@ snb_lexize(PG_FUNCTION_ARGS)
}
else
{
SN_set_current
(
d
->
z
,
strlen
(
txt
),
txt
);
SN_set_current
(
d
->
z
,
strlen
(
txt
),
(
symbol
*
)
txt
);
(
d
->
stem
)
(
d
->
z
);
if
(
d
->
z
->
p
&&
d
->
z
->
l
)
{
...
...
contrib/tsearch2/gistidx.c
View file @
8a65b820
...
...
@@ -156,7 +156,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
len
=
val
->
size
;
while
(
len
--
)
{
*
arr
=
crc32_sz
(
(
uint8
*
)
&
words
[
ptr
->
pos
],
ptr
->
len
);
*
arr
=
crc32_sz
(
&
words
[
ptr
->
pos
],
ptr
->
len
);
arr
++
;
ptr
++
;
}
...
...
contrib/tsearch2/ispell/spell.c
View file @
8a65b820
...
...
@@ -52,12 +52,12 @@ strnduplicate(char *s, int len)
return
d
;
}
/* backward string compa
i
re for suffix tree operations */
/* backward string compare for suffix tree operations */
static
int
strbcmp
(
const
unsigned
char
*
s1
,
const
unsigned
char
*
s2
)
{
int
l1
=
strlen
(
s1
)
-
1
,
l2
=
strlen
(
s2
)
-
1
;
int
l1
=
strlen
(
(
const
char
*
)
s1
)
-
1
,
l2
=
strlen
(
(
const
char
*
)
s2
)
-
1
;
while
(
l1
>=
0
&&
l2
>=
0
)
{
...
...
@@ -78,8 +78,8 @@ strbcmp(const unsigned char *s1, const unsigned char *s2)
static
int
strbncmp
(
const
unsigned
char
*
s1
,
const
unsigned
char
*
s2
,
size_t
count
)
{
int
l1
=
strlen
(
s1
)
-
1
,
l2
=
strlen
(
s2
)
-
1
,
int
l1
=
strlen
(
(
const
char
*
)
s1
)
-
1
,
l2
=
strlen
(
(
const
char
*
)
s2
)
-
1
,
l
=
count
;
while
(
l1
>=
0
&&
l2
>=
0
&&
l
>
0
)
...
...
@@ -104,14 +104,18 @@ strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count)
static
int
cmpaffix
(
const
void
*
s1
,
const
void
*
s2
)
{
if
(((
const
AFFIX
*
)
s1
)
->
type
<
((
const
AFFIX
*
)
s2
)
->
type
)
const
AFFIX
*
a1
=
(
const
AFFIX
*
)
s1
;
const
AFFIX
*
a2
=
(
const
AFFIX
*
)
s2
;
if
(
a1
->
type
<
a2
->
type
)
return
-
1
;
if
(
((
const
AFFIX
*
)
s1
)
->
type
>
((
const
AFFIX
*
)
s2
)
->
type
)
if
(
a1
->
type
>
a2
->
type
)
return
1
;
if
(
((
const
AFFIX
*
)
s1
)
->
type
==
FF_PREFIX
)
return
(
strcmp
(((
const
AFFIX
*
)
s1
)
->
repl
,
((
const
AFFIX
*
)
s2
)
->
repl
)
);
if
(
a1
->
type
==
FF_PREFIX
)
return
strcmp
(
a1
->
repl
,
a2
->
repl
);
else
return
(
strbcmp
(((
const
AFFIX
*
)
s1
)
->
repl
,
((
const
AFFIX
*
)
s2
)
->
repl
));
return
strbcmp
((
const
unsigned
char
*
)
a1
->
repl
,
(
const
unsigned
char
*
)
a2
->
repl
);
}
int
...
...
@@ -142,29 +146,29 @@ NIAddSpell(IspellDict * Conf, const char *word, const char *flag)
int
NIImportDictionary
(
IspellDict
*
Conf
,
const
char
*
filename
)
{
unsigned
char
str
[
BUFSIZ
];
char
str
[
BUFSIZ
];
FILE
*
dict
;
if
(
!
(
dict
=
fopen
(
filename
,
"r"
)))
return
(
1
);
while
(
fgets
(
str
,
sizeof
(
str
),
dict
))
{
unsigned
char
*
s
;
const
unsigned
char
*
flag
;
char
*
s
;
const
char
*
flag
;
flag
=
NULL
;
if
((
s
=
strchr
(
str
,
'/'
)))
{
*
s
=
0
;
s
++
;
*
s
++
=
'\0'
;
flag
=
s
;
while
(
*
s
)
{
if
(
isprint
(
*
s
)
&&
!
isspace
(
*
s
))
if
(
isprint
((
unsigned
char
)
*
s
)
&&
!
isspace
((
unsigned
char
)
*
s
))
s
++
;
else
{
*
s
=
0
;
*
s
=
'\0'
;
break
;
}
}
...
...
@@ -177,10 +181,8 @@ NIImportDictionary(IspellDict * Conf, const char *filename)
s
=
str
;
while
(
*
s
)
{
if
(
*
s
==
'\r'
)
*
s
=
0
;
if
(
*
s
==
'\n'
)
*
s
=
0
;
if
(
*
s
==
'\r'
||
*
s
==
'\n'
)
*
s
=
'\0'
;
s
++
;
}
NIAddSpell
(
Conf
,
str
,
flag
);
...
...
@@ -311,16 +313,16 @@ remove_spaces(char *dist, char *src)
int
NIImportAffixes
(
IspellDict
*
Conf
,
const
char
*
filename
)
{
unsigned
char
str
[
BUFSIZ
];
unsigned
char
flag
=
0
;
unsigned
char
mask
[
BUFSIZ
]
=
""
;
unsigned
char
find
[
BUFSIZ
]
=
""
;
unsigned
char
repl
[
BUFSIZ
]
=
""
;
unsigned
char
*
s
;
char
str
[
BUFSIZ
];
char
mask
[
BUFSIZ
];
char
find
[
BUFSIZ
];
char
repl
[
BUFSIZ
];
char
*
s
;
int
i
;
int
suffixes
=
0
;
int
prefixes
=
0
;
unsigned
char
flagflags
=
0
;
int
flag
=
0
;
char
flagflags
=
0
;
FILE
*
affix
;
if
(
!
(
affix
=
fopen
(
filename
,
"r"
)))
...
...
@@ -374,7 +376,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
if
(
*
s
==
'\\'
)
s
++
;
flag
=
*
s
;
flag
=
(
unsigned
char
)
*
s
;
continue
;
}
if
((
!
suffixes
)
&&
(
!
prefixes
))
...
...
@@ -409,7 +411,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
continue
;
}
NIAddAffix
(
Conf
,
(
int
)
flag
,
(
char
)
flagflags
,
mask
,
find
,
repl
,
suffixes
?
FF_SUFFIX
:
FF_PREFIX
);
NIAddAffix
(
Conf
,
flag
,
flagflags
,
mask
,
find
,
repl
,
suffixes
?
FF_SUFFIX
:
FF_PREFIX
);
}
fclose
(
affix
);
...
...
@@ -681,7 +683,10 @@ NISortAffixes(IspellDict * Conf)
firstsuffix
=
i
;
if
(
Affix
->
flagflags
&
FF_COMPOUNDONLYAFX
)
{
if
(
!
ptr
->
affix
||
strbncmp
((
ptr
-
1
)
->
affix
,
Affix
->
repl
,
(
ptr
-
1
)
->
len
))
if
(
!
ptr
->
affix
||
strbncmp
((
const
unsigned
char
*
)
(
ptr
-
1
)
->
affix
,
(
const
unsigned
char
*
)
Affix
->
repl
,
(
ptr
-
1
)
->
len
))
{
/* leave only unique and minimals suffixes */
ptr
->
affix
=
Affix
->
repl
;
...
...
contrib/tsearch2/query.c
View file @
8a65b820
...
...
@@ -238,7 +238,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, int2 weight
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"word is too long"
)));
pushquery
(
state
,
type
,
crc32_sz
(
(
uint8
*
)
strval
,
lenval
),
pushquery
(
state
,
type
,
crc32_sz
(
strval
,
lenval
),
state
->
curop
-
state
->
op
,
lenval
,
weight
);
while
(
state
->
curop
-
state
->
op
+
lenval
+
1
>=
state
->
lenop
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment