~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/page/page0zip.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2011-01-22 03:22:44 UTC
  • mfrom: (2101 staging)
  • mto: (2228.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2230.
  • Revision ID: barry.leslie@primebase.com-20110122032244-ukbe3mlj7fs8xph6
Merged with lp:drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 2005, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
651
651
 
652
652
/**********************************************************************//**
653
653
Allocate memory for zlib. */
654
 
static
655
 
void*
656
 
page_zip_malloc(
 
654
extern "C" void* page_zip_malloc(void* opaque, uInt items, uInt size);
 
655
 
 
656
extern "C" void* page_zip_malloc
 
657
(
657
658
/*============*/
658
659
        void*   opaque, /*!< in/out: memory heap */
659
660
        uInt    items,  /*!< in: number of items to allocate */
660
661
        uInt    size)   /*!< in: size of an item in bytes */
661
662
{
662
 
        return(mem_heap_alloc(opaque, items * size));
 
663
        return(mem_heap_alloc(static_cast<mem_block_info_t *>(opaque), items * size));
663
664
}
664
665
 
665
666
/**********************************************************************//**
666
667
Deallocate memory for zlib. */
667
 
static
668
 
void
669
 
page_zip_free(
670
 
/*==========*/
671
 
        void*   opaque __attribute__((unused)), /*!< in: memory heap */
672
 
        void*   address __attribute__((unused)))/*!< in: object to free */
673
 
{
674
 
}
 
668
extern "C" void page_zip_free(void *opaque, void *address);
 
669
 
 
670
extern "C" void page_zip_free(void *, void *)
 
671
{ }
675
672
 
676
673
/**********************************************************************//**
677
674
Configure the zlib allocator to use the given memory heap. */
682
679
        void*           stream,         /*!< in/out: zlib stream */
683
680
        mem_heap_t*     heap)           /*!< in: memory heap to use */
684
681
{
685
 
        z_stream*       strm = stream;
 
682
        z_stream*       strm = static_cast<z_stream *>(stream);
686
683
 
687
684
        strm->zalloc = page_zip_malloc;
688
685
        strm->zfree = page_zip_free;
1229
1226
                               + UNIV_PAGE_SIZE * 4
1230
1227
                               + (512 << MAX_MEM_LEVEL));
1231
1228
 
1232
 
        recs = mem_heap_zalloc(heap, n_dense * sizeof *recs);
1233
 
 
1234
 
        fields = mem_heap_alloc(heap, (n_fields + 1) * 2);
1235
 
 
1236
 
        buf = mem_heap_alloc(heap, page_zip_get_size(page_zip) - PAGE_DATA);
 
1229
        recs = static_cast<const unsigned char **>(mem_heap_zalloc(heap, n_dense * sizeof *recs));
 
1230
 
 
1231
        fields = static_cast<byte *>(mem_heap_alloc(heap, (n_fields + 1) * 2));
 
1232
 
 
1233
        buf = static_cast<byte *>(mem_heap_alloc(heap, page_zip_get_size(page_zip) - PAGE_DATA));
1237
1234
        buf_end = buf + page_zip_get_size(page_zip) - PAGE_DATA;
1238
1235
 
1239
1236
        /* Compress the data payload. */
2854
2851
        }
2855
2852
 
2856
2853
        heap = mem_heap_create(n_dense * (3 * sizeof *recs) + UNIV_PAGE_SIZE);
2857
 
        recs = mem_heap_alloc(heap, n_dense * (2 * sizeof *recs));
 
2854
        recs = static_cast<byte **>(mem_heap_alloc(heap, n_dense * (2 * sizeof *recs)));
2858
2855
 
2859
2856
        if (all) {
2860
2857
                /* Copy the page header. */
2957
2954
                /* Pre-allocate the offsets for rec_get_offsets_reverse(). */
2958
2955
                ulint   n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE
2959
2956
                        + dict_index_get_n_fields(index);
2960
 
                offsets = mem_heap_alloc(heap, n * sizeof(ulint));
 
2957
                offsets = static_cast<unsigned long *>(mem_heap_alloc(heap, n * sizeof(ulint)));
2961
2958
                *offsets = n;
2962
2959
        }
2963
2960
 
4659
4656
        /* Exclude FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_LSN,
4660
4657
        and FIL_PAGE_FILE_FLUSH_LSN from the checksum. */
4661
4658
 
4662
 
        const Bytef*    s       = data;
 
4659
        const Bytef*    s       = static_cast<const Bytef *>(data);
4663
4660
        uLong           adler;
4664
4661
 
4665
4662
        ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);