Skip to content

Commit

Permalink
xcode compile warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ireader committed Nov 17, 2018
1 parent a3c370a commit 10a7e3a
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion libflv/source/flv-demuxer-script.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int flv_demuxer_script(struct flv_demuxer_t* flv, const uint8_t* data, size_t by

AMF_OBJECT_ITEM_VALUE(prop[15], AMF_OBJECT, "keyframes", keyframes, 2); // FLV I-index

AMF_OBJECT_ITEM_VALUE(items[0], AMF_ECMA_ARRAY, "onMetaData", prop, sizeof(prop) / sizeof(prop[0]));
AMF_OBJECT_ITEM_VALUE(items[0], AMF_OBJECT, "onMetaData", prop, sizeof(prop) / sizeof(prop[0]));
#undef AMF_OBJECT_ITEM_VALUE

end = data + bytes;
Expand Down
9 changes: 4 additions & 5 deletions libhls/demo/hls-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "http-route.h"
#include "sys/thread.h"
#include "sys/system.h"
#include "sys/atomic.h"
#include "sys/path.h"
#include "cstringext.h"
#include "utf8codec.h"
Expand All @@ -29,7 +28,7 @@ extern "C" int http_list_dir(http_session_t* session, const char* path);

struct hls_ts_t
{
int32_t ref;
std::atomic<int> ref;
void* data;
size_t size;
std::string name;
Expand Down Expand Up @@ -82,7 +81,7 @@ static int hls_handler(void* param, const void* data, size_t bytes, int64_t pts,
{
ts = playlist->files.front();
playlist->files.pop_front();
if (0 == atomic_decrement32(&ts->ref))
if (0 == std::atomic_fetch_sub(&ts->ref, 1) - 1)
{
free(ts->data);
delete ts;
Expand Down Expand Up @@ -176,7 +175,7 @@ static int hls_server_m3u8(http_session_t* session, const std::string& path)
static int hls_server_ts_onsend(void* param, int code, size_t bytes)
{
hls_ts_t* ts = (hls_ts_t*)param;
if (0 == atomic_decrement32(&ts->ref))
if (0 == std::atomic_fetch_sub(&ts->ref, 1) - 1)
{
free(ts->data);
delete ts;
Expand All @@ -196,7 +195,7 @@ static int hls_server_ts(http_session_t* session, const std::string& path, const
hls_ts_t* ts = *i;
if(ts->name == file)
{
atomic_increment32(&ts->ref);
std::atomic_fetch_add(&ts->ref, 1);
http_server_set_header(session, "Access-Control-Allow-Origin", "*");
http_server_set_header(session, "Access-Control-Allow-Methods", "GET, POST, PUT");
http_server_send(session, 200, ts->data, ts->size, hls_server_ts_onsend, ts);
Expand Down
2 changes: 1 addition & 1 deletion librtmp/test/rtmp-server-forward-aio-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <assert.h>
#include <stdio.h>
#include "cpm/shared_ptr.h"
#include <string.h>
#include <string>
#include <list>
#include <map>

Expand Down
2 changes: 1 addition & 1 deletion librtmp/test/rtmp-server-publish-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void rtmp_server_publish_input(rtmp_server_publish_benchmark_t* rtmp, uin

static int STDCALL rtmp_server_onthread(void* param)
{
int idx = (int)param;
int idx = (int)(intptr_t)param;
while (1)
{
uint64_t now = system_clock();
Expand Down
1 change: 1 addition & 0 deletions librtsp/source/server/aio/rtsp-server-listen.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "rtsp-server-aio.h"
#include "aio-accept.h"
#include "sockutil.h"
#include <stdlib.h>

struct rtsp_server_listen_t
{
Expand Down
2 changes: 1 addition & 1 deletion librtsp/source/server/rtsp-server-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int rtsp_server_record(struct rtsp_server_t *rtsp, const char* uri)
return rtsp->handler.onrecord(rtsp->param, rtsp, uri, rtsp->session.session, -1L == npt ? NULL : &npt, pscale ? &scale : NULL);
}

int rtsp_server_reply_record(struct rtsp_server_t *rtsp, int code, const int64_t *nptstart, const int64_t *nptend, const char* rtp)
int rtsp_server_reply_record(struct rtsp_server_t *rtsp, int code, const int64_t *nptstart, const int64_t *nptend)
{
int len = 0;
char header[1024] = { 0 };
Expand Down
2 changes: 2 additions & 0 deletions librtsp/test/rtp-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include "sockutil.h"
#include "sys/atomic.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>

static unsigned short s_base_port = 30000;
Expand Down
2 changes: 1 addition & 1 deletion librtsp/test/rtsp-server-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static int rtsp_onplay(void* /*ptr*/, rtsp_server_t* rtsp, const char* uri, cons
if(scale && 0 != source->SetSpeed(*scale))
{
// set speed
assert(scale > 0);
assert(*scale > 0);

// 406 Not Acceptable
return rtsp_server_reply_play(rtsp, 406, NULL, NULL, NULL);
Expand Down
1 change: 1 addition & 0 deletions libsip/include/sip-dialog.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _sip_dialog_h_
#define _sip_dialog_h_

#include "sip-message.h"
#include "sip-header.h"
#include "sys/atomic.h"
#include "cstring.h"
Expand Down
2 changes: 2 additions & 0 deletions libsip/src/uac/sip-uac-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "sip-transport.h"
#include "uri-parse.h"

#define min(x, y) ((x) < (y) ? (x) : (y))

struct sip_uac_transaction_t* sip_uac_transaction_create(struct sip_uac_t* uac, struct sip_message_t* req)
{
struct sip_uac_transaction_t* t;
Expand Down
2 changes: 2 additions & 0 deletions libsip/src/uas/sip-uas-transaction-invite.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "sip-uas-transaction.h"

#define min(x, y) ((x) < (y) ? (x) : (y))

static int sip_uas_transaction_onretransmission(void* usrptr);
static int sip_uas_transaction_ontimeout(void* usrptr);

Expand Down
16 changes: 13 additions & 3 deletions libsip/test/sip-uac-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "base64.h"
#include "md5.h"
#include <stdint.h>
#include <string.h>
#include <ctype.h>

struct sip_uac_test_t
{
Expand Down Expand Up @@ -128,6 +130,14 @@ static void sip_uac_recv_reply(struct sip_uac_test_t *test)
} while (1);
}

static inline const char* strlower(char* s)
{
char* p;
for(p = s; p && *p; p++)
*p = tolower(*p);
return s;
}

static void md5_digest(const uint8_t* data, int size, uint8_t md5[16])
{
MD5_CTX ctx;
Expand Down Expand Up @@ -175,12 +185,12 @@ static int sip_uac_onregister(void* param, const struct sip_message_t* reply, st
md5_digest((uint8_t*)buffer, strlen(buffer), (uint8_t*)HA2);
base16_encode(ha1, HA1, 16);
base16_encode(ha2, HA2, 16);
_strlwr(ha1);
_strlwr(ha2);
strlower(ha1);
strlower(ha2);
snprintf(buffer, sizeof(buffer), "%s:%s:%s", ha1, auth.nonce, ha2);
md5_digest((uint8_t*)buffer, strlen(buffer), (uint8_t*)HA2);
base16_encode(ha2, HA2, 16);
_strlwr(ha2);
strlower(ha2);

snprintf(buffer, sizeof(buffer), "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\", algorithm=MD5",
"34020000001320000001", auth.realm, auth.nonce, "sip:192.168.154.128", ha2);
Expand Down

0 comments on commit 10a7e3a

Please sign in to comment.