Changeset 92:e3a0abb22ef4 in xplra


Ignore:
Timestamp:
09/21/17 17:00:26 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 3 'hg:/home/ivaradi/xplane/hg/xplra' '/'>, 'public')
Message:

C++11 compatibility

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/client/c/hu/varadiistvan/xplra/XPlane.cc

    r87 r92  
    5757using xplra::Protocol;
    5858
    59 using std::auto_ptr;
     59using std::unique_ptr;
    6060using std::string;
    6161using std::min;
     
    149149    if (socket!=0) return;
    150150
    151     auto_ptr<LocalClientSocket> clientSocket(new LocalClientSocket("xplra",
    152                                                                    &waiter));
     151    unique_ptr<LocalClientSocket> clientSocket(new LocalClientSocket("xplra",
     152                                                                     &waiter));
    153153    LocalConnector& connector = clientSocket->getConnector();
    154154
     
    342342    length = getArray(name, Protocol::TYPE_FLOAT_ARRAY, -1, offset);
    343343
    344     auto_ptr<float> data(new float[length]);
     344    unique_ptr<float[]> data(new float[length]);
    345345    if (!stream->read(data.get(), length*sizeof(float))) checkStream();
    346346    return data.release();
     
    366366    length = getArray(name, Protocol::TYPE_INT_ARRAY, -1, offset);
    367367
    368     auto_ptr<int32_t> data(new int32_t[length]);
     368    unique_ptr<int32_t[]> data(new int32_t[length]);
    369369    if (!stream->read(data.get(), length*sizeof(int32_t))) checkStream();
    370370    return data.release();
     
    390390    length = getArray(name, Protocol::TYPE_BYTE_ARRAY, -1, offset);
    391391
    392     auto_ptr<uint8_t> data(new uint8_t[length]);
     392    unique_ptr<uint8_t[]> data(new uint8_t[length]);
    393393    if (!stream->read(data.get(), length*sizeof(uint8_t))) checkStream();
    394394    return data.release();
     
    400400{
    401401    size_t length = 0;
    402     auto_ptr<uint8_t> data(getByteArray(name, length, offset));
     402    unique_ptr<uint8_t[]> data(getByteArray(name, length, offset));
    403403    return string(reinterpret_cast<char*>(data.get()));
    404404}
     
    498498                     length, offset);
    499499    } else {
    500         auto_ptr<uint8_t> buffer(new uint8_t[length]);
     500        unique_ptr<uint8_t[]> buffer(new uint8_t[length]);
    501501        memcpy(buffer.get(), value, valueLength);
    502502        memset(buffer.get() + valueLength, 0, length - valueLength);
  • src/client/c/hu/varadiistvan/xplra/xplra.cc

    r87 r92  
    5959using std::vector;
    6060using std::set;
    61 using std::auto_ptr;
     61using std::unique_ptr;
    6262
    6363//------------------------------------------------------------------------------
     
    488488{
    489489    try {
    490         auto_ptr<Connection> connection(new Connection());
     490        unique_ptr<Connection> connection(new Connection());
    491491        connection->connect();
    492492        return ConnectionSlot::addValue(connection.release());
     
    498498//------------------------------------------------------------------------------
    499499
    500 extern "C"int xplra_get_versions(int connectionID,
    501                                  int* xplaneVersion, int* xplmVersion,
    502                                  int* xplraVersion)
     500extern "C" int xplra_get_versions(int connectionID,
     501                                  int* xplaneVersion, int* xplmVersion,
     502                                  int* xplraVersion)
    503503{
    504504    Connection* connection = ConnectionSlot::getValue(connectionID);
  • src/plugin/src/xplra/MessageWindow.h

    r51 r92  
    9898     * started to be scrolled, if it should be scrolled.
    9999     */
    100     static const float scrollTimeout = 1.0;
     100    static constexpr float scrollTimeout = 1.0;
    101101
    102102    /**
    103103     * The amount of time in seconds between each character step.
    104104     */
    105     static const float scrollInterval = 0.1;
     105    static constexpr float scrollInterval = 0.1;
    106106
    107107private:
  • src/plugin/src/xplra/Protocol.h

    r81 r92  
    259259     * The maximal message duration
    260260     */
    261     static const float MAX_MESSAGE_DURATION = 5*60;
     261    static constexpr float MAX_MESSAGE_DURATION = 5*60;
    262262
    263263    /**
  • src/plugin/src/xplra/RequestQueue.h

    r13 r92  
    7676     * The interval of the flight loop.
    7777     */
    78     static const float flightLoopInterval = 0.1;
     78    static constexpr float flightLoopInterval = 0.1;
    7979#endif
    8080
Note: See TracChangeset for help on using the changeset viewer.