Support This Project

Changeset 2038

Show
Ignore:
Timestamp:
11/13/08 16:50:40 (2 months ago)
Author:
virdiq
Message:

More conversions from int to fd_t for file descriptors.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libwzd-core/arch/win32.h

    r2011 r2038  
    114114 
    115115#define ftruncate(fd,pos)       win32_ftruncate((fd),(__int64)(pos)) 
    116 int win32_ftruncate(int fd, __int64 length); 
     116int win32_ftruncate(fd_t fd, __int64 length); 
    117117 
    118118#define readlink(path,buf,bufsiz)       (-1) 
  • trunk/libwzd-core/wzd_cache.c

    r2035 r2038  
    5454 
    5555 
     56#include "wzd_types.h" 
    5657#include "wzd_structs.h" 
    5758#include "wzd_fs.h" 
     
    7677 */ 
    7778struct wzd_internal_cache_t  { 
    78   int fd; 
     79  fd_t fd; 
    7980 
    8081  unsigned long filename_hash; 
     
    130131  size_t length; 
    131132  size_t size; 
    132   int fd; 
     133  fd_t fd; 
    133134 
    134135  if (!file) return NULL; 
     
    312313  wzd_cache_t * cache; 
    313314  wzd_internal_cache_t c2, c_old; 
    314   int fd; 
     315  fd_t fd; 
    315316 
    316317  if (!file) return NULL; 
     
    451452{ 
    452453  off_t position; 
    453   int fd; 
     454  fd_t fd; 
    454455  char buffer[4096], *ptr, *dst; 
    455456  char _c=0; 
  • trunk/libwzd-core/wzd_debug.c

    r1994 r2038  
    4646#include <sys/stat.h> 
    4747 
     48#include "wzd_types.h" 
    4849#include "wzd_structs.h" 
    4950#include "wzd_log.h" 
     
    6667struct wzd_fd { 
    6768  unsigned long sig; 
    68   int fd; 
     69  fd_t fd; 
    6970  char file[256]; 
    7071  unsigned int line; 
     
    7980#endif 
    8081 
    81 int fd_register(int fd, const char *desc, const char *file, unsigned int line, const char *function); 
    82 int fd_unregister(int fd, const char *desc, const char *file, unsigned int line, const char *function); 
     82int fd_register(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function); 
     83int fd_unregister(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function); 
    8384void fd_dump(void); 
    8485 
     
    180181#endif /* DEBUG */ 
    181182 
    182 int fd_register(int fd, const char *desc, const char *file, unsigned int line, const char *function) 
     183int fd_register(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function) 
    183184{ 
    184185#ifdef DEBUG 
     
    222223} 
    223224 
    224 int fd_unregister(int fd, const char *desc, const char *file, unsigned int line, const char *function) 
     225int fd_unregister(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function) 
    225226{ 
    226227#ifdef DEBUG 
  • trunk/libwzd-core/wzd_debug.h

    r1994 r2038  
    2525#ifndef __WZD_DEBUG__ 
    2626#define __WZD_DEBUG__ 
     27 
     28#include "wzd_types.h" 
    2729 
    2830#ifdef DEBUG 
     
    7476void wzd_debug_fini(void); 
    7577 
    76 int fd_register(int fd, const char *desc, const char *file, unsigned int line, const char *function); 
    77 int fd_unregister(int fd, const char *desc, const char *file, unsigned int line, const char *function); 
     78int fd_register(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function); 
     79int fd_unregister(fd_t fd, const char *desc, const char *file, unsigned int line, const char *function); 
    7880void fd_dump(void); 
    7981#ifdef DEBUG 
  • trunk/libwzd-core/wzd_log.c

    r1997 r2038  
    5757#include <fcntl.h> /* O_WRONLY */ 
    5858 
     59#include "wzd_types.h" 
    5960#include "wzd_structs.h" 
    6061#include "wzd_log.h" 
     
    7576 
    7677struct wzd_log_entry_t { 
    77   int fd; 
     78  fd_t fd; 
    7879  int syslog; 
    7980}; 
     
    105106int log_open(const char * filename, int filemode) 
    106107{ 
    107   int fd; 
     108  fd_t fd; 
    108109 
    109110  fd = open(filename, filemode, 0640); 
     
    114115} 
    115116 
    116 void log_close(int fd) 
     117void log_close(fd_t fd) 
    117118{ 
    118119#ifdef DEBUG 
     
    162163int log_open_old(const char *filename, int filemode) 
    163164{ 
    164   int fd; 
     165  fd_t fd; 
    165166 
    166167  fd = open(filename, filemode, 0640); 
     
    191192} 
    192193 
    193 int log_set(unsigned int level, int fd) 
     194int log_set(unsigned int level, fd_t fd) 
    194195{ 
    195196  unsigned int i, count; 
     
    413414int xferlog_open(const char *filename, unsigned int filemode) 
    414415{ 
    415   int fd; 
     416  fd_t fd; 
    416417#if (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(WIN32) || defined(__APPLE__) 
    417418  fd = open(filename,O_WRONLY | O_CREAT | O_APPEND, filemode); 
     
    422423} 
    423424 
    424 void xferlog_close(int fd) 
     425void xferlog_close(fd_t fd) 
    425426{ 
    426427  close(fd); 
  • trunk/libwzd-core/wzd_log.h

    r1994 r2038  
    2525#ifndef __WZD_LOG__ 
    2626#define __WZD_LOG__ 
     27 
     28#include "wzd_types.h" 
    2729 
    2830/* colors */ 
     
    6971/** \brief Close log file 
    7072 */ 
    71 void log_close(int fd); 
     73void log_close(fd_t fd); 
    7274 
    7375/** \brief Close all log descriptors 
     
    100102 * \note fd must have been returned from log_open() 
    101103 */ 
    102 int log_set(unsigned int level, int fd); 
     104int log_set(unsigned int level, fd_t fd); 
    103105 
    104106/** \brief Use syslog for specified level 
     
    114116/** \brief Close xferlog file opened using \ref xferlog_open 
    115117 */ 
    116 void xferlog_close(int fd); 
     118void xferlog_close(fd_t fd); 
    117119 
    118120/** \brief Send message to the server logger 
  • trunk/libwzd-core/wzd_misc.c

    r1994 r2038  
    9191 
    9292 
     93#include "wzd_types.h" 
    9394#include "wzd_structs.h" 
    9495 
     
    517518} 
    518519 
    519 time_t lget_file_ctime(int fd) 
     520time_t lget_file_ctime(fd_t fd) 
    520521{ 
    521522  fs_filestat_t s; 
     
    11301131 * which does not exist on all versions of the platform SDK. 
    11311132 */ 
    1132 int win32_ftruncate(int fd, __int64 length) 
     1133int win32_ftruncate(fd_t fd, __int64 length) 
    11331134{ 
    11341135  HANDLE handle = (HANDLE)_get_osfhandle(fd); 
  • trunk/libwzd-core/wzd_misc.h

    r1994 r2038  
    3535#endif 
    3636 
     37#include "wzd_types.h" 
    3738#include "wzd_mutex.h" 
    3839 
     
    7879/* get file last change time */ 
    7980time_t get_file_ctime(const char *file); 
    80 time_t lget_file_ctime(int fd); 
     81time_t lget_file_ctime(fd_t fd); 
    8182 
    8283/* renames file/dir, if on different fs then moves recursively */ 
  • trunk/modules/perl/libwzd_perl.c

    r2026 r2038  
    6868#include <XSUB.h> 
    6969 
     70#include <libwzd-core/wzd_types.h> 
    7071#include <libwzd-core/wzd_structs.h> 
    7172#include <libwzd-core/wzd_log.h> 
     
    172173    } 
    173174    if (logdir) { 
    174       int fd; 
     175      fd_t fd; 
    175176      const char * filename; 
    176177 
  • trunk/modules/sfv/libwzd_sfv_sfv.c

    r1994 r2038  
    4545#include <errno.h> 
    4646 
     47#include <libwzd-core/wzd_types.h> 
    4748#include <libwzd-core/wzd_structs.h> 
    4849#include <libwzd-core/wzd_log.h> 
     
    112113  double size_total=0; 
    113114  struct stat s; 
    114   int fd; 
     115  fd_t fd; 
    115116  int i; 
    116117 
  • trunk/modules/sfv/libwzd_sfv_site.c

    r1994 r2038  
    5050 
    5151/*#include "wzd.h"*/ 
     52#include <libwzd-core/wzd_types.h> 
    5253#include <libwzd-core/wzd_structs.h> 
    5354#include <libwzd-core/wzd_log.h> 
     
    180181  { 
    181182    char buffer[2048]; 
    182     int fd_sfv; 
     183    fd_t fd_sfv; 
    183184    fd_sfv = open(sfv_file,O_CREAT | O_WRONLY | O_TRUNC,0644); 
    184185 
  • trunk/modules/tcl/libwzd_tcl.c

    r1994 r2038  
    6767 
    6868/*#include <wzd.h>*/ 
     69#include <libwzd-core/wzd_types.h> 
    6970#include <libwzd-core/wzd_structs.h> 
    7071#include <libwzd-core/wzd_log.h> 
     
    214215    } 
    215216    if (logdir) { 
    216       int fd; 
     217      fd_t fd; 
    217218 
    218219      wzd_string_t *str = str_allocate(); 
  • trunk/modules/zeroconf/libwzd_bonjour.c

    r1660 r2038  
    3131#ifdef USE_BONJOUR 
    3232 
     33#include <libwzd-core/wzd_types.h> 
    3334#include "libwzd_bonjour.h" 
    3435 
     
    158159int bo_zeroconf_run(void) { 
    159160  fd_set set; 
    160   int fd; 
     161  fd_t fd; 
    161162  struct timeval timeout; 
    162163 
  • trunk/tests/test_wzd_log.c

    r2008 r2038  
    55#include <fcntl.h> /* O_RDONLY */ 
    66 
     7#include <libwzd-core/wzd_types.h> 
    78#include <libwzd-core/wzd_structs.h> 
    89#include <libwzd-core/wzd_log.h> 
     
    1819  int ret; 
    1920  char template[] = "/tmp/wzd-XXXXXX"; 
    20   int fd; 
     21  fd_t fd; 
    2122  unsigned long c2 = C2; 
    2223 
  • trunk/wzdftpd/wzd_ServerThread.c

    r2032 r2038  
    10311031int server_switch_to_config(wzd_config_t *config) 
    10321032{ 
    1033   int fd; 
     1033  fd_t fd; 
    10341034  int ret; 
    10351035  int err; 
     
    15031503     * to create child process with a pipe (dup2 fails with error EBADF) 
    15041504     */ 
    1505     int fd = open("/dev/null",O_RDWR); 
     1505    fd_t fd = open("/dev/null",O_RDWR); 
    15061506    dup2(fd,0); 
    15071507    dup2(fd,1);