Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
5fedd381
Commit
5fedd381
authored
Jun 08, 2020
by
Cedric Caffy
Browse files
cta-admin mediatype add works with non-given density codes
parent
dcffbb94
Changes
1
Hide whitespace changes
Inline
Side-by-side
xroot_plugins/XrdSsiCtaRequestMessage.cpp
View file @
5fedd381
...
...
@@ -1193,24 +1193,24 @@ void RequestMessage::processMediaType_Add(cta::xrd::Response &response)
// Bounds check unsigned integer options less than 64-bits in width
const
auto
nbWraps
=
getOptional
(
OptionUInt64
::
NUMBER_OF_WRAPS
);
const
uint64_t
primaryDensityCode
=
get
Required
(
OptionUInt64
::
PRIMARY_DENSITY_CODE
);
const
uint64_t
secondaryDensityCode
=
get
Required
(
OptionUInt64
::
SECONDARY_DENSITY_CODE
);
const
auto
primaryDensityCode
=
get
Optional
(
OptionUInt64
::
PRIMARY_DENSITY_CODE
);
const
auto
secondaryDensityCode
=
get
Optional
(
OptionUInt64
::
SECONDARY_DENSITY_CODE
);
if
(
nbWraps
&&
nbWraps
.
value
()
>
std
::
numeric_limits
<
uint32_t
>::
max
())
{
exception
::
UserError
ex
;
ex
.
getMessage
()
<<
"Number of wraps cannot be larger than "
<<
std
::
numeric_limits
<
uint32_t
>::
max
()
<<
": value="
<<
nbWraps
.
value
();
throw
ex
;
}
if
(
primaryDensityCode
>
std
::
numeric_limits
<
uint8_t
>::
max
())
{
if
(
primaryDensityCode
&&
primaryDensityCode
.
value
()
>
std
::
numeric_limits
<
uint8_t
>::
max
())
{
exception
::
UserError
ex
;
ex
.
getMessage
()
<<
"Primary density code cannot be larger than "
<<
(
uint16_t
)(
std
::
numeric_limits
<
uint8_t
>::
max
())
<<
": value="
<<
primaryDensityCode
;
<<
": value="
<<
primaryDensityCode
.
value
()
;
throw
ex
;
}
if
(
secondaryDensityCode
>
std
::
numeric_limits
<
uint8_t
>::
max
())
{
if
(
secondaryDensityCode
&&
secondaryDensityCode
.
value
()
>
std
::
numeric_limits
<
uint8_t
>::
max
())
{
exception
::
UserError
ex
;
ex
.
getMessage
()
<<
"Secondary density code cannot be larger than "
<<
(
uint16_t
)(
std
::
numeric_limits
<
uint8_t
>::
max
())
<<
": value="
<<
secondaryDensityCode
;
<<
": value="
<<
secondaryDensityCode
.
value
()
;
throw
ex
;
}
...
...
@@ -1218,8 +1218,8 @@ void RequestMessage::processMediaType_Add(cta::xrd::Response &response)
mediaType
.
name
=
getRequired
(
OptionString
::
MEDIA_TYPE
);
mediaType
.
cartridge
=
getRequired
(
OptionString
::
CARTRIDGE
);
mediaType
.
capacityInBytes
=
getRequired
(
OptionUInt64
::
CAPACITY
);
mediaType
.
primaryDensityCode
=
primaryDensityCode
;
mediaType
.
secondaryDensityCode
=
secondaryDensityCode
;
if
(
primaryDensityCode
)
mediaType
.
primaryDensityCode
=
primaryDensityCode
.
value
()
;
if
(
secondaryDensityCode
)
mediaType
.
secondaryDensityCode
=
secondaryDensityCode
.
value
()
;
if
(
nbWraps
)
mediaType
.
nbWraps
=
nbWraps
.
value
();
mediaType
.
minLPos
=
getOptional
(
OptionUInt64
::
MIN_LPOS
);
mediaType
.
maxLPos
=
getOptional
(
OptionUInt64
::
MAX_LPOS
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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