Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
907e01d6
Commit
907e01d6
authored
Nov 15, 2014
by
Evan Hunt
Browse files
[master] buffer ATF test was failing
parent
ed51a217
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/isc/buffer.c
View file @
907e01d6
...
...
@@ -505,20 +505,21 @@ isc_buffer_reserve(isc_buffer_t **dynbuffer, unsigned int size) {
REQUIRE
(
ISC_BUFFER_VALID
(
*
dynbuffer
));
len
=
(
*
dynbuffer
)
->
length
;
if
((
len
-
(
*
dynbuffer
)
->
used
)
>
size
)
if
((
len
-
(
*
dynbuffer
)
->
used
)
>
=
size
)
return
(
ISC_R_SUCCESS
);
/* Round to nearest buffer size increment */
len
+
=
size
;
len
=
size
+
(
*
dynbuffer
)
->
used
;
len
=
(
len
+
ISC_BUFFER_INCR
-
1
-
((
len
-
1
)
%
ISC_BUFFER_INCR
));
/* Cap at UINT_MAX */
if
(
len
>
UINT_MAX
)
{
len
=
UINT_MAX
;
if
((
len
-
(
*
dynbuffer
)
->
used
)
<
size
)
return
(
ISC_R_NOMEMORY
);
}
if
((
len
-
(
*
dynbuffer
)
->
used
)
<
size
)
return
(
ISC_R_NOMEMORY
);
return
(
isc_buffer_reallocate
(
dynbuffer
,
(
unsigned
int
)
len
));
}
...
...
lib/isc/tests/buffer_test.c
View file @
907e01d6
...
...
@@ -67,7 +67,7 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
* 2048 bytes should already be available, so this call does
* nothing.
*/
result
=
isc_buffer_reserve
(
&
b
,
20
48
);
result
=
isc_buffer_reserve
(
&
b
,
20
00
);
ATF_CHECK_EQ
(
result
,
ISC_R_SUCCESS
);
ATF_CHECK
(
ISC_BUFFER_VALID
(
b
));
...
...
@@ -77,7 +77,7 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
* This call should grow it to 4096 bytes as only 2048 bytes are
* available in the buffer.
*/
result
=
isc_buffer_reserve
(
&
b
,
2049
);
result
=
isc_buffer_reserve
(
&
b
,
3000
);
ATF_CHECK_EQ
(
result
,
ISC_R_SUCCESS
);
ATF_CHECK
(
ISC_BUFFER_VALID
(
b
));
...
...
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