PostgreSQL Source Code: src/bin/pg_dump/compress_none.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
16
19
20
21
22
23
24
25
26
27
28
29static void
31{
32 size_t cnt;
33 char *buf;
34 size_t buflen;
35
38
39 while ((cnt = cs->readF(AH, &buf, &buflen)))
40 {
42 }
43
45}
46
47
48static void
50 const void *data, size_t dLen)
51{
53}
54
55static void
57{
58
59}
60
61
62
63
64
65void
68{
72
74}
75
76
77
78
79
80
81
82
83
84
85
86static bool
88{
90 size_t ret;
91
92 if (size == 0)
93 return true;
94
95 ret = fread(ptr, 1, size, fp);
96 if (ret != size && !feof(fp))
97 pg_fatal("could not read from input file: %m");
98
99 if (rsize)
100 *rsize = ret;
101
102 return true;
103}
104
105static bool
107{
108 size_t ret;
109
110 ret = fwrite(ptr, 1, size, (FILE *) CFH->private_data);
111 if (ret != size)
112 return false;
113
114 return true;
115}
116
117static const char *
119{
121}
122
123static char *
125{
126 return fgets(ptr, size, (FILE *) CFH->private_data);
127}
128
129static int
131{
133 int ret;
134
135 ret = fgetc(fp);
136 if (ret == EOF)
137 {
138 if (!feof(fp))
139 pg_fatal("could not read from input file: %m");
140 else
141 pg_fatal("could not read from input file: end of file");
142 }
143
144 return ret;
145}
146
147static bool
149{
151 int ret = 0;
152
154
155 if (fp)
156 ret = fclose(fp);
157
158 return ret == 0;
159}
160
161static bool
163{
164 return feof((FILE *) CFH->private_data) != 0;
165}
166
167static bool
169{
171
172 if (fd >= 0)
174 else
176
178 return false;
179
180 return true;
181}
182
183static bool
185{
187
190 return false;
191
192 return true;
193}
194
195
196
197
198
199void
202{
212
214}
#define DEFAULT_IO_BUFFER_SIZE
static bool close_none(CompressFileHandle *CFH)
static int getc_none(CompressFileHandle *CFH)
static void EndCompressorNone(ArchiveHandle *AH, CompressorState *cs)
static bool write_none(const void *ptr, size_t size, CompressFileHandle *CFH)
void InitCompressorNone(CompressorState *cs, const pg_compress_specification compression_spec)
static bool eof_none(CompressFileHandle *CFH)
static char * gets_none(char *ptr, int size, CompressFileHandle *CFH)
void InitCompressFileHandleNone(CompressFileHandle *CFH, const pg_compress_specification compression_spec)
static bool open_write_none(const char *path, const char *mode, CompressFileHandle *CFH)
static bool read_none(void *ptr, size_t size, size_t *rsize, CompressFileHandle *CFH)
static void WriteDataToArchiveNone(ArchiveHandle *AH, CompressorState *cs, const void *data, size_t dLen)
static bool open_none(const char *path, int fd, const char *mode, CompressFileHandle *CFH)
static void ReadDataFromArchiveNone(ArchiveHandle *AH, CompressorState *cs)
static const char * get_error_none(CompressFileHandle *CFH)
void * pg_malloc(size_t size)
Assert(PointerIsAligned(start, uint64))
if(TABLE==NULL||TABLE_index==NULL)
void ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
static PgChecksumMode mode
static int fd(const char *x, int i)
char *(* gets_func)(char *s, int size, CompressFileHandle *CFH)
bool(* open_write_func)(const char *path, const char *mode, CompressFileHandle *CFH)
bool(* write_func)(const void *ptr, size_t size, struct CompressFileHandle *CFH)
int(* getc_func)(CompressFileHandle *CFH)
const char *(* get_error_func)(CompressFileHandle *CFH)
bool(* eof_func)(CompressFileHandle *CFH)
bool(* open_func)(const char *path, int fd, const char *mode, CompressFileHandle *CFH)
bool(* close_func)(CompressFileHandle *CFH)
bool(* read_func)(void *ptr, size_t size, size_t *rsize, CompressFileHandle *CFH)
void(* readData)(ArchiveHandle *AH, CompressorState *cs)
pg_compress_specification compression_spec
void(* end)(ArchiveHandle *AH, CompressorState *cs)
void(* writeData)(ArchiveHandle *AH, CompressorState *cs, const void *data, size_t dLen)