1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-26 04:21:00 +01:00

c++ compilation errors fixed

This commit is contained in:
mom040267 2015-01-24 08:21:32 +00:00
parent b6f1eb9dc3
commit 4e8b95bbb0
8 changed files with 22 additions and 16 deletions

View File

@ -714,7 +714,7 @@ static int mongo_set_secret(u08bits *secret, u08bits *realm) {
}
}
static int mongo_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int delete)
static int mongo_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int del)
{
char sub_collection_name[129];
snprintf(sub_collection_name,sizeof(sub_collection_name)-1,"%s_peer_ip",kind);
@ -733,7 +733,7 @@ static int mongo_set_permission_ip(const char *kind, u08bits *realm, const char*
bson_init(&query);
BSON_APPEND_UTF8(&query, "realm", (const char *)realm);
bson_init(&doc);
if(delete) {
if(del) {
bson_append_document_begin(&doc, "$pull", -1, &child);
} else {
bson_append_document_begin(&doc, "$addToSet", -1, &child);
@ -741,9 +741,9 @@ static int mongo_set_permission_ip(const char *kind, u08bits *realm, const char*
BSON_APPEND_UTF8(&child, sub_collection_name, (const char *)ip);
bson_append_document_end(&doc, &child);
mongoc_update_flags_t flags = 0;
mongoc_update_flags_t flags = MONGOC_UPDATE_NONE;
if(delete) {
if(del) {
flags = MONGOC_UPDATE_MULTI_UPDATE;
} else {
flags = MONGOC_UPDATE_UPSERT;

View File

@ -724,7 +724,7 @@ static int mysql_set_secret(u08bits *secret, u08bits *realm) {
return ret;
}
static int mysql_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int delete)
static int mysql_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int del)
{
int ret = -1;
@ -737,7 +737,7 @@ static int mysql_set_permission_ip(const char *kind, u08bits *realm, const char*
MYSQL * myc = get_mydb_connection();
if (myc) {
if(delete) {
if(del) {
snprintf(statement, sizeof(statement), "delete from %s_peer_ip where realm = '%s' and ip_range = '%s'", kind, (char*)realm, ip);
} else {
snprintf(statement, sizeof(statement), "insert into %s_peer_ip (realm,ip_range) values('%s','%s')", kind, (char*)realm, ip);

View File

@ -490,7 +490,7 @@ static int pgsql_set_secret(u08bits *secret, u08bits *realm) {
return ret;
}
static int pgsql_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int delete)
static int pgsql_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int del)
{
int ret = -1;
@ -505,7 +505,7 @@ static int pgsql_set_permission_ip(const char *kind, u08bits *realm, const char*
if (pqc) {
if(delete) {
if(del) {
snprintf(statement, sizeof(statement), "delete from %s_peer_ip where realm = '%s' and ip_range = '%s'", kind, (char*)realm, ip);
} else {
snprintf(statement, sizeof(statement), "insert into %s_peer_ip (realm,ip_range) values('%s','%s')", kind, (char*)realm, ip);

View File

@ -827,7 +827,7 @@ static int redis_set_secret(u08bits *secret, u08bits *realm)
return ret;
}
static int redis_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int delete)
static int redis_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int del)
{
int ret = -1;
@ -840,7 +840,7 @@ static int redis_set_permission_ip(const char *kind, u08bits *realm, const char*
if (rc) {
char s[TURN_LONG_STRING_SIZE];
if(delete) {
if(del) {
snprintf(s, sizeof(s), "srem turn/realm/%s/%s-peer-ip %s", (char*) realm, kind, ip);
} else {
snprintf(s, sizeof(s), "sadd turn/realm/%s/%s-peer-ip %s", (char*) realm, kind, ip);

View File

@ -976,7 +976,7 @@ static int sqlite_get_ip_list(const char *kind, ip_range_list_t * list)
return ret;
}
static int sqlite_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int delete)
static int sqlite_set_permission_ip(const char *kind, u08bits *realm, const char* ip, int del)
{
int ret = -1;
@ -995,7 +995,7 @@ static int sqlite_set_permission_ip(const char *kind, u08bits *realm, const char
sqlite_lock(1);
if(delete) {
if(del) {
snprintf(statement, sizeof(statement), "delete from %s_peer_ip where realm = '%s' and ip_range = '%s'", kind, (char*)realm, ip);
} else {
snprintf(statement, sizeof(statement), "insert or replace into %s_peer_ip (realm,ip_range) values('%s','%s')", kind, (char*)realm, ip);

View File

@ -63,7 +63,7 @@ typedef struct _turn_dbdriver_t {
int (*list_realm_options)(u08bits *realm);
void (*auth_ping)(void * rch);
int (*get_ip_list)(const char *kind, ip_range_list_t * list);
int (*set_permission_ip)(const char *kind, u08bits *realm, const char* ip, int delete);
int (*set_permission_ip)(const char *kind, u08bits *realm, const char* ip, int del);
void (*reread_realms)(secrets_list_t * realms_list);
int (*set_oauth_key)(oauth_key_data_raw *key);
int (*get_oauth_key)(const u08bits *kid, oauth_key_data_raw *key);

View File

@ -104,7 +104,7 @@ const char* get_http_date_header()
static struct headers_list * post_parse(char *data, size_t data_len)
{
while((*data=='\r')||(*data=='\n')) ++data;
char *post_data = calloc(data_len + 1, sizeof(char));
char *post_data = (char*)calloc(data_len + 1, sizeof(char));
memcpy(post_data, data, data_len);
char *fmarker = NULL;
char *fsplit = strtok_r(post_data, "&", &fmarker);
@ -114,7 +114,9 @@ static struct headers_list * post_parse(char *data, size_t data_len)
char *vmarker = NULL;
char *key = strtok_r(fsplit, "=", &vmarker);
char *value = strtok_r(NULL, "=", &vmarker);
value = value ? value : "";
char empty[1];
empty[0]=0;
value = value ? value : empty;
value = evhttp_decode_uri(value);
char *p = value;
while (*p) {

View File

@ -3257,7 +3257,11 @@ int send_data_from_ioa_socket_tcp(ioa_socket_handle s, const void *data, size_t
int send_str_from_ioa_socket_tcp(ioa_socket_handle s, const void *data)
{
return send_data_from_ioa_socket_tcp(s, data, strlen(data));
if(data) {
return send_data_from_ioa_socket_tcp(s, data, strlen((const char*)data));
} else {
return 0;
}
}
int send_ulong_from_ioa_socket_tcp(ioa_socket_handle s, size_t data)