~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to common/estream.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-03-08 22:46:47 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090308224647-gq17gatcl71lrc2k
Tags: 2.0.11-1
* New upstream release. (Closes: #496663)
* debian/control: Make the description a little more distinctive than
  gnupg v1's. Thanks Jari Aalto. (Closes: #496323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
#else
116
116
 
117
117
typedef void *estream_mutex_t;
 
118
 
 
119
static inline void
 
120
dummy_mutex_call_void (estream_mutex_t mutex)
 
121
{
 
122
  (void)mutex;
 
123
}
 
124
 
 
125
static inline int
 
126
dummy_mutex_call_int (estream_mutex_t mutex)
 
127
{
 
128
  (void)mutex;
 
129
  return 0;
 
130
}
 
131
 
118
132
# define ESTREAM_MUTEX_INITIALIZER NULL
119
 
# define ESTREAM_MUTEX_LOCK(mutex) (void) 0
120
 
# define ESTREAM_MUTEX_UNLOCK(mutex) (void) 0
121
 
# define ESTREAM_MUTEX_TRYLOCK(mutex) 0
122
 
# define ESTREAM_MUTEX_INITIALIZE(mutex) (void) 0
 
133
# define ESTREAM_MUTEX_LOCK(mutex) dummy_mutex_call_void ((mutex))
 
134
# define ESTREAM_MUTEX_UNLOCK(mutex) dummy_mutex_call_void ((mutex))
 
135
# define ESTREAM_MUTEX_TRYLOCK(mutex) dummy_mutex_call_int ((mutex))
 
136
# define ESTREAM_MUTEX_INITIALIZE(mutex) dummy_mutex_call_void ((mutex))
123
137
#endif
124
138
 
125
139
/* Primitive system I/O.  */
184
198
};
185
199
 
186
200
static estream_list_t estream_list;
187
 
#ifdef HAVE_PTH
188
 
/* Note that we can't use a static initialization with W32Pth, thus we
189
 
   do it in es_init. */
190
201
static estream_mutex_t estream_list_lock;
191
 
#endif
192
202
 
193
203
#define ESTREAM_LIST_LOCK   ESTREAM_MUTEX_LOCK   (estream_list_lock)
194
204
#define ESTREAM_LIST_UNLOCK ESTREAM_MUTEX_UNLOCK (estream_list_lock)
621
631
      /* Make sure it is in binary mode if requested.  */
622
632
      if ( (modeflags & O_BINARY) )
623
633
        setmode (fd, O_BINARY);
 
634
#else
 
635
      (void)modeflags;
624
636
#endif
625
637
      fd_cookie->fd = fd;
626
638
      fd_cookie->no_close = no_close;
722
734
 
723
735
/* Create function for fd objects.  */
724
736
static int
725
 
es_func_fp_create (void **cookie, FILE *fp, unsigned int modeflags, int no_close)
 
737
es_func_fp_create (void **cookie, FILE *fp, 
 
738
                   unsigned int modeflags, int no_close)
726
739
{
727
740
  estream_cookie_fp_t fp_cookie;
728
741
  int err;
736
749
      /* Make sure it is in binary mode if requested.  */
737
750
      if ( (modeflags & O_BINARY) )
738
751
        setmode (fileno (fp), O_BINARY);
 
752
#else
 
753
      (void)modeflags;
739
754
#endif
740
755
      fp_cookie->fp = fp;
741
756
      fp_cookie->no_close = no_close;
3075
3090
  for (; length; length--, p++, count++)
3076
3091
    {
3077
3092
      if (*p < 0x20 
3078
 
          || (*p >= 0x7f && *p < 0xa0)
 
3093
          || *p == 0x7f
3079
3094
          || (delimiters 
3080
3095
              && (strchr (delimiters, *p) || *p == '\\')))
3081
3096
        {
3146
3161
  const unsigned char *s;
3147
3162
  size_t count = 0;
3148
3163
 
 
3164
  (void)reserved;
 
3165
 
3149
3166
#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
3150
3167
 
3151
3168
  if (!length)