Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CT Input Output Library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
kulvait
CT Input Output Library
Commits
cfb5211f
Commit
cfb5211f
authored
Jan 23, 2020
by
kulvait
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: Wcomparison
parent
47f4c2cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
38 deletions
+38
-38
include/DEN/DenFrame2DReader.hpp
include/DEN/DenFrame2DReader.hpp
+38
-38
No files found.
include/DEN/DenFrame2DReader.hpp
View file @
cfb5211f
...
...
@@ -264,29 +264,29 @@ namespace io {
std
::
shared_ptr
<
io
::
BufferedFrame2D
<
T
>>
DenFrame2DReader
<
T
>::
readBufferedFrame
(
unsigned
int
sliceNum
)
{
std
::
unique_lock
<
std
::
mutex
>
l
;
bool
locked
=
false
;
uint32_t
mutexnum
=
0
;
for
(
uint32_t
i
=
0
;
i
!=
1
+
additionalBufferNum
;
i
++
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
i
],
std
::
try_to_lock
);
if
(
l
.
owns_lock
())
{
locked
=
true
;
mutexnum
=
i
;
break
;
}
}
if
(
!
locked
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
0
]);
mutexnum
=
0
;
}
std
::
unique_lock
<
std
::
mutex
>
l
;
bool
locked
=
false
;
uint32_t
mutexnum
=
0
;
for
(
uint32_t
i
=
0
;
i
!=
1
+
additionalBufferNum
;
i
++
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
i
],
std
::
try_to_lock
);
if
(
l
.
owns_lock
())
{
locked
=
true
;
mutexnum
=
i
;
break
;
}
}
if
(
!
locked
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
0
]);
mutexnum
=
0
;
}
// Mutex will be released as this goes out of scope.
// To protect calling this method from another thread using the same block of memory
uint8_t
*
buffer
=
buffers
[
mutexnum
];
T
*
buffer_copy
=
buffer_copys
[
mutexnum
];
uint32_t
elmCount
=
sizex
*
sizey
;
uint32_t
elmCount
=
sizex
*
sizey
;
uint64_t
position
=
this
->
offset
+
uint64_t
(
sliceNum
)
*
elementByteSize
*
elmCount
;
io
::
readBytesFrom
(
this
->
denFile
,
position
,
buffer
,
elementByteSize
*
elmCount
);
for
(
uint32_t
a
=
0
;
a
!=
elmCount
;
a
++
)
...
...
@@ -301,28 +301,28 @@ namespace io {
template
<
typename
T
>
void
DenFrame2DReader
<
T
>::
readFrameIntoBuffer
(
unsigned
int
frameID
,
T
*
outside_buffer
)
{
std
::
unique_lock
<
std
::
mutex
>
l
;
bool
locked
=
false
;
uint32_t
mutexnum
=
0
;
for
(
int
i
=
0
;
i
!=
1
+
additionalBufferNum
;
i
++
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
i
],
std
::
try_to_lock
);
if
(
l
.
owns_lock
())
{
locked
=
true
;
mutexnum
=
i
;
break
;
}
}
if
(
!
locked
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
0
]);
mutexnum
=
0
;
}
std
::
unique_lock
<
std
::
mutex
>
l
;
bool
locked
=
false
;
uint32_t
mutexnum
=
0
;
for
(
uint32_t
i
=
0
;
i
!=
1
+
additionalBufferNum
;
i
++
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
i
],
std
::
try_to_lock
);
if
(
l
.
owns_lock
())
{
locked
=
true
;
mutexnum
=
i
;
break
;
}
}
if
(
!
locked
)
{
l
=
std
::
unique_lock
<
std
::
mutex
>
(
consistencyMutexes
[
0
]);
mutexnum
=
0
;
}
// Mutex will be released as this goes out of scope.
// To protect calling this method from another thread using the same block of memory
uint8_t
*
buffer
=
buffers
[
mutexnum
];
uint32_t
elmCount
=
sizex
*
sizey
;
uint32_t
elmCount
=
sizex
*
sizey
;
uint64_t
position
=
this
->
offset
+
uint64_t
(
frameID
)
*
elementByteSize
*
elmCount
;
io
::
readBytesFrom
(
this
->
denFile
,
position
,
buffer
,
elementByteSize
*
elmCount
);
for
(
uint32_t
a
=
0
;
a
!=
elmCount
;
a
++
)
...
...
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