#define BUFFER_READ_STREAM 1
typedef struct buffer_data *buffer_data_t;
-typedef long (*buffer_proc_t)(buffer_data_t data, void *buf, long size, char *desc);
+typedef ssize_t (*buffer_proc_t)(buffer_data_t data, void *buf, ssize_t size, char *desc);
struct buffer_data {
buffer_proc_t proc;
void *data;
buffer_copy_setup((void *)file, BUFFER_READ_STREAM, NULL, \
(void *)fd, BUFFER_WRITE_FD, NULL, \
limit, desc)
-long buffer_copy_setup(void *argIn, int typeIn, void *procIn,
+ssize_t buffer_copy_setup(void *argIn, int typeIn, void *procIn,
void *argOut, int typeOut, void *procOut,
- long limit, char *desc, ...);
-long buffer_copy(buffer_data_t read_data, buffer_data_t write_data, long limit, char *desc);
+ ssize_t limit, char *desc, ...);
+ssize_t buffer_copy(buffer_data_t read_data, buffer_data_t write_data, ssize_t limit, char *desc);
extern volatile int onerr_abort;
checksubprocerr(status,description,sigpipeok);
}
-long buffer_write(buffer_data_t data, void *buf, long length, char *desc) {
- long ret= length;
+ssize_t buffer_write(buffer_data_t data, void *buf, ssize_t length, char *desc) {
+ ssize_t ret= length;
switch(data->type) {
case BUFFER_WRITE_BUF:
memcpy(data->data, buf, length);
return ret;
}
-long buffer_read(buffer_data_t data, void *buf, long length, char *desc) {
- long ret= length;
+ssize_t buffer_read(buffer_data_t data, void *buf, ssize_t length, char *desc) {
+ ssize_t ret= length;
switch(data->type) {
case BUFFER_READ_FD:
if((ret= read((int)data->data, buf, length)) < 0 && errno != EINTR)
return ret;
}
-long buffer_copy_setup(void *argIn, int typeIn, void *procIn,
+ssize_t buffer_copy_setup(void *argIn, int typeIn, void *procIn,
void *argOut, int typeOut, void *procOut,
- long limit, char *desc, ...)
+ ssize_t limit, char *desc, ...)
{
struct buffer_data read_data = { procIn, argIn, typeIn },
write_data = { procOut, argOut, typeOut };
va_list al;
struct varbuf v;
- int ret;
+ ssize_t ret;
varbufinit(&v);
}
-long buffer_copy(buffer_data_t read_data, buffer_data_t write_data, long limit, char *desc) {
+ssize_t buffer_copy(buffer_data_t read_data, buffer_data_t write_data, ssize_t limit, char *desc) {
char *buf, *writebuf;
long bytesread= 0, byteswritten= 0;
int bufsize= 32768;
- long totalread= 0;
- long totalwritten= 0;
+ ssize_t totalread= 0, totalwritten= 0;
if((limit != -1) && (limit < bufsize)) bufsize= limit;
writebuf= buf= malloc(bufsize);
if(buf== NULL) ohshite(_("failed to allocate buffer in buffer_copy (%s)"), desc);
if (bytesread<0 || byteswritten<0) ohshite(_("failed in buffer_copy (%s)"), desc);
free(buf);
- return bytesread;
+ return totalread;
}
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-12-21 01:21-0600\n"
+"POT-Creation-Date: 2000-12-21 01:36-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "unknown data type `%i' in buffer_read\n"
msgstr ""
-#: lib/mlib.c:210
+#: lib/mlib.c:209
#, c-format
msgid "failed to allocate buffer in buffer_copy (%s)"
msgstr ""
-#: lib/mlib.c:241
+#: lib/mlib.c:240
#, c-format
msgid "failed in buffer_copy (%s)"
msgstr ""