delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/23/10:58:30

Date: Thu, 23 Jan 2003 15:26:33 +0000
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: ssize_t: int -> long, revision 2 [PATCH]
Message-Id: <E18bjDt-0000Ua-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Here's revision 2 of the patch to make ssize_t a signed long int,
rather than an int. The only change of the previous patch
is to make the _cnt member of FILE a ssize_t instead of a long.
No extra code changes were needed.

Here's a changelog entry:

@tindex
@code{ssize_t} was changed from an @code{int} to a @code{signed long int}.
@code{ssize_t} is now really a signed version of @code{size_t}.

OK to commit?

Thanks, bye, Rich =]

Index: include/sys/djtypes.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/djtypes.h,v
retrieving revision 1.11
diff -p -c -3 -r1.11 djtypes.h
*** include/sys/djtypes.h	10 Jun 2002 00:01:30 -0000	1.11
--- include/sys/djtypes.h	23 Jan 2003 15:21:38 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
***************
*** 13,19 ****
  #define __DJ_offset_t	typedef long long offset_t;
  #define __DJ_pid_t	typedef int pid_t;
  #define __DJ_size_t	typedef long unsigned int size_t;
! #define __DJ_ssize_t	typedef int ssize_t;
  #define __DJ_time_t	typedef unsigned int time_t;
  #define __DJ_uid_t	typedef int uid_t;
  
--- 14,20 ----
  #define __DJ_offset_t	typedef long long offset_t;
  #define __DJ_pid_t	typedef int pid_t;
  #define __DJ_size_t	typedef long unsigned int size_t;
! #define __DJ_ssize_t	typedef long signed int ssize_t;
  #define __DJ_time_t	typedef unsigned int time_t;
  #define __DJ_uid_t	typedef int uid_t;
  
Index: include/stdio.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdio.h,v
retrieving revision 1.8
diff -p -c -3 -r1.8 stdio.h
*** include/stdio.h	17 Oct 2002 23:00:24 -0000	1.8
--- include/stdio.h	23 Jan 2003 15:21:38 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
*************** __DJ_size_t
*** 45,63 ****
  #define _SIZE_T
  #endif
  
  /* Note that the definitions of these fields are NOT guaranteed!  They
     may change with any release without notice!  The fact that they
     are here at all is to comply with ANSI specifictions. */
     
  typedef struct {
!   int     _cnt;
!   char   *_ptr;
!   char   *_base;
!   size_t  _bufsiz;
!   int     _flag;
!   int     _file;
!   char   *_name_to_remove;
!   size_t  _fillsize;
  } FILE;
  
  typedef unsigned long		fpos_t;
--- 46,69 ----
  #define _SIZE_T
  #endif
  
+ #ifndef _SSIZE_T
+ __DJ_ssize_t
+ #define _SSIZE_T
+ #endif
+ 
  /* Note that the definitions of these fields are NOT guaranteed!  They
     may change with any release without notice!  The fact that they
     are here at all is to comply with ANSI specifictions. */
     
  typedef struct {
!   ssize_t  _cnt;
!   char    *_ptr;
!   char    *_base;
!   size_t   _bufsiz;
!   int      _flag;
!   int      _file;
!   char    *_name_to_remove;
!   size_t   _fillsize;
  } FILE;
  
  typedef unsigned long		fpos_t;
Index: src/libc/ansi/stdio/fflush.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fflush.c,v
retrieving revision 1.10
diff -p -c -3 -r1.10 fflush.c
*** src/libc/ansi/stdio/fflush.c	17 Oct 2002 23:00:24 -0000	1.10
--- src/libc/ansi/stdio/fflush.c	23 Jan 2003 15:21:45 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
*************** int
*** 18,24 ****
  fflush(FILE *f)
  {
    char *base;
!   int n;
    size_t rn;
  
    if (f == NULL)
--- 19,25 ----
  fflush(FILE *f)
  {
    char *base;
!   ssize_t n;
    size_t rn;
  
    if (f == NULL)
Index: src/libc/ansi/stdio/flsbuf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/flsbuf.c,v
retrieving revision 1.10
diff -p -c -3 -r1.10 flsbuf.c
*** src/libc/ansi/stdio/flsbuf.c	20 Jun 2001 17:57:26 -0000	1.10
--- src/libc/ansi/stdio/flsbuf.c	23 Jan 2003 15:21:45 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
*************** int
*** 17,23 ****
  _flsbuf(int c, FILE *f)
  {
    char *base;
!   int n;
    size_t rn;
    char c1;
    size_t size;
--- 18,24 ----
  _flsbuf(int c, FILE *f)
  {
    char *base;
!   ssize_t n;
    size_t rn;
    char c1;
    size_t size;
Index: src/libc/dos/io/_read.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_read.c,v
retrieving revision 1.2
diff -p -c -3 -r1.2 _read.c
*** src/libc/dos/io/_read.c	14 Jun 2002 14:25:44 -0000	1.2
--- src/libc/dos/io/_read.c	23 Jan 2003 15:21:51 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  #include <libc/stubs.h>
***************
*** 12,18 ****
  #include <libc/fsexthlp.h>
  #include <libc/dosio.h>
  
! int
  _read(int handle, void* buffer, size_t count)
  {
    size_t j, k;
--- 13,19 ----
  #include <libc/fsexthlp.h>
  #include <libc/dosio.h>
  
! ssize_t
  _read(int handle, void* buffer, size_t count)
  {
    size_t j, k;
Index: src/libc/dos/io/_write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_write.c,v
retrieving revision 1.8
diff -p -c -3 -r1.8 _write.c
*** src/libc/dos/io/_write.c	14 Jun 2002 14:25:53 -0000	1.8
--- src/libc/dos/io/_write.c	23 Jan 2003 15:21:51 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
***************
*** 16,22 ****
  #include <libc/farptrgs.h>
  #include <libc/getdinfo.h>
  
! int
  _write(int handle, const void* buffer, size_t count)
  {
    __FSEXT_Function *func = __FSEXT_get_function(handle);
--- 17,23 ----
  #include <libc/farptrgs.h>
  #include <libc/getdinfo.h>
  
! ssize_t
  _write(int handle, const void* buffer, size_t count)
  {
    __FSEXT_Function *func = __FSEXT_get_function(handle);
Index: src/libc/posix/termios/readhook.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/readhook.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 readhook.c
*** src/libc/posix/termios/readhook.c	21 Dec 2002 22:36:44 -0000	1.1
--- src/libc/posix/termios/readhook.c	23 Jan 2003 15:21:59 -0000
***************
*** 1,5 ****
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  #include <libc/ttyprvt.h>
  
! int (*__libc_read_termios_hook)(int handle, void *buffer, size_t count,
! 				ssize_t *rv) = NULL;
--- 1,6 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  #include <libc/ttyprvt.h>
  
! ssize_t (*__libc_read_termios_hook)(int handle, void *buffer, size_t count,
! 				    ssize_t *rv) = NULL;
Index: src/libc/posix/termios/writhook.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/writhook.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 writhook.c
*** src/libc/posix/termios/writhook.c	21 Dec 2002 22:36:44 -0000	1.1
--- src/libc/posix/termios/writhook.c	23 Jan 2003 15:21:59 -0000
***************
*** 1,5 ****
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  #include <libc/ttyprvt.h>
  
! int (*__libc_write_termios_hook)(int handle, const void *buffer, size_t count,
! 				 ssize_t *rv) = NULL;
--- 1,6 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  #include <libc/ttyprvt.h>
  
! ssize_t (*__libc_write_termios_hook)(int handle, const void *buffer,
! 				     size_t count, ssize_t *rv) = NULL;
Index: src/libc/posix/unistd/write.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/write.c,v
retrieving revision 1.9
diff -p -c -3 -r1.9 write.c
*** src/libc/posix/unistd/write.c	21 Dec 2002 22:38:18 -0000	1.9
--- src/libc/posix/unistd/write.c	23 Jan 2003 15:22:03 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
*************** write(int handle, const void* buffer, si
*** 27,39 ****
    size_t bytes_in_tb = 0;
    size_t offset_into_buf = 0;
    int out;
!   ssize_t rv;
    __FSEXT_Function *func = __FSEXT_get_function(handle);
  
    /* termios special hook */
    if (__libc_write_termios_hook != NULL)
!       if (__libc_write_termios_hook(handle, buffer, count, &rv) != 0)
!         return rv;
  
    if (count == 0)
      return 0; /* POSIX.1 requires this */
--- 28,41 ----
    size_t bytes_in_tb = 0;
    size_t offset_into_buf = 0;
    int out;
!   ssize_t ss_rv;
!   int i_rv;
    __FSEXT_Function *func = __FSEXT_get_function(handle);
  
    /* termios special hook */
    if (__libc_write_termios_hook != NULL)
!       if (__libc_write_termios_hook(handle, buffer, count, &ss_rv) != 0)
!         return ss_rv;
  
    if (count == 0)
      return 0; /* POSIX.1 requires this */
*************** write(int handle, const void* buffer, si
*** 54,61 ****
    /* Let's handle FSEXT_write ! */
    /* if handler is installed, call extension and exit if handled. */
    if(func &&				
!      __FSEXT_func_wrapper(func, __FSEXT_write, &rv, handle, buffer, count))
!       return rv;
  
    if (__has_fd_properties(handle)
        && (__fd_properties[handle]->flags & FILE_DESC_ZERO_FILL_EOF_GAP))
--- 56,63 ----
    /* Let's handle FSEXT_write ! */
    /* if handler is installed, call extension and exit if handled. */
    if(func &&				
!      __FSEXT_func_wrapper(func, __FSEXT_write, &i_rv, handle, buffer, count))
!       return i_rv;
  
    if (__has_fd_properties(handle)
        && (__fd_properties[handle]->flags & FILE_DESC_ZERO_FILL_EOF_GAP))

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019