#include "catalog/catalog.h"
#include "miscadmin.h"
#include "utils/fmgroids.h"
-#include "common/pg_lzcompress.h"
+#include "utils/pg_lzcompress.h"
#include "utils/rel.h"
#include "utils/typcache.h"
#include "utils/tqual.h"
attr = (struct varlena *) palloc(PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
SET_VARSIZE(attr, PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
- if (!pglz_decompress(tmp, VARDATA(attr)))
- elog(ERROR, "compressed data is corrupted");
+ pglz_decompress(tmp, VARDATA(attr));
pfree(tmp);
}
}
attr = (struct varlena *) palloc(PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
SET_VARSIZE(attr, PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
- if (!pglz_decompress(tmp, VARDATA(attr)))
- elog(ERROR, "compressed data is corrupted");
+ pglz_decompress(tmp, VARDATA(attr));
}
else if (VARATT_IS_SHORT(attr))
{
preslice = (struct varlena *) palloc(size);
SET_VARSIZE(preslice, size);
- if (!pglz_decompress(tmp, VARDATA(preslice)))
- elog(ERROR, "compressed data is corrupted");
+ pglz_decompress(tmp, VARDATA(preslice));
if (tmp != (PGLZ_Header *) attr)
pfree(tmp);
jsonfuncs.o like.o lockfuncs.o mac.o misc.o nabstime.o name.o \
network.o network_gist.o network_selfuncs.o \
numeric.o numutils.o oid.o oracle_compat.o \
- orderedsetaggs.o pg_locale.o pg_lsn.o pgstatfuncs.o \
- pseudotypes.o quote.o rangetypes.o rangetypes_gist.o \
+ orderedsetaggs.o pg_lzcompress.o pg_locale.o pg_lsn.o \
+ pgstatfuncs.o pseudotypes.o quote.o rangetypes.o rangetypes_gist.o \
rangetypes_selfuncs.o rangetypes_spgist.o rangetypes_typanalyze.o \
regexp.o regproc.o ri_triggers.o rowtypes.o ruleutils.o \
selfuncs.o tid.o timestamp.o trigfuncs.o \
* FALSE if not; in the latter case the contents of dest
* are undefined.
*
- * bool
+ * void
* pglz_decompress(const PGLZ_Header *source, char *dest)
*
* source is the compressed input.
* The data is written to buff exactly as it was handed
* to pglz_compress(). No terminating zero byte is added.
*
- * The return value is TRUE if decompression succeeded,
- * FALSE if not; in the latter case the contents of dest
- * are undefined.
- *
* The decompression algorithm and internal data format:
*
* PGLZ_Header is defined as
*
* Copyright (c) 1999-2014, PostgreSQL Global Development Group
*
- * src/common/pg_lzcompress.c
+ * src/backend/utils/adt/pg_lzcompress.c
* ----------
*/
#include "postgres.h"
#include <limits.h>
-#include "common/pg_lzcompress.h"
+#include "utils/pg_lzcompress.h"
/* ----------
/* ----------
* pglz_compress -
*
- * Compresses source into dest using strategy. Returns false if a failure
- * occurred, true in case of success.
+ * Compresses source into dest using strategy.
* ----------
*/
bool
/* ----------
* pglz_decompress -
*
- * Decompresses source into dest. Returns false if a failure
- * occurred, true in case of success.
+ * Decompresses source into dest.
* ----------
*/
-bool
+void
pglz_decompress(const PGLZ_Header *source, char *dest)
{
const unsigned char *sp;
* Check we decompressed the right amount.
*/
if (dp != destend || sp != srcend)
- return false;
+ elog(ERROR, "compressed data is corrupt");
/*
* That's it.
*/
- return true;
}
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
LIBS += $(PTHREAD_LIBS)
-OBJS_COMMON = exec.o pg_lzcompress.o pgfnames.o psprintf.o relpath.o \
- rmtree.o username.o wait_error.o
+OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o username.o wait_error.o
OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o
*
* Definitions for the builtin LZ compressor
*
- * src/include/common/pg_lzcompress.h
+ * src/include/utils/pg_lzcompress.h
* ----------
*/
*/
extern bool pglz_compress(const char *source, int32 slen, PGLZ_Header *dest,
const PGLZ_Strategy *strategy);
-extern bool pglz_decompress(const PGLZ_Header *source, char *dest);
+extern void pglz_decompress(const PGLZ_Header *source, char *dest);
#endif /* _PG_LZCOMPRESS_H_ */
push(@pgportfiles, 'rint.c') if ($vsVersion < '12.00');
our @pgcommonallfiles = qw(
- exec.c pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
- username.c wait_error.c);
+ exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c));