MT#62181 pass strings by reference instead of copy

Reformat spacing a bit as well.

Change-Id: I58dc5877c29eb86ddd7cd362d2e7b71cc0505487
Warned-by: Coverity
mr13.5
Richard Fuchs 1 year ago
parent ebd27d666c
commit cab8463ca5

@ -872,4 +872,4 @@ EXEC_ACTION_START(SCDecryptCodeAes128CBC) {
/* unbase64() uses malloc, don't forget to free() */
free(encryptedCodeRaw);
} EXEC_ACTION_END;
} EXEC_ACTION_END;

@ -95,7 +95,7 @@ struct B2BSipReplyEvent: public B2BSipEvent
string sender_ltag;
B2BSipReplyEvent(const AmSipReply& reply, bool forward,
string trans_method, string sender_ltag)
const string& trans_method, const string& sender_ltag)
: B2BSipEvent(B2BSipReply,forward),
reply(reply), trans_method(trans_method), sender_ltag(sender_ltag)
{ }

@ -5,9 +5,17 @@
#include <fstream>
#include <string.h>
AmConferenceChannel::AmConferenceChannel(AmConferenceStatus* status, int channel_id, string channel_tag, bool own_channel)
: status(status), channel_id(channel_id), channel_tag(channel_tag), own_channel(own_channel),
have_in_sr(false), have_out_sr(false), in_file(NULL), out_file(NULL)
AmConferenceChannel::AmConferenceChannel(AmConferenceStatus* status, int channel_id,
const string& channel_tag, bool own_channel)
:
own_channel(own_channel),
channel_id(channel_id),
channel_tag(channel_tag),
status(status),
have_in_sr(false),
have_out_sr(false),
in_file(NULL),
out_file(NULL)
{
assert(status);
conf_id = status->getConfID();

@ -81,7 +81,7 @@ class AmConferenceChannel: public AmAudio
public:
AmConferenceChannel(AmConferenceStatus* status,
int channel_id, string channel_tag, bool own_channel);
int channel_id, const string& channel_tag, bool own_channel);
~AmConferenceChannel();

@ -48,7 +48,7 @@ public:
QueueEntry(AmEventQueueInterface* q)
: q(q), id() {}
QueueEntry(AmEventQueueInterface* q, string id)
QueueEntry(AmEventQueueInterface* q, const string& id)
: q(q), id(id){}
};

@ -52,8 +52,8 @@ static char* parse_until(char* s, char* end, char c);
static bool contains(char* s, char* next_line, char c);
static bool is_wsp(char s);
static MediaType media_type(std::string media);
static TransProt transport_type(std::string transport);
static MediaType media_type(const std::string& media);
static TransProt transport_type(const std::string& transport);
static bool attr_check(std::string attr);
enum parse_st {SDP_DESCR, SDP_MEDIA};
@ -858,7 +858,7 @@ static void parse_sdp_media(AmSdp* sdp_msg, char* s)
if (next > media_line)
media = string(media_line, int(next-media_line) - 1);
m.type = media_type(std::move(media));
m.type = media_type(media);
if (m.type == MT_NONE) {
ERROR("parse_sdp_media: Unknown media type\n");
@ -1501,7 +1501,7 @@ inline char* skip_till_next_line(char* s, size_t& line_len)
/*
*Check if known media type is used
*/
static MediaType media_type(std::string media)
static MediaType media_type(const std::string& media)
{
if(media == "audio")
return MT_AUDIO;
@ -1519,7 +1519,7 @@ static MediaType media_type(std::string media)
return MT_NONE;
}
static TransProt transport_type(string transport)
static TransProt transport_type(const string& transport)
{
string transport_uc = transport;
std::transform(transport_uc.begin(), transport_uc.end(), transport_uc.begin(), toupper);

@ -203,7 +203,7 @@ public:
int code;
string reason;
string hdrs;
Exception(int c, string r, string h="") : code(c), reason(r), hdrs(h) {}
Exception(int c, const string& r, const string& h="") : code(c), reason(r), hdrs(h) {}
};
/**

Loading…
Cancel
Save