Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b0c0c2b3
Commit
b0c0c2b3
authored
Nov 18, 2005
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Split page_zip_apply_log() from page_zip_decompress().
parent
10fffd0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
23 deletions
+49
-23
page/page0zip.c
page/page0zip.c
+49
-23
No files found.
page/page0zip.c
View file @
b0c0c2b3
...
...
@@ -142,6 +142,47 @@ page_zip_ulint_write(
return
(
0
);
/* 11xxxxxxx xxxxxxxx: reserved */
}
/**************************************************************************
Apply the modification log to an uncompressed page. */
static
const
byte
*
page_zip_apply_log
(
/*===============*/
/* out: pointer to end of modification log,
or NULL on failure */
const
byte
*
data
,
/* in: modification log */
const
byte
*
end
,
/* in: end of compressed page */
page_t
*
page
)
/* in/out: uncompressed page */
{
/* Apply the modification log. */
while
(
*
data
)
{
ulint
ulint_len
;
ulint
length
,
offset
;
ulint_len
=
page_zip_ulint_read
(
data
,
&
length
);
data
+=
ulint_len
;
if
(
UNIV_UNLIKELY
(
!
ulint_len
)
||
UNIV_UNLIKELY
(
data
+
length
>=
end
))
{
return
(
NULL
);
}
ut_a
(
length
>
0
&&
length
<
UNIV_PAGE_SIZE
-
PAGE_DATA
);
ulint_len
=
page_zip_ulint_read
(
data
,
&
offset
);
data
+=
ulint_len
;
if
(
UNIV_UNLIKELY
(
!
ulint_len
)
||
UNIV_UNLIKELY
(
data
+
length
>=
end
))
{
return
(
NULL
);
}
offset
+=
PAGE_DATA
;
ut_a
(
offset
+
length
<
UNIV_PAGE_SIZE
);
memcpy
(
page
+
offset
,
data
,
length
);
data
+=
length
;
}
return
(
data
);
}
/**************************************************************************
Decompress a page. */
...
...
@@ -199,31 +240,16 @@ page_zip_decompress(
memcpy
(
page_zip
->
data
+
page_zip
->
size
-
trailer_len
,
page
+
UNIV_PAGE_SIZE
-
trailer_len
,
trailer_len
);
/* Apply the modification log. */
while
(
page_zip
->
data
[
page_zip
->
m_end
])
{
ulint
ulint_len
;
ulint
length
,
offset
;
ulint_len
=
page_zip_ulint_read
(
page_zip
->
data
+
page_zip
->
m_end
,
&
length
);
page_zip
->
m_end
+=
ulint_len
;
if
(
!
ulint_len
||
page_zip
->
m_end
+
length
>=
page_zip
->
size
-
trailer_len
)
{
{
const
byte
*
mod_log_ptr
;
mod_log_ptr
=
page_zip_apply_log
(
page_zip
->
data
+
page_zip
->
m_end
,
page_zip
->
data
+
page_zip
->
size
-
trailer_len
,
page
);
if
(
UNIV_UNLIKELY
(
!
mod_log_ptr
))
{
return
(
FALSE
);
}
ut_a
(
length
>
0
&&
length
<
UNIV_PAGE_SIZE
-
PAGE_DATA
);
ulint_len
=
page_zip_ulint_read
(
page_zip
->
data
+
page_zip
->
m_end
,
&
offset
);
page_zip
->
m_end
+=
ulint_len
;
if
(
!
ulint_len
||
page_zip
->
m_end
+
length
>=
page_zip
->
size
-
trailer_len
)
{
return
(
FALSE
);
}
offset
+=
PAGE_DATA
;
ut_a
(
offset
+
length
<
UNIV_PAGE_SIZE
-
trailer_len
);
memcpy
(
page
+
offset
,
page_zip
->
data
+
page_zip
->
m_end
,
length
);
page_zip
->
m_end
+=
length
;
page_zip
->
m_end
=
mod_log_ptr
-
page_zip
->
data
;
}
ut_a
(
page_is_comp
(
page
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment