~ubuntu-branches/debian/stretch/sflphone/stretch

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/pjsip/src/pjsua2/types.cpp

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: types.cpp 4742 2014-02-12 05:18:31Z bennylp $ */
 
2
/*
 
3
 * Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
#include <pjsua2/types.hpp>
 
20
#include "util.hpp"
 
21
 
 
22
using namespace pj;
 
23
using namespace std;
 
24
 
 
25
#define THIS_FILE       "types.cpp"
 
26
 
 
27
///////////////////////////////////////////////////////////////////////////////
 
28
 
 
29
Error::Error()
 
30
: status(PJ_SUCCESS), srcLine(0)
 
31
{
 
32
}
 
33
 
 
34
Error::Error( pj_status_t prm_status,
 
35
              const string &prm_title,
 
36
              const string &prm_reason,
 
37
              const string &prm_src_file,
 
38
              int prm_src_line)
 
39
: status(prm_status), title(prm_title), reason(prm_reason),
 
40
  srcFile(prm_src_file), srcLine(prm_src_line)
 
41
{
 
42
    if (this->status != PJ_SUCCESS && prm_reason.empty()) {
 
43
        char errmsg[PJ_ERR_MSG_SIZE];
 
44
        pj_strerror(this->status, errmsg, sizeof(errmsg));
 
45
        this->reason = errmsg;
 
46
    }
 
47
}
 
48
 
 
49
string Error::info(bool multi_line) const
 
50
{
 
51
    string output;
 
52
 
 
53
    if (status==PJ_SUCCESS) {
 
54
        output = "No error";
 
55
    } else if (!multi_line) {
 
56
        char temp[80];
 
57
 
 
58
        if (!title.empty()) {
 
59
            output += title + " error: ";
 
60
        }
 
61
        snprintf(temp, sizeof(temp), " (status=%d)", status);
 
62
        output += reason + temp;
 
63
        if (!srcFile.empty()) {
 
64
            output += " [";
 
65
            output += srcFile;
 
66
            snprintf(temp, sizeof(temp), ":%d]", srcLine);
 
67
            output += temp;
 
68
        }
 
69
    } else {
 
70
        char temp[80];
 
71
 
 
72
        if (!title.empty()) {
 
73
            output += string("Title:       ") + title + "\n";
 
74
        }
 
75
 
 
76
        snprintf(temp, sizeof(temp), "%d\n", status);
 
77
        output += string("Code:        ") + temp;
 
78
        output += string("Description: ") + reason + "\n";
 
79
        if (!srcFile.empty()) {
 
80
            snprintf(temp, sizeof(temp), ":%d\n", srcLine);
 
81
            output += string("Location:    ") + srcFile + temp;
 
82
        }
 
83
    }
 
84
 
 
85
    return output;
 
86
}
 
87
 
 
88
///////////////////////////////////////////////////////////////////////////////
 
89
 
 
90
void TimeVal::fromPj(const pj_time_val &prm)
 
91
{
 
92
    this->sec  = prm.sec;
 
93
    this->msec = prm.msec;
 
94
}
 
95