Skip to content

Commit

Permalink
compile warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ireader committed Sep 21, 2019
1 parent 2af0f25 commit 05dcd3d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions libdash/test/dash-dynamic-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static int dash_server_mpd(http_session_t* session, dash_playlist_t* dash)

static int dash_server_onlive(void* dash, http_session_t* session, const char* /*method*/, const char* path)
{
char fullpath[PATH_MAX];
char fullpath[1024];
int r = path_concat(path + 6 /* /live/ */, LOCALPATH, fullpath);
printf("live: %s\n", fullpath);

Expand All @@ -186,7 +186,7 @@ static int dash_server_onlive(void* dash, http_session_t* session, const char* /

static int dash_server_onvod(void* /*dash*/, http_session_t* session, const char* /*method*/, const char* path)
{
char fullpath[PATH_MAX];
char fullpath[1024];
int r = path_concat(path + 5 /* /vod/ */, LOCALPATH, fullpath);
printf("vod: %s\n", fullpath);

Expand Down
15 changes: 7 additions & 8 deletions libsip/src/header/sip-header-via.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,32 @@ void sip_via_params_free(struct sip_via_t* via)
int sip_header_via(const char* s, const char* end, struct sip_via_t* via)
{
int i, j, k, r;
int i1, j1, k1, r1;
const char* p;
const struct sip_param_t* param;
memset(via, 0, sizeof(*via));
via->rport = -1;
sip_params_init(&via->params);

// SIP/2.0/UDP erlang.bell-telephone.com:5060;branch=z9hG4bK87asdks7
sscanf(s, " %n%*[^/ \t]%n / %n%*[^/ \t]%n / %n%*[^/ \t]%n %n%*[^; \t\r\n]%n ", &i, &i1, &j, &j1, &k, &k1, &r, &r1);
if (0 == r1 || s + r1 > end)
sscanf(s, " %n%*[^/ \t]%n / %n%*[^/ \t]%n / %n%*[^/ \t]%n %n%*[^; \t\r\n]%n ", &i, &via->protocol.n, &j, &via->version.n, &k, &via->transport.n, &r, &via->host.n);
if (0 == via->host.n || s + via->host.n > end)
return EINVAL;

// protocol-name
via->protocol.p = s + i;
via->protocol.n = i1 - i;
via->protocol.n -= i;

// protocol-version
via->version.p = s + j;
via->version.n = j1 - j;
via->version.n -= j;

// transport
via->transport.p = s + k;
via->transport.n = k1 - k;
via->transport.n -= k;

// sent-by
via->host.p = s + r;
via->host.n = r1 - r;
via->host.n -= r;

// via-params
p = strchr(via->host.p + via->host.n, ';');
Expand Down Expand Up @@ -94,7 +93,7 @@ int sip_header_via(const char* s, const char* end, struct sip_via_t* via)
}
else if (0 == cstrcmp(&param->name, "rport"))
{
via->rport = cstrvalid(&param->value) ? (int)cstrtol(&param->value, NULL, 10) : -1;
via->rport = cstrvalid(&param->value) ? cstrtol(&param->value, NULL, 10) : -1;
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions libsip/src/uas/sip-uas-register.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ static inline int sip_register_check_to_domain(const struct sip_message_t* req)
int r;
struct uri_t* to;
struct uri_t* uri;
to = uri_parse(req->to.uri.host.p, (int)req->to.uri.host.n);
uri = uri_parse(req->u.c.uri.host.p, (int)req->u.c.uri.host.n);
to = uri_parse(req->to.uri.host.p, req->to.uri.host.n);
uri = uri_parse(req->u.c.uri.host.p, req->u.c.uri.host.n);

r = (!uri || !uri->host || !to || !to->host || 0 != strcasecmp(to->host, uri->host)) ? 0 : 1;

Expand All @@ -76,7 +76,7 @@ int sip_uas_onregister(struct sip_uas_transaction_t* t, const struct sip_message
// 1. Request-URI

// Request-URI: The "userinfo" and "@" components of the SIP URI MUST NOT be present
uri = uri_parse(req->u.c.uri.host.p, (int)req->u.c.uri.host.n);
uri = uri_parse(req->u.c.uri.host.p, req->u.c.uri.host.n);
if (!uri || !uri->host)
{
uri_free(uri);
Expand All @@ -100,7 +100,7 @@ int sip_uas_onregister(struct sip_uas_transaction_t* t, const struct sip_message
// 4. authorized modify registrations(403 Forbidden)

// 5. To domain check (404 Not Found)
to = uri_parse(req->to.uri.host.p, (int)req->to.uri.host.n);
to = uri_parse(req->to.uri.host.p, req->to.uri.host.n);
if (!to || !to->host /*|| 0 != strcasecmp(to->host, uri->host)*/)
{
uri_free(to);
Expand Down Expand Up @@ -128,16 +128,16 @@ int sip_uas_onregister(struct sip_uas_transaction_t* t, const struct sip_message

// All registrations from a UAC SHOULD use the same Call-ID header
// field value for registrations sent to a particular registrar.
//req->callid;
req->callid;

// A UA MUST increment the CSeq value by one for each
// REGISTER request with the same Call-ID.
assert(0 == cstrcasecmp(&req->cseq.method, "REGISTER"));
//req->cseq.id;
req->cseq.id;

// zero or more values containing address bindings
contact = sip_contacts_get(&req->contacts, 0);
uri = contact ? uri_parse(contact->uri.host.p, (int)contact->uri.host.n) : NULL;
uri = contact ? uri_parse(contact->uri.host.p, contact->uri.host.n) : NULL;
if(contact && contact->expires > 0)
expires = (int)contact->expires;

Expand Down
2 changes: 0 additions & 2 deletions libsip/test/sip-uas-test2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <memory>
#include <string>
#include "sockutil.h"
#include "sockpair.h"
#include "sys/thread.h"
Expand Down

0 comments on commit 05dcd3d

Please sign in to comment.