diff options
| author | Jim Meyering | 2011-04-10 16:00:13 +0200 |
|---|---|---|
| committer | Jim Meyering | 2011-04-10 16:00:13 +0200 |
| commit | 368f40905f551ebaead782b3bb23140661600ae0 (patch) | |
| tree | 5e03cbb2800c27c16edbd881af8fd02cea707d44 /src | |
| parent | a32d40405d31edd2ce4349b95277306554fb54a4 (diff) | |
| download | emacs-368f40905f551ebaead782b3bb23140661600ae0.tar.gz emacs-368f40905f551ebaead782b3bb23140661600ae0.zip | |
use ssize_t and size_t for read- and write-like emacs_gnutls_* functions
* gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like:
return ssize_t not "int", and use size_t as the buffer length.
(emacs_gnutls_write): Likewise, and make the buffer pointer "const".
* gnutls.h: Update declarations.
* process.c (read_process_output): Use ssize_t, to match.
(send_process): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/gnutls.c | 15 | ||||
| -rw-r--r-- | src/gnutls.h | 12 | ||||
| -rw-r--r-- | src/process.c | 4 |
4 files changed, 26 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a1a5abe87c3..3eaf1e326b5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-04-10 Jim Meyering <meyering@redhat.com> | ||
| 2 | |||
| 3 | use ssize_t and size_t for read- and write-like emacs_gnutls_* functions | ||
| 4 | * gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like: | ||
| 5 | return ssize_t not "int", and use size_t as the buffer length. | ||
| 6 | (emacs_gnutls_write): Likewise, and make the buffer pointer "const". | ||
| 7 | * gnutls.h: Update declarations. | ||
| 8 | * process.c (read_process_output): Use ssize_t, to match. | ||
| 9 | (send_process): Likewise. | ||
| 10 | |||
| 1 | 2011-04-09 Chong Yidong <cyd@stupidchicken.com> | 11 | 2011-04-09 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 12 | ||
| 3 | * image.c (Fimagemagick_types): Doc fix, and comment cleanup. | 13 | * image.c (Fimagemagick_types): Doc fix, and comment cleanup. |
diff --git a/src/gnutls.c b/src/gnutls.c index 3a461891e2e..d9e4dcec15a 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -70,11 +70,12 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) | |||
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | int | 73 | ssize_t |
| 74 | emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, | 74 | emacs_gnutls_write (int fildes, struct Lisp_Process *proc, const char *buf, |
| 75 | unsigned int nbyte) | 75 | size_t nbyte) |
| 76 | { | 76 | { |
| 77 | register int rtnval, bytes_written; | 77 | ssize_t rtnval; |
| 78 | size_t bytes_written; | ||
| 78 | gnutls_session_t state = proc->gnutls_state; | 79 | gnutls_session_t state = proc->gnutls_state; |
| 79 | 80 | ||
| 80 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { | 81 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { |
| @@ -109,11 +110,11 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, | |||
| 109 | return (bytes_written); | 110 | return (bytes_written); |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | int | 113 | ssize_t |
| 113 | emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, | 114 | emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, |
| 114 | unsigned int nbyte) | 115 | size_t nbyte) |
| 115 | { | 116 | { |
| 116 | register int rtnval; | 117 | ssize_t rtnval; |
| 117 | gnutls_session_t state = proc->gnutls_state; | 118 | gnutls_session_t state = proc->gnutls_state; |
| 118 | 119 | ||
| 119 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) | 120 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) |
diff --git a/src/gnutls.h b/src/gnutls.h index 43a9eefce1b..b39131b6236 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -50,15 +50,15 @@ typedef enum | |||
| 50 | 50 | ||
| 51 | #define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } | 51 | #define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } |
| 52 | 52 | ||
| 53 | int | 53 | ssize_t |
| 54 | emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, | 54 | emacs_gnutls_write (int fildes, struct Lisp_Process *proc, const char *buf, |
| 55 | unsigned int nbyte); | 55 | size_t nbyte); |
| 56 | int | 56 | ssize_t |
| 57 | emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, | 57 | emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, |
| 58 | unsigned int nbyte); | 58 | size_t nbyte); |
| 59 | 59 | ||
| 60 | extern void syms_of_gnutls (void); | 60 | extern void syms_of_gnutls (void); |
| 61 | 61 | ||
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #endif | 64 | #endif |
diff --git a/src/process.c b/src/process.c index 6cddbf6d1a9..624610069d8 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4898,7 +4898,7 @@ read_process_output_error_handler (Lisp_Object error_val) | |||
| 4898 | static int | 4898 | static int |
| 4899 | read_process_output (Lisp_Object proc, register int channel) | 4899 | read_process_output (Lisp_Object proc, register int channel) |
| 4900 | { | 4900 | { |
| 4901 | register int nbytes; | 4901 | register ssize_t nbytes; |
| 4902 | char *chars; | 4902 | char *chars; |
| 4903 | register Lisp_Object outstream; | 4903 | register Lisp_Object outstream; |
| 4904 | register struct Lisp_Process *p = XPROCESS (proc); | 4904 | register struct Lisp_Process *p = XPROCESS (proc); |
| @@ -5243,7 +5243,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, | |||
| 5243 | { | 5243 | { |
| 5244 | /* Use volatile to protect variables from being clobbered by longjmp. */ | 5244 | /* Use volatile to protect variables from being clobbered by longjmp. */ |
| 5245 | struct Lisp_Process *p = XPROCESS (proc); | 5245 | struct Lisp_Process *p = XPROCESS (proc); |
| 5246 | EMACS_INT rv; | 5246 | ssize_t rv; |
| 5247 | struct coding_system *coding; | 5247 | struct coding_system *coding; |
| 5248 | struct gcpro gcpro1; | 5248 | struct gcpro gcpro1; |
| 5249 | void (*volatile old_sigpipe) (int); | 5249 | void (*volatile old_sigpipe) (int); |