summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/estream.c6
-rw-r--r--src/gpg-error.def.in4
-rw-r--r--src/gpg-error.h.in17
-rw-r--r--src/gpg-error.vers4
-rw-r--r--src/gpgrt-int.h4
-rw-r--r--src/visibility.c8
-rw-r--r--src/visibility.h8
7 files changed, 30 insertions, 21 deletions
diff --git a/src/estream.c b/src/estream.c
index a17950e..42609ee 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -3471,7 +3471,7 @@ _gpgrt_syshd (estream_t stream, es_syshd_t *syshd)
int
-_gpgrt_pending_unlocked (estream_t stream)
+_gpgrt__pending_unlocked (estream_t stream)
{
return check_pending (stream);
}
@@ -3486,12 +3486,12 @@ _gpgrt_pending_unlocked (estream_t stream)
are pending the function is expected to return -1 in this case and
thus deviates from the standard behavior of read(2). */
int
-_gpgrt_pending (estream_t stream)
+_gpgrt__pending (estream_t stream)
{
int ret;
lock_stream (stream);
- ret = _gpgrt_pending_unlocked (stream);
+ ret = _gpgrt__pending_unlocked (stream);
unlock_stream (stream);
return ret;
diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in
index f17522e..cba973d 100644
--- a/src/gpg-error.def.in
+++ b/src/gpg-error.def.in
@@ -137,7 +137,7 @@ EXPORTS
gpg_err_deinit @102
gpgrt_set_alloc_func @103
- gpgrt_pending @104
- gpgrt_pending_unlocked @105
+ _gpgrt_pending @104
+ _gpgrt_pending_unlocked @105
;; end of file with public symbols for Windows.
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 6ac6e0a..7099b43 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -496,8 +496,17 @@ int gpgrt_ferror (gpgrt_stream_t stream);
int gpgrt_ferror_unlocked (gpgrt_stream_t stream);
void gpgrt_clearerr (gpgrt_stream_t stream);
void gpgrt_clearerr_unlocked (gpgrt_stream_t stream);
-int gpgrt_pending (gpgrt_stream_t stream);
-int gpgrt_pending_unlocked (gpgrt_stream_t stream);
+
+int _gpgrt_pending (gpgrt_stream_t stream); /* (private) */
+int _gpgrt_pending_unlocked (gpgrt_stream_t stream); /* (private) */
+
+#define gpgrt_pending(stream) _gpgrt_pending (stream)
+
+#define gpgrt_pending_unlocked(stream) \
+ (((!(stream)->flags.writing) \
+ && (((stream)->data_offset < (stream)->data_len) \
+ || ((stream)->unread_data_len))) \
+ ? 1 : _gpgrt_pending_unlocked ((stream)))
int gpgrt_fflush (gpgrt_stream_t stream);
int gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence);
@@ -509,8 +518,8 @@ void gpgrt_rewind (gpgrt_stream_t stream);
int gpgrt_fgetc (gpgrt_stream_t stream);
int gpgrt_fputc (int c, gpgrt_stream_t stream);
-int _gpgrt_getc_underflow (gpgrt_stream_t stream);
-int _gpgrt_putc_overflow (int c, gpgrt_stream_t stream);
+int _gpgrt_getc_underflow (gpgrt_stream_t stream); /* (private) */
+int _gpgrt_putc_overflow (int c, gpgrt_stream_t stream); /* (private) */
#define gpgrt_getc_unlocked(stream) \
(((!(stream)->flags.writing) \
diff --git a/src/gpg-error.vers b/src/gpg-error.vers
index c0e599a..758e549 100644
--- a/src/gpg-error.vers
+++ b/src/gpg-error.vers
@@ -64,8 +64,8 @@ GPG_ERROR_1.0 {
gpgrt_flockfile;
gpgrt_ftrylockfile;
gpgrt_funlockfile;
- gpgrt_pending;
- gpgrt_pending_unlocked;
+ _gpgrt_pending;
+ _gpgrt_pending_unlocked;
gpgrt_feof;
gpgrt_feof_unlocked;
gpgrt_ferror;
diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h
index 8907835..bc2db8b 100644
--- a/src/gpgrt-int.h
+++ b/src/gpgrt-int.h
@@ -102,8 +102,8 @@ int _gpgrt_ferror (gpgrt_stream_t stream);
int _gpgrt_ferror_unlocked (gpgrt_stream_t stream);
void _gpgrt_clearerr (gpgrt_stream_t stream);
void _gpgrt_clearerr_unlocked (gpgrt_stream_t stream);
-int _gpgrt_pending (gpgrt_stream_t stream);
-int _gpgrt_pending_unlocked (gpgrt_stream_t stream);
+int _gpgrt__pending (gpgrt_stream_t stream);
+int _gpgrt__pending_unlocked (gpgrt_stream_t stream);
int _gpgrt_fflush (gpgrt_stream_t stream);
int _gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence);
diff --git a/src/visibility.c b/src/visibility.c
index f26f58c..9213ce9 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -298,15 +298,15 @@ gpgrt_funlockfile (estream_t stream)
}
int
-gpgrt_pending (estream_t stream)
+_gpgrt_pending (estream_t stream)
{
- return _gpgrt_pending (stream);
+ return _gpgrt__pending (stream);
}
int
-gpgrt_pending_unlocked (estream_t stream)
+_gpgrt_pending_unlocked (estream_t stream)
{
- return _gpgrt_pending_unlocked (stream);
+ return _gpgrt__pending_unlocked (stream);
}
int
diff --git a/src/visibility.h b/src/visibility.h
index 35878d7..6f7de84 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -87,8 +87,8 @@ MARK_VISIBLE (_gpgrt_get_std_stream)
MARK_VISIBLE (gpgrt_flockfile)
MARK_VISIBLE (gpgrt_ftrylockfile)
MARK_VISIBLE (gpgrt_funlockfile)
-MARK_VISIBLE (gpgrt_pending)
-MARK_VISIBLE (gpgrt_pending_unlocked)
+MARK_VISIBLE (_gpgrt_pending)
+MARK_VISIBLE (_gpgrt_pending_unlocked)
MARK_VISIBLE (gpgrt_feof)
MARK_VISIBLE (gpgrt_feof_unlocked)
MARK_VISIBLE (gpgrt_ferror)
@@ -192,8 +192,8 @@ MARK_VISIBLE (gpgrt_set_alloc_func)
#define gpgrt_flockfile _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_ftrylockfile _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_funlockfile _gpgrt_USE_UNDERSCORED_FUNCTION
-#define gpgrt_pending _gpgrt_USE_UNDERSCORED_FUNCTION
-#define gpgrt_pending_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION
+#define _gpgrt_pending _gpgrt_USE_UNDERSCORED_FUNCTION
+#define _gpgrt_pending_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_feof _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_feof_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_ferror _gpgrt_USE_UNDERSCORED_FUNCTION