~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/mach/mach0data.cc

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1995, 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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
92
92
                return(ptr + 5);
93
93
        }
94
94
}
95
 
 
96
 
/*********************************************************//**
97
 
Reads a dulint in a compressed form if the log record fully contains it.
98
 
@return pointer to end of the stored field, NULL if not complete */
99
 
UNIV_INTERN
100
 
byte*
101
 
mach_dulint_parse_compressed(
102
 
/*=========================*/
103
 
        byte*   ptr,    /*!< in: pointer to buffer from where to read */
104
 
        byte*   end_ptr,/*!< in: pointer to end of the buffer */
105
 
        dulint* val)    /*!< out: read value */
106
 
{
107
 
        ulint   high;
108
 
        ulint   low;
109
 
        ulint   size;
110
 
 
111
 
        ut_ad(ptr && end_ptr && val);
112
 
 
113
 
        if (end_ptr < ptr + 5) {
114
 
 
115
 
                return(NULL);
116
 
        }
117
 
 
118
 
        high = mach_read_compressed(ptr);
119
 
 
120
 
        size = mach_get_compressed_size(high);
121
 
 
122
 
        ptr += size;
123
 
 
124
 
        if (end_ptr < ptr + 4) {
125
 
 
126
 
                return(NULL);
127
 
        }
128
 
 
129
 
        low = mach_read_from_4(ptr);
130
 
 
131
 
        *val = ut_dulint_create(high, low);
132
 
 
133
 
        return(ptr + 4);
134
 
}