Use size_t for lengths in stream objects
Provides safety against them accidentally becoming negative because of bugs in the calculations. Also does the same to CharArray and friends as they were strongly connection to the stream objects.
This commit is contained in:
committed by
Lauri Kasanen
parent
346fccb96c
commit
259f1055cb
@@ -268,24 +268,25 @@ namespace rfb {
|
||||
|
||||
class BinaryParameter : public VoidParameter {
|
||||
public:
|
||||
BinaryParameter(const char* name_, const char* desc_, const void* v, int l,
|
||||
ConfigurationObject co=ConfGlobal);
|
||||
BinaryParameter(const char* name_, const char* desc_,
|
||||
const void* v, size_t l,
|
||||
ConfigurationObject co=ConfGlobal);
|
||||
using VoidParameter::setParam;
|
||||
virtual ~BinaryParameter();
|
||||
virtual bool setParam(const char* value);
|
||||
virtual void setParam(const void* v, int l);
|
||||
virtual void setParam(const void* v, size_t l);
|
||||
virtual char* getDefaultStr() const;
|
||||
virtual char* getValueStr() const;
|
||||
|
||||
// getData() will return length zero if there is no data
|
||||
// NB: data may be set to zero, OR set to a zero-length buffer
|
||||
void getData(void** data, int* length) const;
|
||||
void getData(void** data, size_t* length) const;
|
||||
|
||||
protected:
|
||||
char* value;
|
||||
int length;
|
||||
size_t length;
|
||||
char* def_value;
|
||||
int def_length;
|
||||
size_t def_length;
|
||||
};
|
||||
|
||||
// -=- ParameterIterator
|
||||
|
||||
Reference in New Issue
Block a user