Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap
Commits
ea4d51cd
Unverified
Commit
ea4d51cd
authored
5 years ago
by
Dmitriy A. Gerasimov
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #48 from kelvinblockchain/feature-2298
added dap_strlen(). String may be nullable.
parents
6bfb5f20
5efd8b29
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/dap_strfuncs.c
+20
-0
20 additions, 0 deletions
core/dap_strfuncs.c
core/dap_strfuncs.h
+13
-12
13 additions, 12 deletions
core/dap_strfuncs.h
crypto/dap_enc.c
+4
-0
4 additions, 0 deletions
crypto/dap_enc.c
with
37 additions
and
12 deletions
core/dap_strfuncs.c
+
20
−
0
View file @
ea4d51cd
...
...
@@ -23,6 +23,26 @@ char *strndup(char *str, int len) {
}
#endif
/**
* dap_strlen:
* @a_str: (nullable): the string
*
* If @a_str is %NULL it returns 0
*
* Returns: length of the string
*/
size_t
dap_strlen
(
const
char
*
a_str
)
{
size_t
l_length
=
0
;
if
(
a_str
)
{
l_length
=
strlen
(
a_str
);
}
else
return
l_length
;
}
/**
* dap_strdup:
* @a_str: (nullable): the string to duplicate
...
...
This diff is collapsed.
Click to expand it.
core/dap_strfuncs.h
+
13
−
12
View file @
ea4d51cd
...
...
@@ -11,27 +11,28 @@
#include
<stdlib.h>
#include
<time.h>
#define dap_return_if_fail(expr)
{if(!(expr)) {return;}}
#define dap_return_val_if_fail(expr,val)
{if(!(expr)) {return (val);}}
#define dap_return_if_fail(expr)
{if(!(expr)) {return;}}
#define dap_return_val_if_fail(expr,val)
{if(!(expr)) {return (val);}}
#define POINTER_TO_INT(p)
((int) (p))
#define POINTER_TO_UINT(p)
((unsigned int) (p))
#define POINTER_TO_INT(p)
((int) (p))
#define POINTER_TO_UINT(p)
((unsigned int) (p))
#define INT_TO_POINTER(i)
((void*) (i))
#define UINT_TO_POINTER(u)
((void*) (u))
#define INT_TO_POINTER(i)
((void*) (i))
#define UINT_TO_POINTER(u)
((void*) (u))
#undef
max
#undef
max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#undef
min
#undef
min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#undef
abs
#define abs(a)
(((a) < 0) ? -(a) : (a))
#undef
abs
#define abs(a)
(((a) < 0) ? -(a) : (a))
#undef
clamp
#undef
clamp
#define clamp(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
size_t
dap_strlen
(
const
char
*
a_str
);
char
*
dap_strdup
(
const
char
*
a_str
);
char
*
dap_strdup_vprintf
(
const
char
*
a_format
,
va_list
a_args
);
char
*
dap_strdup_printf
(
const
char
*
a_format
,
...);
...
...
@@ -54,7 +55,7 @@ char* dap_strchug(char *a_string);
// removes trailing spaces
char
*
dap_strchomp
(
char
*
a_string
);
// removes leading & trailing spaces
#define dap_strstrip( a_string )
dap_strchomp (dap_strchug (a_string))
#define dap_strstrip( a_string )
dap_strchomp (dap_strchug (a_string))
// Converts all lower case ASCII letters to upper case ASCII letters.
char
*
dap_strup
(
const
char
*
a_str
,
ssize_t
a_len
);
...
...
This diff is collapsed.
Click to expand it.
crypto/dap_enc.c
+
4
−
0
View file @
ea4d51cd
...
...
@@ -106,6 +106,10 @@ size_t dap_enc_decode_out_size(dap_enc_key_t* a_key, const size_t a_buf_in_size,
size_t
dap_enc_code
(
struct
dap_enc_key
*
a_key
,
const
void
*
a_buf_in
,
const
size_t
a_buf_size
,
void
*
a_buf_out
,
const
size_t
a_buf_out_size_max
,
dap_enc_data_type_t
a_data_type_out
)
{
if
(
!
a_key
)
{
log_it
(
L_ERROR
,
"key in dap_enc_code() is NULL"
);
return
0
;
}
if
(
a_key
->
enc_na
)
{
if
(
a_data_type_out
==
DAP_ENC_DATA_TYPE_RAW
)
{
return
a_key
->
enc_na
(
a_key
,
a_buf_in
,
a_buf_size
,
a_buf_out
,
a_buf_out_size_max
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment