diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-10-31 17:57:13 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-10-31 17:57:13 +0000 |
commit | 2c25b805f5ece73cb8ea248177211266510b4b7d (patch) | |
tree | 98693ee4e8b712b5e0e7183e96890a076e539e42 /lib/libXfont/src/fc/fsio.c | |
parent | e37408906ed9e62da47bf754bed3ec3908e9d80a (diff) |
Update to libXfont 1.4.1
Diffstat (limited to 'lib/libXfont/src/fc/fsio.c')
-rw-r--r-- | lib/libXfont/src/fc/fsio.c | 85 |
1 files changed, 11 insertions, 74 deletions
diff --git a/lib/libXfont/src/fc/fsio.c b/lib/libXfont/src/fc/fsio.c index fbfb9dfed..79dc0d695 100644 --- a/lib/libXfont/src/fc/fsio.c +++ b/lib/libXfont/src/fc/fsio.c @@ -64,9 +64,6 @@ #define EINTR WSAEINTR #endif -#ifdef __UNIXOS2__ -#define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) -#endif static int padlength[4] = {0, 3, 2, 1}; @@ -125,8 +122,6 @@ _fs_connect(char *servername, int *err) _FontTransSetOption(trans_conn, TRANS_NONBLOCKING, 1); do { - if (i == TRANS_TRY_CONNECT_AGAIN) - sleep(1); i = _FontTransConnect(trans_conn,servername); } while ((i == TRANS_TRY_CONNECT_AGAIN) && (retries-- > 0)); @@ -150,7 +145,7 @@ _fs_connect(char *servername, int *err) return trans_conn; } -int +static int _fs_fill (FSFpePtr conn) { long avail; @@ -286,7 +281,7 @@ _fs_flush (FSFpePtr conn) { _fs_unmark_block (conn, FS_BROKEN_WRITE|FS_PENDING_WRITE); if (conn->outBuf.size > FS_BUF_INC) - conn->outBuf.buf = xrealloc (conn->outBuf.buf, FS_BUF_INC); + conn->outBuf.buf = realloc (conn->outBuf.buf, FS_BUF_INC); conn->outBuf.remove = conn->outBuf.insert = 0; } return FSIO_READY; @@ -312,7 +307,7 @@ _fs_resize (FSBufPtr buf, long size) if (buf->size - buf->remove < size) { new_size = ((buf->remove + size + FS_BUF_INC) / FS_BUF_INC) * FS_BUF_INC; - new = xrealloc (buf->buf, new_size); + new = realloc (buf->buf, new_size); if (!new) return FSIO_ERROR; buf->buf = new; @@ -329,7 +324,7 @@ _fs_downsize (FSBufPtr buf, long size) buf->insert = buf->remove = 0; if (buf->size > size) { - buf->buf = xrealloc (buf->buf, size); + buf->buf = realloc (buf->buf, size); buf->size = size; } } @@ -348,16 +343,16 @@ Bool _fs_io_init (FSFpePtr conn) { conn->outBuf.insert = conn->outBuf.remove = 0; - conn->outBuf.buf = xalloc (FS_BUF_INC); + conn->outBuf.buf = malloc (FS_BUF_INC); if (!conn->outBuf.buf) return FALSE; conn->outBuf.size = FS_BUF_INC; conn->inBuf.insert = conn->inBuf.remove = 0; - conn->inBuf.buf = xalloc (FS_BUF_INC); + conn->inBuf.buf = malloc (FS_BUF_INC); if (!conn->inBuf.buf) { - xfree (conn->outBuf.buf); + free (conn->outBuf.buf); conn->outBuf.buf = 0; return FALSE; } @@ -370,9 +365,9 @@ void _fs_io_fini (FSFpePtr conn) { if (conn->outBuf.buf) - xfree (conn->outBuf.buf); + free (conn->outBuf.buf); if (conn->inBuf.buf) - xfree (conn->inBuf.buf); + free (conn->inBuf.buf); } static int @@ -399,6 +394,8 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size) } } memcpy (conn->outBuf.buf + conn->outBuf.insert, data, len); + /* Clear pad data */ + memset (conn->outBuf.buf + conn->outBuf.insert + len, 0, size - len); conn->outBuf.insert += size; _fs_mark_block (conn, FS_PENDING_WRITE); return FSIO_READY; @@ -422,19 +419,6 @@ _fs_write_pad(FSFpePtr conn, char *data, long len) return _fs_do_write (conn, data, len, len + padlength[len & 3]); } -/* - * returns the amount of data waiting to be read - */ -int -_fs_data_ready(FSFpePtr conn) -{ - BytesReadable_t readable; - - if (_FontTransBytesReadable(conn->trans_conn, &readable) < 0) - return -1; - return readable; -} - int _fs_wait_for_readable(FSFpePtr conn, int ms) { @@ -467,50 +451,3 @@ _fs_wait_for_readable(FSFpePtr conn, int ms) return FSIO_ERROR; } } - -int -_fs_set_bit(fd_set *mask, int fd) -{ - FD_SET(fd, mask); - return fd; -} - -int -_fs_is_bit_set(fd_set *mask, int fd) -{ - return FD_ISSET(fd, mask); -} - -void -_fs_bit_clear(fd_set *mask, int fd) -{ - FD_CLR(fd, mask); -} - -int -_fs_any_bit_set(fd_set *mask) -{ - return XFD_ANYSET(mask); -} - -void -_fs_or_bits(fd_set *dst, fd_set *m1, fd_set *m2) -{ -#ifdef WIN32 - int i; - if (dst != m1) { - for (i = m1->fd_count; --i >= 0; ) { - if (!FD_ISSET(m1->fd_array[i], dst)) - FD_SET(m1->fd_array[i], dst); - } - } - if (dst != m2) { - for (i = m2->fd_count; --i >= 0; ) { - if (!FD_ISSET(m2->fd_array[i], dst)) - FD_SET(m2->fd_array[i], dst); - } - } -#else - XFD_ORSET(dst, m1, m2); -#endif -} |