Skip to content

Commit

Permalink
Remove Ice::Short
Browse files Browse the repository at this point in the history
  • Loading branch information
externl committed Feb 23, 2024
1 parent bf991f4 commit 52d5a79
Show file tree
Hide file tree
Showing 79 changed files with 209 additions and 211 deletions.
2 changes: 0 additions & 2 deletions cpp/include/Ice/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ namespace Ice

/** The mapping for the Slice byte type. */
typedef unsigned char Byte;
/** The mapping for the Slice short type. */
typedef short Short;
/** The mapping for the Slice float type. */
typedef float Float;
/** The mapping for the Slice double type. */
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,13 @@ class ICE_API InputStream : public IceInternal::Buffer
* Reads a short from the stream.
* @param v The extracted short.
*/
void read(Short& v);
void read(int16_t& v);

/**
* Reads a sequence of shorts from the stream.
* @param v A vector to hold a copy of the short values.
*/
void read(std::vector<Short>& v);
void read(std::vector<std::int16_t>& v);

/**
* Reads a sequence of boolean values from the stream.
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/OutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,14 @@ class ICE_API OutputStream : public IceInternal::Buffer
* Writes a short to the stream.
* @param v The short to write.
*/
void write(Short v);
void write(std::int16_t v);

/**
* Writes a short sequence to the stream.
* @param begin The beginning of the sequence.
* @param end The end of the sequence.
*/
void write(const Short* begin, const Short* end);
void write(const std::int16_t* begin, const std::int16_t* end);

/**
* Writes an int to the stream.
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/Connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ICE_API Connector

virtual TransceiverPtr connect() = 0;

virtual Ice::Short type() const = 0;
virtual std::int16_t type() const = 0;
virtual std::string toString() const = 0;

virtual bool operator==(const Connector&) const = 0;
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/Ice/EndpointFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ IceInternal::EndpointFactoryPlugin::destroy()
}

IceInternal::EndpointFactoryWithUnderlying::EndpointFactoryWithUnderlying(const ProtocolInstancePtr& instance,
Short type) :
int16_t type) :
_instance(instance), _type(type)
{
}
Expand All @@ -63,7 +63,7 @@ IceInternal::EndpointFactoryWithUnderlying::initialize()
}
}

Short
int16_t
IceInternal::EndpointFactoryWithUnderlying::type() const
{
return _instance->type();
Expand Down Expand Up @@ -112,8 +112,8 @@ IceInternal::EndpointFactoryWithUnderlying::clone(const ProtocolInstancePtr& ins
}

IceInternal::UnderlyingEndpointFactory::UnderlyingEndpointFactory(const ProtocolInstancePtr& instance,
Short type,
Short underlying) :
int16_t type,
int16_t underlying) :
_instance(instance), _type(type), _underlying(underlying)
{
}
Expand All @@ -138,7 +138,7 @@ IceInternal::UnderlyingEndpointFactory::initialize()
}
}

Short
int16_t
IceInternal::UnderlyingEndpointFactory::type() const
{
return _instance->type();
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/Ice/EndpointFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ICE_API EndpointFactory
virtual ~EndpointFactory();

virtual void initialize();
virtual Ice::Short type() const = 0;
virtual std::int16_t type() const = 0;
virtual std::string protocol() const = 0;
virtual EndpointIPtr create(std::vector<std::string>&, bool) const = 0;
virtual EndpointIPtr read(Ice::InputStream*) const = 0;
Expand All @@ -46,26 +46,26 @@ class ICE_API EndpointFactoryWithUnderlying : public EndpointFactory
{
public:

EndpointFactoryWithUnderlying(const ProtocolInstancePtr&, Ice::Short);
EndpointFactoryWithUnderlying(const ProtocolInstancePtr&, std::int16_t);

virtual void initialize();
virtual Ice::Short type() const;
virtual std::int16_t type() const;
virtual std::string protocol() const;
virtual EndpointIPtr create(std::vector<std::string>&, bool) const;
virtual EndpointIPtr read(Ice::InputStream*) const;
virtual void destroy();

virtual EndpointFactoryPtr clone(const ProtocolInstancePtr&) const;

virtual EndpointFactoryPtr cloneWithUnderlying(const ProtocolInstancePtr&, Ice::Short) const = 0;
virtual EndpointFactoryPtr cloneWithUnderlying(const ProtocolInstancePtr&, std::int16_t) const = 0;

protected:

virtual EndpointIPtr createWithUnderlying(const EndpointIPtr&, std::vector<std::string>&, bool) const = 0;
virtual EndpointIPtr readWithUnderlying(const EndpointIPtr&, Ice::InputStream*) const = 0;

ProtocolInstancePtr _instance;
const Ice::Short _type;
const std::int16_t _type;
EndpointFactoryPtr _underlying;
};

Expand All @@ -79,10 +79,10 @@ class ICE_API UnderlyingEndpointFactory : public EndpointFactory
{
public:

UnderlyingEndpointFactory(const ProtocolInstancePtr&, Ice::Short, Ice::Short);
UnderlyingEndpointFactory(const ProtocolInstancePtr&, std::int16_t, std::int16_t);

virtual void initialize();
virtual Ice::Short type() const;
virtual std::int16_t type() const;
virtual std::string protocol() const;
virtual EndpointIPtr create(std::vector<std::string>&, bool) const;
virtual EndpointIPtr read(Ice::InputStream*) const;
Expand All @@ -93,8 +93,8 @@ class ICE_API UnderlyingEndpointFactory : public EndpointFactory
private:

ProtocolInstancePtr _instance;
const Ice::Short _type;
const Ice::Short _underlying;
const std::int16_t _type;
const std::int16_t _underlying;
EndpointFactoryPtr _factory;
};

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/EndpointFactoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ IceInternal::EndpointFactoryManager::add(const EndpointFactoryPtr& factory)
}

EndpointFactoryPtr
IceInternal::EndpointFactoryManager::get(Short type) const
IceInternal::EndpointFactoryManager::get(int16_t type) const
{
lock_guard lock(_mutex); // TODO: Necessary?

Expand Down Expand Up @@ -157,7 +157,7 @@ IceInternal::EndpointFactoryManager::create(const string& str, bool oaEndpoint)
EndpointIPtr
IceInternal::EndpointFactoryManager::read(InputStream* s) const
{
Short type;
int16_t type;
s->read(type);

EndpointFactoryPtr factory = get(type);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/EndpointFactoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EndpointFactoryManager
EndpointFactoryManager(const InstancePtr&);
void initialize() const;
void add(const EndpointFactoryPtr&);
EndpointFactoryPtr get(::Ice::Short) const;
EndpointFactoryPtr get(::std::int16_t) const;
EndpointIPtr create(const std::string&, bool) const;
EndpointIPtr read(Ice::InputStream*) const;

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/EndpointI.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ICE_API EndpointI : public Ice::Endpoint
//
// Return the endpoint type.
//
virtual Ice::Short type() const = 0;
virtual std::int16_t type() const = 0;

//
// Return the protocol name
Expand Down Expand Up @@ -160,7 +160,7 @@ template<typename T> class InfoI : public T
T::timeout = _endpoint->timeout();
}

virtual Ice::Short
virtual std::int16_t
type() const noexcept
{
return _endpoint->type();
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/IPEndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ IceInternal::IPEndpointInfoI::~IPEndpointInfoI()
{
}

Ice::Short
int16_t
IceInternal::IPEndpointInfoI::type() const noexcept
{
return _endpoint->type();
Expand All @@ -50,7 +50,7 @@ IceInternal::IPEndpointI::getInfo() const noexcept
return info;
}

Ice::Short
int16_t
IceInternal::IPEndpointI::type() const
{
return _instance->type();
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/IPEndpointI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ICE_API IPEndpointInfoI : public Ice::IPEndpointInfo
IPEndpointInfoI(const EndpointIPtr&);
virtual ~IPEndpointInfoI();

virtual Ice::Short type() const noexcept;
virtual std::int16_t type() const noexcept;
virtual bool datagram() const noexcept;
virtual bool secure() const noexcept;

Expand All @@ -42,7 +42,7 @@ class ICE_API IPEndpointI : public EndpointI, public std::enable_shared_from_thi
void streamWriteImpl(Ice::OutputStream*) const override;

Ice::EndpointInfoPtr getInfo() const noexcept override;
Ice::Short type() const override;
std::int16_t type() const override;
const std::string& protocol() const override;
bool secure() const override;

Expand Down
34 changes: 17 additions & 17 deletions cpp/src/Ice/InputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,16 @@ Ice::InputStream::read(pair<const bool*, const bool*>& v)
}

void
Ice::InputStream::read(Short& v)
Ice::InputStream::read(int16_t& v)
{
if(b.end() - i < static_cast<int>(sizeof(Short)))
if(b.end() - i < static_cast<int>(sizeof(int16_t)))
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Short);
i += sizeof(int16_t);
#ifdef ICE_BIG_ENDIAN
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Short) - 1;
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(int16_t) - 1;
*dest-- = *src++;
*dest = *src;
#else
Expand All @@ -524,22 +524,22 @@ Ice::InputStream::read(Short& v)
}

void
Ice::InputStream::read(vector<Short>& v)
Ice::InputStream::read(vector<int16_t>& v)
{
int32_t sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
int32_t sz = readAndCheckSeqSize(static_cast<int>(sizeof(int16_t)));
if(sz > 0)
{
Container::iterator begin = i;
i += sz * static_cast<int>(sizeof(Short));
i += sz * static_cast<int>(sizeof(int16_t));
v.resize(static_cast<size_t>(sz));
#ifdef ICE_BIG_ENDIAN
const Byte* src = &(*begin);
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(int16_t) - 1;
for(int j = 0 ; j < sz ; ++j)
{
*dest-- = *src++;
*dest-- = *src++;
dest += 2 * sizeof(Short);
dest += 2 * sizeof(int16_t);
}
#else
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
Expand All @@ -554,29 +554,29 @@ Ice::InputStream::read(vector<Short>& v)
void
Ice::InputStream::read(pair<const short*, const short*>& v)
{
int32_t sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
int32_t sz = readAndCheckSeqSize(static_cast<int>(sizeof(int16_t)));
if(sz > 0)
{
#ifdef ICE_UNALIGNED
v.first = reinterpret_cast<Short*>(i);
i += sz * static_cast<int>(sizeof(Short));
v.second = reinterpret_cast<Short*>(i);
v.first = reinterpret_cast<int16_t*>(i);
i += sz * static_cast<int>(sizeof(int16_t));
v.second = reinterpret_cast<int16_t*>(i);
#else
auto result = new short[static_cast<size_t>(sz)];
_deleters.push_back([result] { delete[] result; });
v.first = result;
v.second = result + sz;

Container::iterator begin = i;
i += sz * static_cast<int>(sizeof(Short));
i += sz * static_cast<int>(sizeof(int16_t));
# ifdef ICE_BIG_ENDIAN
const Byte* src = &(*begin);
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Short) - 1;
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(int16_t) - 1;
for(int j = 0 ; j < sz ; ++j)
{
*dest-- = *src++;
*dest-- = *src++;
dest += 2 * sizeof(Short);
dest += 2 * sizeof(int16_t);
}
# else
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
Expand Down Expand Up @@ -1199,7 +1199,7 @@ Ice::InputStream::readEnum(int32_t maxValue)
}
else if(maxValue < 32767)
{
Short value;
int16_t value;
read(value);
return value;
}
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/Ice/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1764,18 +1764,18 @@ IceInternal::Instance::updateThreadObservers()
}

BufSizeWarnInfo
IceInternal::Instance::getBufSizeWarn(Short type)
IceInternal::Instance::getBufSizeWarn(int16_t type)
{
lock_guard lock(_setBufSizeWarnMutex);

return getBufSizeWarnInternal(type);
}

BufSizeWarnInfo
IceInternal::Instance::getBufSizeWarnInternal(Short type)
IceInternal::Instance::getBufSizeWarnInternal(int16_t type)
{
BufSizeWarnInfo info;
map<Short, BufSizeWarnInfo>::iterator p = _setBufSizeWarn.find(type);
map<int16_t, BufSizeWarnInfo>::iterator p = _setBufSizeWarn.find(type);
if(p == _setBufSizeWarn.end())
{
info.sndWarn = false;
Expand All @@ -1792,7 +1792,7 @@ IceInternal::Instance::getBufSizeWarnInternal(Short type)
}

void
IceInternal::Instance::setSndBufSizeWarn(Short type, int size)
IceInternal::Instance::setSndBufSizeWarn(int16_t type, int size)
{
lock_guard lock(_setBufSizeWarnMutex);

Expand All @@ -1803,7 +1803,7 @@ IceInternal::Instance::setSndBufSizeWarn(Short type, int size)
}

void
IceInternal::Instance::setRcvBufSizeWarn(Short type, int size)
IceInternal::Instance::setRcvBufSizeWarn(int16_t type, int size)
{
lock_guard lock(_setBufSizeWarnMutex);

Expand Down
10 changes: 5 additions & 5 deletions cpp/src/Ice/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ class Instance : public std::enable_shared_from_this<Instance>
const Ice::StringConverterPtr& getStringConverter() const { return _stringConverter; }
const Ice::WstringConverterPtr& getWstringConverter() const { return _wstringConverter; }

BufSizeWarnInfo getBufSizeWarn(Ice::Short type);
void setSndBufSizeWarn(Ice::Short type, int size);
void setRcvBufSizeWarn(Ice::Short type, int size);
BufSizeWarnInfo getBufSizeWarn(std::int16_t type);
void setSndBufSizeWarn(std::int16_t type, int size);
void setRcvBufSizeWarn(std::int16_t type, int size);

private:

Expand All @@ -146,7 +146,7 @@ class Instance : public std::enable_shared_from_this<Instance>
void addAllAdminFacets();
void setServerProcessProxy(const Ice::ObjectAdapterPtr&, const Ice::Identity&);

BufSizeWarnInfo getBufSizeWarnInternal(Ice::Short type);
BufSizeWarnInfo getBufSizeWarnInternal(std::int16_t type);

enum State
{
Expand Down Expand Up @@ -192,7 +192,7 @@ class Instance : public std::enable_shared_from_this<Instance>
Ice::Identity _adminIdentity;
std::set<std::string> _adminFacetFilter;
IceInternal::MetricsAdminIPtr _metricsAdmin;
std::map<Ice::Short, BufSizeWarnInfo> _setBufSizeWarn;
std::map<std::int16_t, BufSizeWarnInfo> _setBufSizeWarn;
std::mutex _setBufSizeWarnMutex;
mutable std::recursive_mutex _mutex;
std::condition_variable_any _conditionVariable;
Expand Down
Loading

0 comments on commit 52d5a79

Please sign in to comment.