~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/azio.cc

  • Committer: Super-User
  • Date: 2008-11-23 01:08:08 UTC
  • mto: This revision was merged to the branch mainline in revision 602.
  • Revision ID: root@bitters-20081123010808-7cenki9nrcjjdz4d
Fixed solaris build crap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <stdio.h>
17
17
#include <string.h>
 
18
#include <stdlib.h>
18
19
#include <assert.h>
19
20
#include <unistd.h>
20
21
 
36
37
static void do_aio_cleanup(azio_stream *s);
37
38
#endif
38
39
 
 
40
extern "C"
39
41
static pthread_handler_t run_task(void *p)
40
42
{
41
43
  int fd;
54
56
    }
55
57
    offset= s->container.offset;
56
58
    fd= s->container.fd;
57
 
    buffer= s->container.buffer;
 
59
    buffer= (char *)s->container.buffer;
58
60
    pthread_mutex_unlock(&s->container.thresh_mutex);
59
61
 
60
62
    if (s->container.ready == AZ_THREAD_DEAD)
80
82
  pthread_mutex_unlock(&s->container.thresh_mutex);
81
83
 
82
84
  pthread_cond_signal(&s->container.threshhold);
83
 
  pthread_join(s->container.mainthread, (void *)NULL);
 
85
  pthread_join(s->container.mainthread, NULL);
84
86
}
85
87
 
86
88
static size_t azio_return(azio_stream *s)
325
327
  for end of file.
326
328
  IN assertion: the stream s has been sucessfully opened for reading.
327
329
*/
328
 
int get_byte(s)
329
 
  azio_stream *s;
 
330
int get_byte(azio_stream *s)
330
331
{
331
332
  if (s->z_eof) return EOF;
332
333
  if (s->stream.avail_in == 0) 
424
425
 * Cleanup then free the given azio_stream. Return a zlib error code.
425
426
 Try freeing in the reverse order of allocations.
426
427
 */
427
 
int destroy (s)
428
 
  azio_stream *s;
 
428
int destroy (azio_stream *s)
429
429
{
430
430
  int err = Z_OK;
431
431
 
721
721
  s->method= AZ_METHOD_BLOCK;
722
722
}
723
723
 
724
 
int ZEXPORT azflush (s, flush)
725
 
  azio_stream *s;
726
 
  int flush;
 
724
int ZEXPORT azflush (azio_stream *s,int flush)
727
725
{
728
726
  int err;
729
727
 
779
777
/* ===========================================================================
780
778
  Rewinds input file.
781
779
*/
782
 
int azrewind (s)
783
 
  azio_stream *s;
 
780
int azrewind (azio_stream *s)
784
781
{
785
782
  if (s == NULL || s->mode != 'r') return -1;
786
783
 
809
806
  SEEK_END is not implemented, returns error.
810
807
  In this version of the library, azseek can be extremely slow.
811
808
*/
812
 
size_t azseek (s, offset, whence)
813
 
  azio_stream *s;
814
 
  size_t offset;
815
 
  int whence;
 
809
size_t azseek (azio_stream *s, size_t offset, int whence)
816
810
{
817
811
 
818
812
  if (s == NULL || whence == SEEK_END ||
877
871
  given compressed file. This position represents a number of bytes in the
878
872
  uncompressed data stream.
879
873
*/
880
 
size_t ZEXPORT aztell (file)
881
 
  azio_stream *file;
 
874
size_t ZEXPORT aztell (azio_stream *file)
882
875
{
883
876
  return azseek(file, 0L, SEEK_CUR);
884
877
}