Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sds-keyval
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
sds-keyval
Commits
830f58ff
Commit
830f58ff
authored
Aug 30, 2019
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better handling of size mismatch in get() calls
parent
7dd4849a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
include/sdskv-client.h
include/sdskv-client.h
+3
-0
include/sdskv-client.hpp
include/sdskv-client.hpp
+10
-1
src/sdskv-client.c
src/sdskv-client.c
+1
-1
No files found.
include/sdskv-client.h
View file @
830f58ff
...
...
@@ -188,6 +188,9 @@ int sdskv_put_multi(sdskv_provider_handle_t provider,
* If value is NULL, the call will be equivalent
* to sdskv_length and put the length of the value in *vsize.
*
* If the call returns SDSKV_ERR_SIZE, the value will be
* unchanged but the vsize will be set to the required size.
*
* @param[in] provider provider handle
* @param[in] db_id database id of the target database
* @param[in] key key to lookup
...
...
include/sdskv-client.hpp
View file @
830f58ff
...
...
@@ -480,7 +480,16 @@ class client {
s
=
length
(
db
,
key
);
object_resize
(
value
,
s
);
}
get
(
db
,
object_data
(
key
),
object_size
(
key
),
object_data
(
value
),
&
s
);
try
{
get
(
db
,
object_data
(
key
),
object_size
(
key
),
object_data
(
value
),
&
s
);
}
catch
(
exception
&
ex
)
{
if
(
ex
.
error
()
==
SDSKV_ERR_SIZE
)
{
object_resize
(
value
,
s
);
get
(
db
,
object_data
(
key
),
object_size
(
key
),
object_data
(
value
),
&
s
);
}
else
{
throw
;
}
}
object_resize
(
value
,
s
);
return
true
;
}
...
...
src/sdskv-client.c
View file @
830f58ff
...
...
@@ -609,7 +609,7 @@ int sdskv_get(sdskv_provider_handle_t provider,
ret
=
out
.
ret
;
*
vsize
=
(
hg_size_t
)
out
.
value
.
size
;
if
(
out
.
value
.
size
>
0
)
{
if
(
out
.
value
.
size
>
0
&&
out
.
ret
==
SDSKV_SUCCESS
)
{
memcpy
(
value
,
out
.
value
.
data
,
out
.
value
.
size
);
}
...
...
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