Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
2f13c1c9
Commit
2f13c1c9
authored
Sep 16, 2009
by
Ivan Donchevskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function to check heading match in file in TableBlockStorage
parent
accf2dca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
Storages.h
include/Storages.h
+2
-0
TableBlockStorage.cc
src/Various/TableBlockStorage.cc
+24
-12
No files found.
include/Storages.h
View file @
2f13c1c9
...
...
@@ -126,6 +126,8 @@ class TableBlockStorage
inline
int
getByteSize
()
{
return
(
size
*
full_size
+
sizeof
(
StorageAttr
));
}
bool
checkAttr
(
int
key_sz
,
int
inf_sz
,
int
sz
,
int
block_num
,
int
block_lim
,
int
seek
);
protected
:
FILE
*
file
;
int
inf_size
;
...
...
src/Various/TableBlockStorage.cc
View file @
2f13c1c9
...
...
@@ -115,6 +115,29 @@ bool TableBlockStorage::copyToNextBlock(void)
return
true
;
}
/*! */
bool
TableBlockStorage
::
checkAttr
(
int
key_sz
,
int
inf_sz
,
int
inf_count
,
int
block_num
,
int
block_lim
,
int
seek
)
{
if
(
file
==
NULL
)
return
false
;
int
tmpsize
=
inf_count
*
block_num
;
fseek
(
file
,
seek
,
0
);
/*! */
StorageAttr
sa
;
fread
(
&
sa
,
sizeof
(
StorageAttr
),
1
,
file
);
/*! */
if
((
sa
.
k_size
!=
key_sz
)
||
(
sa
.
inf_size
!=
inf_sz
)
||
(
sa
.
size
!=
tmpsize
)
||
(
sa
.
block_number
!=
block_num
)
||
(
sa
.
lim
!=
block_lim
)
||
(
sa
.
seekpos
!=
seek
))
{
fclose
(
file
);
file
=
NULL
;
return
false
;
}
return
true
;
}
bool
TableBlockStorage
::
open
(
const
char
*
name
,
int
byte_sz
,
int
key_sz
,
int
inf_sz
,
int
inf_count
,
int
block_num
,
int
block_lim
,
int
seek
)
{
/*! , */
...
...
@@ -131,21 +154,10 @@ bool TableBlockStorage::open(const char* name, int byte_sz, int key_sz, int inf_
return
false
;
}
/*! */
StorageAttr
sa
;
fread
(
&
sa
,
sizeof
(
StorageAttr
),
1
,
file
);
full_size
=
sizeof
(
TableBlockStorageElem
)
+
key_sz
+
inf_sz
;
int
tmpsize
=
inf_count
*
block_num
;
/*! */
if
((
sa
.
k_size
!=
key_sz
)
||
(
sa
.
inf_size
!=
inf_sz
)
||
(
sa
.
size
!=
tmpsize
)
||
(
sa
.
block_number
!=
block_num
)
||
(
sa
.
lim
!=
block_lim
)
||
(
sa
.
seekpos
!=
seek
))
{
fclose
(
file
);
file
=
NULL
;
if
(
!
checkAttr
(
key_sz
,
inf_sz
,
inf_count
,
block_num
,
block_lim
,
seek
)
)
return
false
;
}
k_size
=
key_sz
;
inf_size
=
inf_sz
;
...
...
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