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
f2377dd4
Commit
f2377dd4
authored
Aug 14, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CycleStorage minor fixes: code style and other...
parent
4e4a16d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
CycleStorage.cc
src/Various/CycleStorage.cc
+26
-26
No files found.
src/Various/CycleStorage.cc
View file @
f2377dd4
...
...
@@ -83,21 +83,19 @@ bool CycleStorage::findHead()
/*! - */
head
=
0
;
/*! , */
while
(
r
-
l
>
1
)
while
(
(
r
-
l
)
>
1
)
{
mid
=
(
l
+
r
)
/
2
;
fseek
(
file
,
seekpos
+
mid
*
full_size
,
0
);
fread
(
jrn
,
full_size
,
1
,
file
);
iter
++
;
if
(
jrn
->
status
==
0
)
if
(
jrn
->
status
==
0
)
r
=
mid
;
else
l
=
mid
;
}
if
(
r
<
size
)
{
tail
=
r
-
1
;
else
l
=
mid
;
}
else
tail
=
size
-
1
;
tail
=
(
r
<
size
)
?
(
r
-
1
)
:
(
size
-
1
);
}
else
{
...
...
@@ -105,7 +103,8 @@ bool CycleStorage::findHead()
/*! i 2-, 4-, 2-, 4-
*/
i
=
jrn
->
status
-
jrn
->
status
%
2
;
if
(
i
==
2
)
j
=
4
;
else
j
=
2
;
j
=
(
i
==
2
)
?
4
:
2
;
while
((
jrn
->
status
!=
1
)
&&
(
jrn
->
status
!=
6
)
&&
(
r
-
l
>
1
))
{
mid
=
(
l
+
r
)
/
2
;
...
...
@@ -123,17 +122,19 @@ bool CycleStorage::findHead()
}
else
{
delete
[]
jrn
;
return
false
;
}
}
if
(
r
<
size
)
head
=
r
;
else
head
=
size
-
1
;
head
=
(
r
<
size
)
?
r
:
(
size
-
1
)
;
/*! 1 , .. , */
tail
=
head
-
1
;
if
(
tail
<
0
)
tail
=
size
-
1
;
}
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
...
...
@@ -242,7 +243,7 @@ bool CycleStorage::addRow(void* str)
filewrite
(
jrn
,
0
);
head
=
0
;
tail
=
0
;
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
if
(
head
==
tail
)
...
...
@@ -250,7 +251,7 @@ bool CycleStorage::addRow(void* str)
jrn
->
status
=
2
;
filewrite
(
jrn
,
1
);
tail
=
1
;
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
fseek
(
file
,
seekpos
+
tail
*
full_size
,
0
);
...
...
@@ -259,8 +260,7 @@ bool CycleStorage::addRow(void* str)
/*! 2, 3 -> 2; 4, 5 -> 4
*/
if
((
jrn
->
status
==
2
)
||
(
jrn
->
status
==
3
))
i
=
2
;
else
i
=
4
;
i
=
((
jrn
->
status
==
2
)
||
(
jrn
->
status
==
3
))
?
2
:
4
;
/*! ,
2->4, 4->2
...
...
@@ -270,10 +270,10 @@ bool CycleStorage::addRow(void* str)
{
fseek
(
file
,
seekpos
,
0
);
tail
=
0
;
if
(
i
==
2
)
i
=
4
;
else
i
=
2
;
i
=
(
i
==
2
)
?
4
:
2
;
}
else
tail
++
;
fread
(
jrn
,
full_size
,
1
,
file
);
memcpy
(
valPointer
(
jrn
),
str
,
inf_size
);
if
(
jrn
->
status
==
0
)
...
...
@@ -297,7 +297,7 @@ bool CycleStorage::addRow(void* str)
else
jrn
->
status
=
1
;
filewrite
(
jrn
,
head
);
}
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
...
...
@@ -317,19 +317,19 @@ bool CycleStorage::delRow(int row)
{
jrn
->
status
=
6
;
filewrite
(
jrn
,
i
);
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
if
(
jrn
->
status
==
2
)
j
=
3
;
else
if
(
jrn
->
status
==
4
)
j
=
5
;
else
{
delete
jrn
;
delete
[]
jrn
;
return
false
;
}
jrn
->
status
=
j
;
filewrite
(
jrn
,
i
);
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
...
...
@@ -352,7 +352,7 @@ bool CycleStorage::delAllRows()
}
fflush
(
file
);
head
=
tail
=-
1
;
delete
jrn
;
delete
[]
jrn
;
return
true
;
}
...
...
@@ -374,10 +374,10 @@ void* CycleStorage::readRow(int num, void* str)
if
((
jrn
->
status
==
1
)
||
(
jrn
->
status
==
2
)
||
(
jrn
->
status
==
4
))
{
memcpy
(
str
,
valPointer
(
jrn
),
inf_size
);
delete
jrn
;
delete
[]
jrn
;
return
str
;
}
delete
jrn
;
delete
[]
jrn
;
return
NULL
;
}
...
...
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