Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
sofia-sip
Commits
8db51dbc
Commit
8db51dbc
authored
Sep 11, 2006
by
Pekka Pessi
Browse files
libsofia-sip-ua: more 64-bit fixes: internally using size_t instead of int.
darcs-hash:20060911125444-65a35-774501fccad12bb431bbc9e4e1ef2b4c1b9a1d4b.gz
parent
f60b9674
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
103 additions
and
106 deletions
+103
-106
libsofia-sip-ua/http/http_extra.c
libsofia-sip-ua/http/http_extra.c
+9
-11
libsofia-sip-ua/sdp/sdp.c
libsofia-sip-ua/sdp/sdp.c
+41
-47
libsofia-sip-ua/sip/sip_util.c
libsofia-sip-ua/sip/sip_util.c
+1
-1
libsofia-sip-ua/sip/validator.c
libsofia-sip-ua/sip/validator.c
+1
-1
libsofia-sip-ua/stun/stun_common.c
libsofia-sip-ua/stun/stun_common.c
+1
-1
libsofia-sip-ua/su/su_alloc.c
libsofia-sip-ua/su/su_alloc.c
+29
-29
libsofia-sip-ua/su/su_md5.c
libsofia-sip-ua/su/su_md5.c
+4
-4
libsofia-sip-ua/su/su_vector.c
libsofia-sip-ua/su/su_vector.c
+15
-10
libsofia-sip-ua/tport/tport_internal.h
libsofia-sip-ua/tport/tport_internal.h
+1
-1
libsofia-sip-ua/url/url.c
libsofia-sip-ua/url/url.c
+1
-1
No files found.
libsofia-sip-ua/http/http_extra.c
View file @
8db51dbc
...
...
@@ -100,7 +100,7 @@ HTTP_HEADER_CLASS_LIST(proxy_connection, "Proxy-Connection", list);
static
inline
void
http_cookie_update
(
http_cookie_t
*
c
)
{
in
t
i
;
size_
t
i
;
c
->
c_name
=
NULL
;
c
->
c_version
=
NULL
,
c
->
c_domain
=
NULL
,
c
->
c_path
=
NULL
;
...
...
@@ -154,7 +154,7 @@ static issize_t cookie_scanner(char *s)
/* get value */
if
(
*
s
==
'"'
)
{
i
size_t
qlen
=
span_quoted
(
s
);
size_t
qlen
=
span_quoted
(
s
);
if
(
!
qlen
)
return
-
1
;
s
+=
qlen
;
...
...
@@ -209,7 +209,7 @@ issize_t http_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
{
char
*
b0
=
b
,
*
end
=
b
+
bsiz
;
http_cookie_t
const
*
c
=
(
http_cookie_t
*
)
h
;
in
t
i
;
size_
t
i
;
if
(
c
->
c_params
)
{
for
(
i
=
0
;
c
->
c_params
[
i
];
i
++
)
{
...
...
@@ -226,12 +226,11 @@ issize_t http_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
/** Calculate extra storage used by Cookie header field */
isize_t
http_cookie_dup_xtra
(
msg_header_t
const
*
h
,
isize_t
offset
)
{
isize_t
rv
=
offset
;
http_cookie_t
const
*
c
=
(
http_cookie_t
*
)
h
;
MSG_PARAMS_SIZE
(
rv
,
c
->
c_params
);
MSG_PARAMS_SIZE
(
offset
,
c
->
c_params
);
return
rv
;
return
offset
;
}
/** Duplicate a Cookie header field */
...
...
@@ -303,7 +302,7 @@ HTTP_HEADER_CLASS(cookie, "Cookie", c_params, append, cookie);
static
inline
void
http_set_cookie_update
(
http_set_cookie_t
*
sc
)
{
in
t
i
;
size_
t
i
;
sc
->
sc_name
=
NULL
;
sc
->
sc_version
=
NULL
,
sc
->
sc_domain
=
NULL
,
sc
->
sc_path
=
NULL
;
...
...
@@ -426,7 +425,7 @@ issize_t http_set_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int fl
{
char
*
b0
=
b
,
*
end
=
b
+
bsiz
;
http_set_cookie_t
const
*
sc
=
(
http_set_cookie_t
*
)
h
;
in
t
i
;
size_
t
i
;
if
(
sc
->
sc_params
)
{
for
(
i
=
0
;
sc
->
sc_params
[
i
];
i
++
)
{
...
...
@@ -443,12 +442,11 @@ issize_t http_set_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int fl
/** Calculate extra storage used by Set-Cookie header field */
isize_t
http_set_cookie_dup_xtra
(
msg_header_t
const
*
h
,
isize_t
offset
)
{
isize_t
rv
=
offset
;
http_set_cookie_t
const
*
sc
=
(
http_set_cookie_t
*
)
h
;
MSG_PARAMS_SIZE
(
rv
,
sc
->
sc_params
);
MSG_PARAMS_SIZE
(
offset
,
sc
->
sc_params
);
return
rv
;
return
offset
;
}
/** Duplicate a Set-Cookie header field */
...
...
libsofia-sip-ua/sdp/sdp.c
View file @
8db51dbc
...
...
@@ -92,51 +92,51 @@ const unsigned sdp_struct_align_ = sizeof(void *) - STRUCT_ALIGN_;
((dst->m) = (src->m)?((p += STRUCT_ALIGN(p)),\
media_dup_all(&(p), src->m, dst)) : 0)
typedef
in
t
xtra_f
(
void
const
*
);
typedef
size_
t
xtra_f
(
void
const
*
);
typedef
void
*
dup_f
(
char
**
bb
,
void
const
*
src
);
static
in
t
list_xtra_all
(
xtra_f
*
xtra
,
void
const
*
v
);
static
size_
t
list_xtra_all
(
xtra_f
*
xtra
,
void
const
*
v
);
static
void
*
list_dup_all
(
dup_f
*
dup
,
char
**
bb
,
void
const
*
vsrc
);
static
in
t
session_xtra
(
sdp_session_t
const
*
o
);
static
size_
t
session_xtra
(
sdp_session_t
const
*
o
);
static
sdp_session_t
*
session_dup
(
char
**
pp
,
sdp_session_t
const
*
o
);
static
in
t
origin_xtra
(
sdp_origin_t
const
*
o
);
static
size_
t
origin_xtra
(
sdp_origin_t
const
*
o
);
static
sdp_origin_t
*
origin_dup
(
char
**
pp
,
sdp_origin_t
const
*
o
);
static
in
t
connection_xtra
(
sdp_connection_t
const
*
o
);
static
size_
t
connection_xtra
(
sdp_connection_t
const
*
o
);
static
sdp_connection_t
*
connection_dup
(
char
**
pp
,
sdp_connection_t
const
*
o
);
static
in
t
bandwidth_xtra
(
sdp_bandwidth_t
const
*
o
);
static
size_
t
bandwidth_xtra
(
sdp_bandwidth_t
const
*
o
);
static
sdp_bandwidth_t
*
bandwidth_dup
(
char
**
pp
,
sdp_bandwidth_t
const
*
o
);
static
in
t
time_xtra
(
sdp_time_t
const
*
o
);
static
size_
t
time_xtra
(
sdp_time_t
const
*
o
);
static
sdp_time_t
*
time_dup
(
char
**
pp
,
sdp_time_t
const
*
o
);
static
in
t
repeat_xtra
(
sdp_repeat_t
const
*
o
);
static
size_
t
repeat_xtra
(
sdp_repeat_t
const
*
o
);
static
sdp_repeat_t
*
repeat_dup
(
char
**
pp
,
sdp_repeat_t
const
*
o
);
static
in
t
zone_xtra
(
sdp_zone_t
const
*
o
);
static
size_
t
zone_xtra
(
sdp_zone_t
const
*
o
);
static
sdp_zone_t
*
zone_dup
(
char
**
pp
,
sdp_zone_t
const
*
o
);
static
in
t
key_xtra
(
sdp_key_t
const
*
o
);
static
size_
t
key_xtra
(
sdp_key_t
const
*
o
);
static
sdp_key_t
*
key_dup
(
char
**
pp
,
sdp_key_t
const
*
o
);
static
in
t
attribute_xtra
(
sdp_attribute_t
const
*
o
);
static
size_
t
attribute_xtra
(
sdp_attribute_t
const
*
o
);
static
sdp_attribute_t
*
attribute_dup
(
char
**
pp
,
sdp_attribute_t
const
*
o
);
static
in
t
list_xtra
(
sdp_list_t
const
*
o
);
static
size_
t
list_xtra
(
sdp_list_t
const
*
o
);
static
sdp_list_t
*
list_dup
(
char
**
pp
,
sdp_list_t
const
*
o
);
static
in
t
rtpmap_xtra
(
sdp_rtpmap_t
const
*
o
);
static
size_
t
rtpmap_xtra
(
sdp_rtpmap_t
const
*
o
);
static
sdp_rtpmap_t
*
rtpmap_dup
(
char
**
pp
,
sdp_rtpmap_t
const
*
o
);
static
in
t
media_xtra
(
sdp_media_t
const
*
o
);
static
size_
t
media_xtra
(
sdp_media_t
const
*
o
);
static
sdp_media_t
*
media_dup
(
char
**
pp
,
sdp_media_t
const
*
o
,
sdp_session_t
*
sdp
);
#ifdef nomore
static
in
t
media_xtra_ex
(
sdp_media_t
const
*
o
,
static
size_
t
media_xtra_ex
(
sdp_media_t
const
*
o
,
sdp_connection_t
const
*
c
);
static
sdp_media_t
*
media_dup_ex
(
char
**
pp
,
sdp_media_t
const
*
o
,
...
...
@@ -144,7 +144,7 @@ static sdp_media_t *media_dup_ex(char **pp,
sdp_connection_t
*
dst_c
,
sdp_connection_t
const
*
src_c
);
#endif
static
in
t
media_xtra_all
(
sdp_media_t
const
*
o
);
static
size_
t
media_xtra_all
(
sdp_media_t
const
*
o
);
static
sdp_media_t
*
media_dup_all
(
char
**
pp
,
sdp_media_t
const
*
o
,
sdp_session_t
*
sdp
);
...
...
@@ -152,7 +152,7 @@ static sdp_media_t *media_dup_all(char **pp,
/** Define a function body duplicating an SDP structure. */
#define SDP_DUP(type, name) \
sdp_##type##_t *rv;
in
t size; char *p, *end; \
sdp_##type##_t *rv;
size_
t size; char *p, *end; \
if (!name) return NULL; \
size = type##_xtra(name); \
p = su_alloc(h, size); end = p + size; \
...
...
@@ -162,7 +162,7 @@ static sdp_media_t *media_dup_all(char **pp,
/** Define a function body duplicating a list of SDP structures. */
#define SDP_LIST_DUP(type, name) \
sdp_##type##_t *rv;
in
t size; char *p, *end; \
sdp_##type##_t *rv;
size_
t size; char *p, *end; \
if (!name) return NULL; \
size = list_xtra_all((xtra_f*)type##_xtra, name); \
rv = su_alloc(h, size); p = (char *)rv; end = p + size; \
...
...
@@ -357,7 +357,7 @@ sdp_rtpmap_t *sdp_rtpmap_dup(su_home_t *h, sdp_rtpmap_t const *rm)
sdp_media_t
*
sdp_media_dup
(
su_home_t
*
h
,
sdp_media_t
const
*
m
,
sdp_session_t
*
sdp
)
{
sdp_media_t
*
rv
;
in
t
size
;
char
*
p
,
*
end
;
sdp_media_t
*
rv
;
size_
t
size
;
char
*
p
,
*
end
;
size
=
media_xtra
(
m
);
p
=
su_alloc
(
h
,
size
);
end
=
p
+
size
;
rv
=
media_dup
(
&
p
,
m
,
sdp
);
...
...
@@ -382,7 +382,7 @@ sdp_media_t *sdp_media_dup(su_home_t *h, sdp_media_t const *m,
sdp_media_t
*
sdp_media_dup_all
(
su_home_t
*
h
,
sdp_media_t
const
*
m
,
sdp_session_t
*
sdp
)
{
sdp_media_t
*
rv
;
in
t
size
;
char
*
p
,
*
end
;
sdp_media_t
*
rv
;
size_
t
size
;
char
*
p
,
*
end
;
size
=
media_xtra_all
(
m
);
p
=
su_alloc
(
h
,
size
);
end
=
p
+
size
;
rv
=
media_dup_all
(
&
p
,
m
,
sdp
);
...
...
@@ -417,7 +417,7 @@ sdp_media_t *sdp_media_dup_ex(su_home_t *home,
sdp_connection_t
*
dst_c
,
sdp_connection_t
const
*
src_c
)
{
sdp_media_t
*
rv
;
in
t
size
;
char
*
p
,
*
end
;
sdp_media_t
*
rv
;
size_
t
size
;
char
*
p
,
*
end
;
size
=
media_xtra_all
(
src
,
src_c
);
p
=
su_alloc
(
home
,
size
);
end
=
p
+
size
;
rv
=
media_dup_all
(
&
p
,
src
,
sdp
,
dst_c
,
src_c
);
...
...
@@ -428,8 +428,7 @@ sdp_media_t *sdp_media_dup_ex(su_home_t *home,
/* ---------------------------------------------------------------------- */
static
int
origin_xtra
(
sdp_origin_t
const
*
o
)
static
size_t
origin_xtra
(
sdp_origin_t
const
*
o
)
{
size_t
rv
=
sizeof
(
*
o
);
STR_XTRA
(
rv
,
o
->
o_username
);
...
...
@@ -453,8 +452,7 @@ sdp_origin_t *origin_dup(char **pp, sdp_origin_t const *src)
return
o
;
}
static
int
connection_xtra
(
sdp_connection_t
const
*
c
)
static
size_t
connection_xtra
(
sdp_connection_t
const
*
c
)
{
size_t
rv
=
sizeof
(
*
c
);
STR_XTRA
(
rv
,
c
->
c_address
);
...
...
@@ -477,7 +475,7 @@ sdp_connection_t *connection_dup(char **pp, sdp_connection_t const *src)
return
c
;
}
in
t
bandwidth_xtra
(
sdp_bandwidth_t
const
*
b
)
static
size_
t
bandwidth_xtra
(
sdp_bandwidth_t
const
*
b
)
{
size_t
rv
=
sizeof
(
*
b
);
STR_XTRA
(
rv
,
b
->
b_modifier_name
);
...
...
@@ -501,7 +499,7 @@ sdp_bandwidth_t *bandwidth_dup(char **pp, sdp_bandwidth_t const *src)
}
in
t
time_xtra
(
sdp_time_t
const
*
t
)
static
size_
t
time_xtra
(
sdp_time_t
const
*
t
)
{
size_t
rv
=
sizeof
(
*
t
);
PTR_XTRA
(
rv
,
t
->
t_repeat
,
repeat_xtra
);
...
...
@@ -527,9 +525,9 @@ sdp_time_t *time_dup(char **pp, sdp_time_t const *src)
}
in
t
repeat_xtra
(
sdp_repeat_t
const
*
r
)
static
size_
t
repeat_xtra
(
sdp_repeat_t
const
*
r
)
{
return
r
->
r_size
;
return
(
size_t
)
r
->
r_size
;
}
static
...
...
@@ -547,7 +545,7 @@ sdp_repeat_t *repeat_dup(char **pp, sdp_repeat_t const *src)
}
in
t
zone_xtra
(
sdp_zone_t
const
*
z
)
static
size_
t
zone_xtra
(
sdp_zone_t
const
*
z
)
{
return
z
->
z_size
;
}
...
...
@@ -567,7 +565,7 @@ sdp_zone_t *zone_dup(char **pp, sdp_zone_t const *src)
}
in
t
key_xtra
(
sdp_key_t
const
*
k
)
static
size_
t
key_xtra
(
sdp_key_t
const
*
k
)
{
size_t
rv
=
sizeof
(
*
k
);
STR_XTRA
(
rv
,
k
->
k_method_name
);
...
...
@@ -592,7 +590,7 @@ sdp_key_t *key_dup(char **pp, sdp_key_t const *src)
}
in
t
attribute_xtra
(
sdp_attribute_t
const
*
a
)
static
size_
t
attribute_xtra
(
sdp_attribute_t
const
*
a
)
{
size_t
rv
=
sizeof
(
*
a
);
STR_XTRA
(
rv
,
a
->
a_name
);
...
...
@@ -618,7 +616,7 @@ sdp_attribute_t *attribute_dup(char **pp, sdp_attribute_t const *src)
}
in
t
media_xtra
(
sdp_media_t
const
*
m
)
static
size_
t
media_xtra
(
sdp_media_t
const
*
m
)
{
size_t
rv
=
sizeof
(
*
m
);
...
...
@@ -745,8 +743,7 @@ sdp_media_t *media_dup_ex(char **pp,
}
#endif
static
int
media_xtra_all
(
sdp_media_t
const
*
m
)
static
size_t
media_xtra_all
(
sdp_media_t
const
*
m
)
{
size_t
rv
=
0
;
...
...
@@ -780,7 +777,7 @@ sdp_media_t *media_dup_all(char **pp,
return
retval
;
}
in
t
list_xtra
(
sdp_list_t
const
*
l
)
static
size_
t
list_xtra
(
sdp_list_t
const
*
l
)
{
size_t
rv
=
sizeof
(
*
l
);
rv
+=
strlen
(
l
->
l_text
)
+
1
;
...
...
@@ -803,7 +800,8 @@ sdp_list_t *list_dup(char **pp, sdp_list_t const *src)
return
l
;
}
int
rtpmap_xtra
(
sdp_rtpmap_t
const
*
rm
)
static
size_t
rtpmap_xtra
(
sdp_rtpmap_t
const
*
rm
)
{
size_t
rv
=
sizeof
(
*
rm
);
STR_XTRA
(
rv
,
rm
->
rm_encoding
);
...
...
@@ -831,9 +829,7 @@ sdp_rtpmap_t *rtpmap_dup(char **pp, sdp_rtpmap_t const *src)
}
/** Return total size of a list, including size of all nodes */
static
int
list_xtra_all
(
xtra_f
*
xtra
,
void
const
*
v
)
static
size_t
list_xtra_all
(
xtra_f
*
xtra
,
void
const
*
v
)
{
size_t
rv
=
0
;
sdp_list_t
const
*
l
;
...
...
@@ -868,9 +864,9 @@ void *list_dup_all(dup_f *dup, char **pp, void const *vsrc)
}
#if 0
in
t XXX_xtra(sdp_XXX_t const *YYY)
static size_
t XXX_xtra(sdp_XXX_t const *YYY)
{
in
t rv = sizeof(*YYY);
size_
t rv = sizeof(*YYY);
rv += strlen(YYY->YYY_encoding) + 1;
if (YYY->YYY_params);
rv += strlen(YYY->YYY_params) + 1;
...
...
@@ -894,8 +890,7 @@ sdp_XXX_t *XXX_dup(char **pp, sdp_XXX_t const *src)
#endif
static
int
session_xtra
(
sdp_session_t
const
*
sdp
)
static
size_t
session_xtra
(
sdp_session_t
const
*
sdp
)
{
size_t
rv
=
sizeof
(
*
sdp
);
...
...
@@ -965,8 +960,7 @@ sdp_session_t *sdp_session_dup(su_home_t *h, sdp_session_t const *sdp)
/* ---------------------------------------------------------------------- */
static
int
session_without_media_xtra
(
sdp_session_t
const
*
sdp
)
static
size_t
session_without_media_xtra
(
sdp_session_t
const
*
sdp
)
{
size_t
rv
=
sizeof
(
*
sdp
);
...
...
@@ -1097,7 +1091,7 @@ int sdptag_session_snprintf(tagi_t const *t, char b[], size_t size)
sdp_printer_free
(
print
);
return
retval
;
return
(
int
)
retval
;
}
/** Tag class for SDP tags. @HIDE */
...
...
libsofia-sip-ua/sip/sip_util.c
View file @
8db51dbc
...
...
@@ -366,7 +366,7 @@ issize_t sip_header_field_d(su_home_t *home, sip_header_t *h, char *s, isize_t s
assert
(
SIP_HDR_TEST
(
h
));
if
(
h
&&
s
&&
s
[
slen
]
==
'\0'
)
{
i
size_t
n
=
span_lws
(
s
);
size_t
n
=
span_lws
(
s
);
s
+=
n
;
slen
-=
n
;
for
(
n
=
slen
-
1
;
n
>=
0
&&
IS_LWS
(
s
[
n
]);
n
--
)
...
...
libsofia-sip-ua/sip/validator.c
View file @
8db51dbc
...
...
@@ -24,7 +24,7 @@
/**@IFILE validator.c
*
* SIP parser tester.
* SIP parser tester.
This uses output
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>.
*
...
...
libsofia-sip-ua/stun/stun_common.c
View file @
8db51dbc
...
...
@@ -782,7 +782,7 @@ char *stun_determine_ip_address(int family)
address_size
=
strlen
(
inet_ntoa
(
sa
->
sin_addr
));
local_ip_address
=
malloc
(
address_size
);
local_ip_address
=
malloc
(
address_size
+
1
);
strcpy
(
local_ip_address
,
(
char
*
)
inet_ntoa
(
sa
->
sin_addr
));
/* otherwise? */
su_freelocalinfo
(
li
);
...
...
libsofia-sip-ua/su/su_alloc.c
View file @
8db51dbc
...
...
@@ -232,9 +232,9 @@ struct su_block_s {
char
*
sub_preload
;
/**< Preload area */
su_home_stat_t
*
sub_stats
;
/**< Statistics.. */
void
(
*
sub_destructor
)(
void
*
);
/**< Destructor function */
unsigned
sub_ref
;
/**< Reference count */
unsigned
sub_used
;
/**< Number of blocks allocated */
unsigned
sub_n
;
/**< Size of hash table */
size_t
sub_ref
;
/**< Reference count */
size_t
sub_used
;
/**< Number of blocks allocated */
size_t
sub_n
;
/**< Size of hash table */
unsigned
sub_prsize
:
16
;
/**< Preload size */
unsigned
sub_prused
:
16
;
/**< Used from preload */
...
...
@@ -258,19 +258,19 @@ static void _su_home_deinit(su_home_t *home);
#define SU_ALLOC_STATS 1
#if SU_ALLOC_STATS
unsigned
count_su_block_find
,
count_su_block_find_loop
;
unsigned
size_su_block_find
,
used_su_block_find
;
unsigned
max_size_su_block_find
,
max_used_su_block_find
;
unsigned
su_block_find_collision
,
su_block_find_collision_used
,
size_t
count_su_block_find
,
count_su_block_find_loop
;
size_t
size_su_block_find
,
used_su_block_find
;
size_t
max_size_su_block_find
,
max_used_su_block_find
;
size_t
su_block_find_collision
,
su_block_find_collision_used
,
su_block_find_collision_size
;
#endif
static
inline
su_alloc_t
*
su_block_find
(
su_block_t
*
b
,
void
*
p
)
{
unsigned
h
,
h0
,
probe
;
size_t
h
,
h0
,
probe
;
#if SU_ALLOC_STATS
unsigned
collision
=
0
;
size_t
collision
=
0
;
count_su_block_find
++
;
size_su_block_find
+=
b
->
sub_n
;
...
...
@@ -283,7 +283,7 @@ static inline su_alloc_t *su_block_find(su_block_t *b, void *p)
assert
(
p
!=
NULL
);
h
=
h0
=
(
unsigned
)
(
uintptr_t
)
p
%
b
->
sub_n
;
h
=
h0
=
(
size_t
)(
(
uintptr_t
)
p
%
b
->
sub_n
)
;
probe
=
(
b
->
sub_n
>
SUB_P
)
?
SUB_P
:
1
;
...
...
@@ -307,11 +307,11 @@ static inline su_alloc_t *su_block_find(su_block_t *b, void *p)
static
inline
su_alloc_t
*
su_block_add
(
su_block_t
*
b
,
void
*
p
)
{
unsigned
h
,
probe
;
size_t
h
,
probe
;
assert
(
p
!=
NULL
);
h
=
(
unsigned
)
(
uintptr_t
)
p
%
b
->
sub_n
;
h
=
(
size_t
)(
(
uintptr_t
)
p
%
b
->
sub_n
)
;
probe
=
(
b
->
sub_n
>
SUB_P
)
?
SUB_P
:
1
;
...
...
@@ -364,7 +364,7 @@ static inline int su_alloc_check(su_block_t const *sub, su_alloc_t const *sua)
* This function returns a pointer to the allocated hash table or
* NULL if an error occurred.
*/
static
inline
su_block_t
*
su_hash_alloc
(
in
t
n
)
static
inline
su_block_t
*
su_hash_alloc
(
size_
t
n
)
{
su_block_t
*
b
=
calloc
(
1
,
offsetof
(
su_block_t
,
sub_nodes
[
n
]));
...
...
@@ -399,7 +399,7 @@ void *sub_alloc(su_home_t *home,
if
(
sub
==
NULL
||
3
*
sub
->
sub_used
>
2
*
sub
->
sub_n
)
{
/* Resize the hash table */
in
t
i
,
n
,
n2
,
used
;
size_
t
i
,
n
,
n2
,
used
;
su_block_t
*
b2
;
if
(
sub
)
...
...
@@ -462,7 +462,7 @@ void *sub_alloc(su_home_t *home,
su_alloc_t
*
sua
;
#if MEMCHECK_EXTRA
in
t
term
=
-
(
int
)
size
;
size_
t
term
=
0
-
size
;
memcpy
((
char
*
)
data
+
size
,
&
term
,
sizeof
(
term
));
#endif
...
...
@@ -548,7 +548,7 @@ void *su_home_ref(su_home_t const *home)
return
NULL
;
}
if
(
sub
->
sub_ref
!=
UINT
_MAX
)
if
(
sub
->
sub_ref
!=
REF
_MAX
)
sub
->
sub_ref
++
;
UNLOCK
(
home
);
}
...
...
@@ -603,7 +603,7 @@ int su_home_unref(su_home_t *home)
/* Xyzzy */
return
0
;
}
else
if
(
sub
->
sub_ref
==
UINT
_MAX
)
{
else
if
(
sub
->
sub_ref
==
REF
_MAX
)
{
UNLOCK
(
home
);
return
0
;
}
...
...
@@ -735,7 +735,7 @@ void su_free(su_home_t *home, void *data)
su_home_t
*
subhome
=
data
;
su_block_t
*
sub
=
MEMLOCK
(
subhome
);
assert
(
sub
->
sub_ref
!=
UINT
_MAX
);
assert
(
sub
->
sub_ref
!=
REF
_MAX
);
/* assert(sub->sub_ref > 0); */
sub
->
sub_ref
=
0
;
/* Zap all references */
...
...
@@ -785,7 +785,7 @@ void su_home_check_blocks(su_block_t const *b)
{
#if MEMCHECK != 0
if
(
b
)
{
unsigned
i
,
used
;
size_t
i
,
used
;
assert
(
b
->
sub_used
<=
b
->
sub_n
);
for
(
i
=
0
,
used
=
0
;
i
<
b
->
sub_n
;
i
++
)
...
...
@@ -865,7 +865,7 @@ static
void
_su_home_deinit
(
su_home_t
*
home
)
{
if
(
home
->
suh_blocks
)
{
unsigned
i
;
size_t
i
;
su_block_t
*
b
;
if
(
home
->
suh_blocks
->
sub_destructor
)
{
...
...
@@ -946,7 +946,7 @@ void su_home_deinit(su_home_t *home)
*/
int
su_home_move
(
su_home_t
*
dst
,
su_home_t
*
src
)
{
unsigned
i
,
n
,
n2
,
used
;
size_t
i
,
n
,
n2
,
used
;
su_block_t
*
s
,
*
d
,
*
d2
;
if
(
src
==
NULL
||
dst
==
src
)
...
...
@@ -1059,7 +1059,7 @@ void su_home_preload(su_home_t *home, isize_t n, isize_t isize)
preload
=
malloc
(
size
);
home
->
suh_blocks
->
sub_preload
=
preload
;
home
->
suh_blocks
->
sub_prsize
=
(
unsigned
short
)
size
;
home
->
suh_blocks
->
sub_prsize
=
(
unsigned
)
size
;
}
UNLOCK
(
home
);
}
...
...
@@ -1095,7 +1095,7 @@ su_home_t *su_home_auto(void *area, isize_t size)
sub
->
sub_n
=
SUB_N_AUTO
;
sub
->
sub_preload
=
p
+
prepsize
;
sub
->
sub_prsize
=
(
unsigned
short
)(
size
-
prepsize
);
sub
->
sub_prsize
=
(
unsigned
)(
size
-
prepsize
);
sub
->
sub_preauto
=
1
;
sub
->
sub_auto
=
1
;
sub
->
sub_auto_all
=
1
;
...
...
@@ -1126,7 +1126,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size)
su_alloc_t
*
sua
;
su_block_t
*
sub
;
size_t
p
;
in
t
term
=
-
((
int
)
size
)
;
size_
t
term
=
0
-
size
;
if
(
!
home
)
return
realloc
(
data
,
size
);
...
...
@@ -1180,7 +1180,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size)
p
=
ALIGN
(
p
);
if
(
p
==
sub
->
sub_prused
)
{
in
t
p2
=
(
char
*
)
data
-
sub
->
sub_preload
+
size
+
MEMCHECK_EXTRA
;
size_
t
p2
=
(
char
*
)
data
-
sub
->
sub_preload
+
size
+
MEMCHECK_EXTRA
;
p2
=
ALIGN
(
p2
);
if
(
p2
<=
sub
->
sub_prsize
)
{
/* Extend/reduce existing preload */
...
...
@@ -1373,7 +1373,7 @@ int su_home_mutex_unlock(su_home_t *home)
void
su_home_init_stats
(
su_home_t
*
home
)
{
su_block_t
*
sub
;
in
t
size
;
size_
t
size
;
if
(
home
==
NULL
)
return
;
...
...
@@ -1403,7 +1403,7 @@ void su_home_init_stats(su_home_t *home)
*/
void
su_home_get_stats
(
su_home_t
*
home
,
int
include_clones
,
su_home_stat_t
hs
[
1
],
i
n
t
size
)
i
size_
t
size
)
{
su_block_t
*
sub
;
...
...
@@ -1415,8 +1415,8 @@ void su_home_get_stats(su_home_t *home, int include_clones,
sub
=
MEMLOCK
(
home
);
if
(
sub
&&
sub
->
sub_stats
)
{
in
t
sub_size
=
sub
->
sub_stats
->
hs_size
;
if
(
sub_size
>
size
)
size_
t
sub_size
=
sub
->
sub_stats
->
hs_size
;
if
(
sub_size
>
(
size_t
)
size
)
sub_size
=
size
;
sub
->
sub_stats
->
hs_preload
.
hsp_size
=
sub
->
sub_prsize
;
sub
->
sub_stats
->
hs_preload
.
hsp_used
=
sub
->
sub_prused
;
...
...
libsofia-sip-ua/su/su_md5.c
View file @
8db51dbc
...
...
@@ -177,9 +177,9 @@ su_md5_update(su_md5_t *ctx,
/** Copy memory, fix case to lower. */
static
void
mem_i_cpy
(
unsigned
char
*
d
,
unsigned
char
const
*
s
,
in
t
len
)
void
mem_i_cpy
(
unsigned
char
*
d
,
unsigned
char
const
*
s
,
size_
t
len
)
{
in
t
i
;
size_
t
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
s
[
i
]
>=
'A'
&&
s
[
i
]
<=
'Z'
)
...
...
@@ -222,7 +222,7 @@ su_md5_iupdate(su_md5_t *ctx,
t
=
sizeof
(
ctx
->
in
)
-
t
;
if
(
len
<
t
)
{
mem_i_cpy
(
p
,
buf
,
(
uint32_t
)
len
);
mem_i_cpy
(
p
,
buf
,
len
);
return
;
}
mem_i_cpy
(
p
,
buf
,
t
);
...
...
@@ -240,7 +240,7 @@ su_md5_iupdate(su_md5_t *ctx,
}
/* Handle any remaining bytes of data. */
mem_i_cpy
(
ctx
->
in
,
buf
,
(
uint32_t
)
len
);
mem_i_cpy
(
ctx
->
in
,
buf
,
len
);
}
/** Update MD5 context with contents of string.
...
...
libsofia-sip-ua/su/su_vector.c
View file @
8db51dbc
...
...
@@ -94,7 +94,7 @@ su_vector_t *su_vector_create(su_home_t *home, su_free_func_t free_func)
*/
void
su_vector_destroy
(
su_vector_t
*
vector
)