~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/azio.cc

  • Committer: Tim Penhey
  • Date: 2010-01-20 02:39:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1275.
  • Revision ID: tim.penhey@canonical.com-20100120023901-8teeunid6gwlthzx
Add in a rot 13 function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <cstdlib>
24
24
#include <cassert>
25
25
 
26
 
using namespace drizzled;
27
 
 
28
26
static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
29
27
 
30
28
static unsigned int azwrite(azio_stream *s, void *buf, unsigned int len);
52
50
  size_t offset;
53
51
  azio_stream *s= (azio_stream *)p;
54
52
 
55
 
  internal::my_thread_init();
 
53
  my_thread_init();
56
54
 
57
55
  while (1)
58
56
  {
77
75
    pthread_mutex_unlock(&s->container.thresh_mutex);
78
76
  }
79
77
 
80
 
  internal::my_thread_end();
 
78
  my_thread_end();
81
79
 
82
80
  return 0;
83
81
}
229
227
  s->stream.avail_out = AZ_BUFSIZE_WRITE;
230
228
 
231
229
  errno = 0;
232
 
  s->file = fd < 0 ? internal::my_open(path, Flags, MYF(0)) : fd;
 
230
  s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
233
231
#ifdef AZIO_AIO
234
232
  s->container.fd= s->file;
235
233
#endif
441
439
    if (s->mode == 'w')
442
440
    {
443
441
      err = deflateEnd(&(s->stream));
444
 
      internal::my_sync(s->file, MYF(0));
 
442
      my_sync(s->file, MYF(0));
445
443
    }
446
444
    else if (s->mode == 'r')
447
445
      err = inflateEnd(&(s->stream));
449
447
 
450
448
  do_aio_cleanup(s);
451
449
 
452
 
  if (s->file > 0 && internal::my_close(s->file, MYF(0)))
 
450
  if (s->file > 0 && my_close(s->file, MYF(0)))
453
451
      err = Z_ERRNO;
454
452
 
455
453
  s->file= -1;
758
756
    err= do_flush(s, flush);
759
757
 
760
758
    if (err) return err;
761
 
    internal::my_sync(s->file, MYF(0));
 
759
    my_sync(s->file, MYF(0));
762
760
    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
763
761
  }
764
762
}