Merge pull request #314 from PhenomRetroShare/Fix_CppCheckerError

Fix error reported by CppChecker:
This commit is contained in:
Cyril Soler 2016-03-20 09:11:55 -04:00
commit c123761f5a
11 changed files with 24 additions and 14 deletions

View File

@ -2844,11 +2844,11 @@ void RsGenExchange::processRecvdGroups()
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
{
delete grp;
erase = true;
#ifdef GEN_EXCH_DEBUG
std::cerr << " max attempts " << VALIDATE_MAX_ATTEMPTS << " reached. Will delete group " << grp->grpId << std::endl;
#endif
delete grp;
erase = true;
}
else
{

View File

@ -1001,7 +1001,7 @@ void p3GxsTunnelService::handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item)
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " DH key computed. Tunnel is now secured!" << std::endl;
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::cerr << std::endl;
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::endl;
std::cerr << " Sending a ACK packet." << std::endl;
#endif

View File

@ -182,6 +182,7 @@ void ContentValue::put(const std::string &key, uint32_t len, const char* value){
mKvData.insert(std::pair<std::string, std::pair<uint32_t, char*> >
(key, std::pair<uint32_t, char*>(len, dest)));
//delete[] dest; //Deleted by clearData()
}
bool ContentValue::getAsBool(const std::string &key, bool& value) const{

View File

@ -572,7 +572,15 @@ static int parse_headers(dearmour_arg_t *arg,ops_error_t **errors,
if(size <= nbuf+1)
{
size+=size+80;
buf=realloc(buf,size);
char *nbuf;
nbuf=realloc(buf,size);
if (nbuf == NULL)
{
free(buf);
rtn=-1;
goto end;
}
buf = nbuf;
}
buf[nbuf++]=c;
}

View File

@ -96,7 +96,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) {
fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi);
@ -115,7 +115,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (remaining < 1024) {
remaining = index.data().toLongLong();
temp.sprintf("%.2f ", remaining / multi);
@ -134,7 +134,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (completed < 1024) {
completed = index.data().toLongLong();
temp.sprintf("%.2f ", completed / multi);

View File

@ -85,7 +85,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) {
fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi);
@ -104,7 +104,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (transferred < 1024) {
transferred = index.data().toLongLong();
temp.sprintf("%.2f ", transferred / multi);

View File

@ -768,7 +768,7 @@ void PeopleDialog::pf_dropEventOccursExt(QDropEvent *event)
QWidget *wid =
qobject_cast<QWidget *>(event->source());//QT5 return QObject
FlowLayout *layout;
FlowLayout *layout = NULL;
if (wid) layout =
qobject_cast<FlowLayout *>(wid->layout());
if (layout) {
@ -858,7 +858,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
QWidget *wid =
qobject_cast<QWidget *>(event->source());//QT5 return QObject
FlowLayout *layout;
FlowLayout *layout = NULL;
if (wid) layout =
qobject_cast<FlowLayout *>(wid->layout());
if (layout) {

View File

@ -177,7 +177,7 @@ void AvatarWidget::refreshStatus()
}
case STATUS_FRAME:
{
uint32_t status ;
uint32_t status = 0;
if(mId.isNotSet())
return ;

View File

@ -802,6 +802,7 @@ bool fill_stream_data(rsctrl::stream::StreamData &data, const RpcStream &stream)
{
std::cerr << "fill_stream_data() Failed to get data. data_size=" << data_size << ", base_loc=" << base_loc << " !";
std::cerr << std::endl;
free(buffer);
return false;
}

View File

@ -147,6 +147,7 @@ void g_string_append_printf(GString* baseString, char* format, ...)
g_string_append(baseString, formattedString);
free(formattedString);
}
va_end(args);
}
void g_string_prepend(GString* baseString, char* prependedString)

View File

@ -187,12 +187,11 @@ bool operator==(const RsTurtleStringSearchRequestItem& it1,const RsTurtleStringS
return false ;
return true ;
}
RsSerialType* init_item(TurtleFileInfo& info)
void init_item(TurtleFileInfo& info)
{
info.hash = RsFileHash("3f753e8ac3b94ab9fddfad94480f747bf4418370");
info.name = "toto.png";
info.size = 0x3392085443897ull ;
return new RsTurtleSerialiser();
}
bool operator==(const TurtleFileInfo& it1,const TurtleFileInfo& it2)
{