Replace PN_int/uint types with stdint.h types, since all compilers we support have them.

Plus, we already had code that relied on them being available anyway.
This commit is contained in:
rdb 2016-05-11 00:27:58 +02:00
parent ce29ae490d
commit 18874fa151
130 changed files with 1398 additions and 1431 deletions

View File

@ -1550,7 +1550,7 @@ YY_RULE_SETUP
dcyylval.u.uint64 = 0;
const char *p = dcyytext;
while (*p != '\0') {
PN_uint64 next_value = dcyylval.u.uint64 * 10;
uint64_t next_value = dcyylval.u.uint64 * 10;
if (next_value < dcyylval.u.uint64) {
dcyyerror("Number out of range.");
dcyylval.u.uint64 = 1;
@ -1583,9 +1583,9 @@ YY_RULE_SETUP
++p;
}
PN_uint64 value = 0;
uint64_t value = 0;
while (*p != '\0') {
PN_uint64 next_value = value * 10;
uint64_t next_value = value * 10;
if (next_value < value) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
@ -1597,13 +1597,13 @@ YY_RULE_SETUP
}
if (neg) {
dcyylval.u.int64 = -(PN_int64)value;
dcyylval.u.int64 = -(int64_t)value;
if (dcyylval.u.int64 > 0) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
}
} else {
dcyylval.u.int64 = (PN_int64)value;
dcyylval.u.int64 = (int64_t)value;
if (dcyylval.u.int64 < 0) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
@ -1625,7 +1625,7 @@ YY_RULE_SETUP
dcyylval.u.uint64 = 0;
const char *p = dcyytext + 2;
while (*p != '\0') {
PN_uint64 next_value = dcyylval.u.uint64 * 16;
uint64_t next_value = dcyylval.u.uint64 * 16;
if (next_value < dcyylval.u.uint64) {
dcyyerror("Number out of range.");
dcyylval.u.uint64 = 1;

View File

@ -612,7 +612,7 @@ REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
dcyylval.u.uint64 = 0;
const char *p = dcyytext;
while (*p != '\0') {
PN_uint64 next_value = dcyylval.u.uint64 * 10;
uint64_t next_value = dcyylval.u.uint64 * 10;
if (next_value < dcyylval.u.uint64) {
dcyyerror("Number out of range.");
dcyylval.u.uint64 = 1;
@ -642,9 +642,9 @@ REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
++p;
}
PN_uint64 value = 0;
uint64_t value = 0;
while (*p != '\0') {
PN_uint64 next_value = value * 10;
uint64_t next_value = value * 10;
if (next_value < value) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
@ -656,13 +656,13 @@ REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
}
if (neg) {
dcyylval.u.int64 = -(PN_int64)value;
dcyylval.u.int64 = -(int64_t)value;
if (dcyylval.u.int64 > 0) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
}
} else {
dcyylval.u.int64 = (PN_int64)value;
dcyylval.u.int64 = (int64_t)value;
if (dcyylval.u.int64 < 0) {
dcyyerror("Number out of range.");
dcyylval.u.int64 = 1;
@ -681,7 +681,7 @@ REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
dcyylval.u.uint64 = 0;
const char *p = dcyytext + 2;
while (*p != '\0') {
PN_uint64 next_value = dcyylval.u.uint64 * 16;
uint64_t next_value = dcyylval.u.uint64 * 16;
if (next_value < dcyylval.u.uint64) {
dcyyerror("Number out of range.");
dcyylval.u.uint64 = 1;

View File

@ -71,8 +71,8 @@ private:
typedef DCNumericRange<int> DCIntRange;
typedef DCNumericRange<unsigned int> DCUnsignedIntRange;
typedef DCNumericRange<PN_int64> DCInt64Range;
typedef DCNumericRange<PN_uint64> DCUnsignedInt64Range;
typedef DCNumericRange<int64_t> DCInt64Range;
typedef DCNumericRange<uint64_t> DCUnsignedInt64Range;
typedef DCNumericRange<double> DCDoubleRange;
#endif

View File

@ -178,7 +178,7 @@ pack_uint(unsigned int value) {
* Packs the indicated numeric or string value into the stream.
*/
INLINE void DCPacker::
pack_int64(PN_int64 value) {
pack_int64(int64_t value) {
nassertv(_mode == M_pack || _mode == M_repack);
if (_current_field == NULL) {
_pack_error = true;
@ -192,7 +192,7 @@ pack_int64(PN_int64 value) {
* Packs the indicated numeric or string value into the stream.
*/
INLINE void DCPacker::
pack_uint64(PN_uint64 value) {
pack_uint64(uint64_t value) {
nassertv(_mode == M_pack || _mode == M_repack);
if (_current_field == NULL) {
_pack_error = true;
@ -291,9 +291,9 @@ unpack_uint() {
/**
* Unpacks the current numeric or string value from the stream.
*/
INLINE PN_int64 DCPacker::
INLINE int64_t DCPacker::
unpack_int64() {
PN_int64 value = 0;
int64_t value = 0;
nassertr(_mode == M_unpack, value);
if (_current_field == NULL) {
_pack_error = true;
@ -310,9 +310,9 @@ unpack_int64() {
/**
* Unpacks the current numeric or string value from the stream.
*/
INLINE PN_uint64 DCPacker::
INLINE uint64_t DCPacker::
unpack_uint64() {
PN_uint64 value = 0;
uint64_t value = 0;
nassertr(_mode == M_unpack, value);
if (_current_field == NULL) {
_pack_error = true;
@ -409,7 +409,7 @@ unpack_uint(unsigned int &value) {
* Unpacks the current numeric or string value from the stream.
*/
INLINE void DCPacker::
unpack_int64(PN_int64 &value) {
unpack_int64(int64_t &value) {
nassertv(_mode == M_unpack);
if (_current_field == NULL) {
_pack_error = true;
@ -425,7 +425,7 @@ unpack_int64(PN_int64 &value) {
* Unpacks the current numeric or string value from the stream.
*/
INLINE void DCPacker::
unpack_uint64(PN_uint64 &value) {
unpack_uint64(uint64_t &value) {
nassertv(_mode == M_unpack);
if (_current_field == NULL) {
_pack_error = true;
@ -668,7 +668,7 @@ raw_pack_int32(int value) {
* Packs the data into the buffer between packing sessions.
*/
INLINE void DCPacker::
raw_pack_int64(PN_int64 value) {
raw_pack_int64(int64_t value) {
nassertv(_mode == M_idle);
DCPackerInterface::do_pack_int64(_pack_data.get_write_pointer(8), value);
}
@ -704,7 +704,7 @@ raw_pack_uint32(unsigned int value) {
* Packs the data into the buffer between packing sessions.
*/
INLINE void DCPacker::
raw_pack_uint64(PN_uint64 value) {
raw_pack_uint64(uint64_t value) {
nassertv(_mode == M_idle);
DCPackerInterface::do_pack_uint64(_pack_data.get_write_pointer(8), value);
}
@ -761,9 +761,9 @@ raw_unpack_int32() {
/**
* Unpacks the data from the buffer between unpacking sessions.
*/
INLINE PN_int64 DCPacker::
INLINE int64_t DCPacker::
raw_unpack_int64() {
PN_int64 value = 0;
int64_t value = 0;
raw_unpack_int64(value);
return value;
}
@ -843,9 +843,9 @@ raw_unpack_uint32() {
/**
* Unpacks the data from the buffer between unpacking sessions.
*/
INLINE PN_uint64 DCPacker::
INLINE uint64_t DCPacker::
raw_unpack_uint64() {
PN_uint64 value = 0;
uint64_t value = 0;
raw_unpack_uint64(value);
return value;
}
@ -874,7 +874,7 @@ raw_unpack_string() {
* Unpacks the data from the buffer between unpacking sessions.
*/
INLINE void DCPacker::
raw_unpack_int64(PN_int64 &value) {
raw_unpack_int64(int64_t &value) {
nassertv(_mode == M_idle && _unpack_data != NULL);
if (_unpack_p + 8 > _unpack_length) {
_pack_error = true;
@ -930,7 +930,7 @@ raw_unpack_uint32(unsigned int &value) {
* Unpacks the data from the buffer between unpacking sessions.
*/
INLINE void DCPacker::
raw_unpack_uint64(PN_uint64 &value) {
raw_unpack_uint64(uint64_t &value) {
nassertv(_mode == M_idle && _unpack_data != NULL);
if (_unpack_p + 8 > _unpack_length) {
_pack_error = true;

View File

@ -858,14 +858,14 @@ unpack_object() {
case PT_int64:
{
PN_int64 value = unpack_int64();
int64_t value = unpack_int64();
object = PyLong_FromLongLong(value);
}
break;
case PT_uint64:
{
PN_uint64 value = unpack_uint64();
uint64_t value = unpack_uint64();
object = PyLong_FromUnsignedLongLong(value);
}
break;

View File

@ -72,8 +72,8 @@ PUBLISHED:
INLINE void pack_double(double value);
INLINE void pack_int(int value);
INLINE void pack_uint(unsigned int value);
INLINE void pack_int64(PN_int64 value);
INLINE void pack_uint64(PN_uint64 value);
INLINE void pack_int64(int64_t value);
INLINE void pack_uint64(uint64_t value);
INLINE void pack_string(const string &value);
INLINE void pack_literal_value(const string &value);
void pack_default_value();
@ -81,8 +81,8 @@ PUBLISHED:
INLINE double unpack_double();
INLINE int unpack_int();
INLINE unsigned int unpack_uint();
INLINE PN_int64 unpack_int64();
INLINE PN_uint64 unpack_uint64();
INLINE int64_t unpack_int64();
INLINE uint64_t unpack_uint64();
INLINE string unpack_string();
INLINE string unpack_literal_value();
void unpack_validate();
@ -94,8 +94,8 @@ public:
INLINE void unpack_double(double &value);
INLINE void unpack_int(int &value);
INLINE void unpack_uint(unsigned int &value);
INLINE void unpack_int64(PN_int64 &value);
INLINE void unpack_uint64(PN_uint64 &value);
INLINE void unpack_int64(int64_t &value);
INLINE void unpack_uint64(uint64_t &value);
INLINE void unpack_string(string &value);
INLINE void unpack_literal_value(string &value);
@ -141,11 +141,11 @@ PUBLISHED:
INLINE void raw_pack_int8(int value);
INLINE void raw_pack_int16(int value);
INLINE void raw_pack_int32(int value);
INLINE void raw_pack_int64(PN_int64 value);
INLINE void raw_pack_int64(int64_t value);
INLINE void raw_pack_uint8(unsigned int value);
INLINE void raw_pack_uint16(unsigned int value);
INLINE void raw_pack_uint32(unsigned int value);
INLINE void raw_pack_uint64(PN_uint64 value);
INLINE void raw_pack_uint64(uint64_t value);
INLINE void raw_pack_float64(double value);
INLINE void raw_pack_string(const string &value);
@ -158,11 +158,11 @@ PUBLISHED:
INLINE int raw_unpack_int8();
INLINE int raw_unpack_int16();
INLINE int raw_unpack_int32();
INLINE PN_int64 raw_unpack_int64();
INLINE int64_t raw_unpack_int64();
INLINE unsigned int raw_unpack_uint8();
INLINE unsigned int raw_unpack_uint16();
INLINE unsigned int raw_unpack_uint32();
INLINE PN_uint64 raw_unpack_uint64();
INLINE uint64_t raw_unpack_uint64();
INLINE double raw_unpack_float64();
INLINE string raw_unpack_string();
@ -170,11 +170,11 @@ public:
INLINE void raw_unpack_int8(int &value);
INLINE void raw_unpack_int16(int &value);
INLINE void raw_unpack_int32(int &value);
INLINE void raw_unpack_int64(PN_int64 &value);
INLINE void raw_unpack_int64(int64_t &value);
INLINE void raw_unpack_uint8(unsigned int &value);
INLINE void raw_unpack_uint16(unsigned int &value);
INLINE void raw_unpack_uint32(unsigned int &value);
INLINE void raw_unpack_uint64(PN_uint64 &value);
INLINE void raw_unpack_uint64(uint64_t &value);
INLINE void raw_unpack_float64(double &value);
INLINE void raw_unpack_string(string &value);

View File

@ -142,7 +142,7 @@ do_pack_int32(char *buffer, int value) {
*
*/
INLINE void DCPackerInterface::
do_pack_int64(char *buffer, PN_int64 value) {
do_pack_int64(char *buffer, int64_t value) {
buffer[0] = (char)(value & 0xff);
buffer[1] = (char)((value >> 8) & 0xff);
buffer[2] = (char)((value >> 16) & 0xff);
@ -185,7 +185,7 @@ do_pack_uint32(char *buffer, unsigned int value) {
*
*/
INLINE void DCPackerInterface::
do_pack_uint64(char *buffer, PN_uint64 value) {
do_pack_uint64(char *buffer, uint64_t value) {
buffer[0] = (char)(value & 0xff);
buffer[1] = (char)((value >> 8) & 0xff);
buffer[2] = (char)((value >> 16) & 0xff);
@ -244,16 +244,16 @@ do_unpack_int32(const char *buffer) {
/**
*
*/
INLINE PN_int64 DCPackerInterface::
INLINE int64_t DCPackerInterface::
do_unpack_int64(const char *buffer) {
return (PN_int64)((PN_uint64)(unsigned char)buffer[0] |
((PN_uint64)(unsigned char)buffer[1] << 8) |
((PN_uint64)(unsigned char)buffer[2] << 16) |
((PN_uint64)(unsigned char)buffer[3] << 24) |
((PN_uint64)(unsigned char)buffer[4] << 32) |
((PN_uint64)(unsigned char)buffer[5] << 40) |
((PN_uint64)(unsigned char)buffer[6] << 48) |
((PN_int64)(signed char)buffer[7] << 54));
return (int64_t)((uint64_t)(unsigned char)buffer[0] |
((uint64_t)(unsigned char)buffer[1] << 8) |
((uint64_t)(unsigned char)buffer[2] << 16) |
((uint64_t)(unsigned char)buffer[3] << 24) |
((uint64_t)(unsigned char)buffer[4] << 32) |
((uint64_t)(unsigned char)buffer[5] << 40) |
((uint64_t)(unsigned char)buffer[6] << 48) |
((int64_t)(signed char)buffer[7] << 54));
}
/**
*
@ -286,16 +286,16 @@ do_unpack_uint32(const char *buffer) {
/**
*
*/
INLINE PN_uint64 DCPackerInterface::
INLINE uint64_t DCPackerInterface::
do_unpack_uint64(const char *buffer) {
return ((PN_uint64)(unsigned char)buffer[0] |
((PN_uint64)(unsigned char)buffer[1] << 8) |
((PN_uint64)(unsigned char)buffer[2] << 16) |
((PN_uint64)(unsigned char)buffer[3] << 24) |
((PN_uint64)(unsigned char)buffer[4] << 32) |
((PN_uint64)(unsigned char)buffer[5] << 40) |
((PN_uint64)(unsigned char)buffer[6] << 48) |
((PN_int64)(signed char)buffer[7] << 54));
return ((uint64_t)(unsigned char)buffer[0] |
((uint64_t)(unsigned char)buffer[1] << 8) |
((uint64_t)(unsigned char)buffer[2] << 16) |
((uint64_t)(unsigned char)buffer[3] << 24) |
((uint64_t)(unsigned char)buffer[4] << 32) |
((uint64_t)(unsigned char)buffer[5] << 40) |
((uint64_t)(unsigned char)buffer[6] << 48) |
((int64_t)(signed char)buffer[7] << 54));
}
@ -342,8 +342,8 @@ validate_int_limits(int value, int num_bits, bool &range_error) {
* true if it does not.
*/
INLINE void DCPackerInterface::
validate_int64_limits(PN_int64 value, int num_bits, bool &range_error) {
PN_int64 mask = ((PN_int64)1 << (num_bits - 1)) - 1;
validate_int64_limits(int64_t value, int num_bits, bool &range_error) {
int64_t mask = ((int64_t)1 << (num_bits - 1)) - 1;
value |= mask;
if (value != mask && value != -1) {
@ -373,8 +373,8 @@ validate_uint_limits(unsigned int value, int num_bits, bool &range_error) {
* range_error true if it does not.
*/
INLINE void DCPackerInterface::
validate_uint64_limits(PN_uint64 value, int num_bits, bool &range_error) {
PN_uint64 mask = ((PN_uint64)1 << num_bits) - 1;
validate_uint64_limits(uint64_t value, int num_bits, bool &range_error) {
uint64_t mask = ((uint64_t)1 << num_bits) - 1;
value &= ~mask;
if (value != 0) {

View File

@ -226,7 +226,7 @@ pack_uint(DCPackData &, unsigned int, bool &pack_error, bool &) const {
* Packs the indicated numeric or string value into the stream.
*/
void DCPackerInterface::
pack_int64(DCPackData &, PN_int64, bool &pack_error, bool &) const {
pack_int64(DCPackData &, int64_t, bool &pack_error, bool &) const {
pack_error = true;
}
@ -234,7 +234,7 @@ pack_int64(DCPackData &, PN_int64, bool &pack_error, bool &) const {
* Packs the indicated numeric or string value into the stream.
*/
void DCPackerInterface::
pack_uint64(DCPackData &, PN_uint64, bool &pack_error, bool &) const {
pack_uint64(DCPackData &, uint64_t, bool &pack_error, bool &) const {
pack_error = true;
}
@ -284,7 +284,7 @@ unpack_uint(const char *, size_t, size_t &, unsigned int &, bool &pack_error, bo
* Unpacks the current numeric or string value from the stream.
*/
void DCPackerInterface::
unpack_int64(const char *, size_t, size_t &, PN_int64 &, bool &pack_error, bool &) const {
unpack_int64(const char *, size_t, size_t &, int64_t &, bool &pack_error, bool &) const {
pack_error = true;
}
@ -292,7 +292,7 @@ unpack_int64(const char *, size_t, size_t &, PN_int64 &, bool &pack_error, bool
* Unpacks the current numeric or string value from the stream.
*/
void DCPackerInterface::
unpack_uint64(const char *, size_t, size_t &, PN_uint64 &, bool &pack_error, bool &) const {
unpack_uint64(const char *, size_t, size_t &, uint64_t &, bool &pack_error, bool &) const {
pack_error = true;
}

View File

@ -107,9 +107,9 @@ public:
bool &pack_error, bool &range_error) const;
virtual void pack_uint(DCPackData &pack_data, unsigned int value,
bool &pack_error, bool &range_error) const;
virtual void pack_int64(DCPackData &pack_data, PN_int64 value,
virtual void pack_int64(DCPackData &pack_data, int64_t value,
bool &pack_error, bool &range_error) const;
virtual void pack_uint64(DCPackData &pack_data, PN_uint64 value,
virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
bool &pack_error, bool &range_error) const;
virtual void pack_string(DCPackData &pack_data, const string &value,
bool &pack_error, bool &range_error) const;
@ -122,9 +122,9 @@ public:
virtual void unpack_uint(const char *data, size_t length, size_t &p,
unsigned int &value, bool &pack_error, bool &range_error) const;
virtual void unpack_int64(const char *data, size_t length, size_t &p,
PN_int64 &value, bool &pack_error, bool &range_error) const;
int64_t &value, bool &pack_error, bool &range_error) const;
virtual void unpack_uint64(const char *data, size_t length, size_t &p,
PN_uint64 &value, bool &pack_error, bool &range_error) const;
uint64_t &value, bool &pack_error, bool &range_error) const;
virtual void unpack_string(const char *data, size_t length, size_t &p,
string &value, bool &pack_error, bool &range_error) const;
virtual bool unpack_validate(const char *data, size_t length, size_t &p,
@ -138,30 +138,30 @@ public:
INLINE static void do_pack_int8(char *buffer, int value);
INLINE static void do_pack_int16(char *buffer, int value);
INLINE static void do_pack_int32(char *buffer, int value);
INLINE static void do_pack_int64(char *buffer, PN_int64 value);
INLINE static void do_pack_int64(char *buffer, int64_t value);
INLINE static void do_pack_uint8(char *buffer, unsigned int value);
INLINE static void do_pack_uint16(char *buffer, unsigned int value);
INLINE static void do_pack_uint32(char *buffer, unsigned int value);
INLINE static void do_pack_uint64(char *buffer, PN_uint64 value);
INLINE static void do_pack_uint64(char *buffer, uint64_t value);
INLINE static void do_pack_float64(char *buffer, double value);
INLINE static int do_unpack_int8(const char *buffer);
INLINE static int do_unpack_int16(const char *buffer);
INLINE static int do_unpack_int32(const char *buffer);
INLINE static PN_int64 do_unpack_int64(const char *buffer);
INLINE static int64_t do_unpack_int64(const char *buffer);
INLINE static unsigned int do_unpack_uint8(const char *buffer);
INLINE static unsigned int do_unpack_uint16(const char *buffer);
INLINE static unsigned int do_unpack_uint32(const char *buffer);
INLINE static PN_uint64 do_unpack_uint64(const char *buffer);
INLINE static uint64_t do_unpack_uint64(const char *buffer);
INLINE static double do_unpack_float64(const char *buffer);
INLINE static void validate_int_limits(int value, int num_bits,
bool &range_error);
INLINE static void validate_int64_limits(PN_int64 value, int num_bits,
INLINE static void validate_int64_limits(int64_t value, int num_bits,
bool &range_error);
INLINE static void validate_uint_limits(unsigned int value, int num_bits,
bool &range_error);
INLINE static void validate_uint64_limits(PN_uint64 value, int num_bits,
INLINE static void validate_uint64_limits(uint64_t value, int num_bits,
bool &range_error);
const DCPackerCatalog *get_catalog() const;

View File

@ -48,8 +48,8 @@ public:
union U {
int s_int;
unsigned int s_uint;
PN_int64 int64;
PN_uint64 uint64;
int64_t int64;
uint64_t uint64;
double real;
bool flag;
DCClass *dclass;

View File

@ -313,7 +313,7 @@ set_modulus(double modulus) {
bool range_error = false;
_double_modulus = modulus * _divisor;
_uint64_modulus = (PN_uint64)floor(_double_modulus + 0.5);
_uint64_modulus = (uint64_t)floor(_double_modulus + 0.5);
_uint_modulus = (unsigned int)_uint64_modulus;
// Check the range. The legitimate range for a modulus value is 1 through
@ -413,8 +413,8 @@ set_range(const DCDoubleRange &range) {
case ST_int8array:
_int_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_int64_limits(min, 8, range_error);
validate_int64_limits(max, 8, range_error);
_int_range.add_range((int)min, (int)max);
@ -425,8 +425,8 @@ set_range(const DCDoubleRange &range) {
case ST_int16array:
_int_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_int64_limits(min, 16, range_error);
validate_int64_limits(max, 16, range_error);
_int_range.add_range((int)min, (int)max);
@ -437,8 +437,8 @@ set_range(const DCDoubleRange &range) {
case ST_int32array:
_int_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_int64_limits(min, 32, range_error);
validate_int64_limits(max, 32, range_error);
_int_range.add_range((int)min, (int)max);
@ -448,8 +448,8 @@ set_range(const DCDoubleRange &range) {
case ST_int64:
_int64_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
_int64_range.add_range(min, max);
}
break;
@ -459,8 +459,8 @@ set_range(const DCDoubleRange &range) {
case ST_uint8array:
_uint_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_uint64_limits(min, 8, range_error);
validate_uint64_limits(max, 8, range_error);
_uint_range.add_range((unsigned int)min, (unsigned int)max);
@ -471,8 +471,8 @@ set_range(const DCDoubleRange &range) {
case ST_uint16array:
_uint_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_uint64_limits(min, 16, range_error);
validate_uint64_limits(max, 16, range_error);
_uint_range.add_range((unsigned int)min, (unsigned int)max);
@ -483,8 +483,8 @@ set_range(const DCDoubleRange &range) {
case ST_uint32array:
_uint_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_uint64_limits(min, 32, range_error);
validate_uint64_limits(max, 32, range_error);
_uint_range.add_range((unsigned int)min, (unsigned int)max);
@ -494,8 +494,8 @@ set_range(const DCDoubleRange &range) {
case ST_uint64:
_uint64_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
_uint64_range.add_range(min, max);
}
break;
@ -513,8 +513,8 @@ set_range(const DCDoubleRange &range) {
case ST_blob:
_uint_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_uint64_limits(min, 16, range_error);
validate_uint64_limits(max, 16, range_error);
_uint_range.add_range((unsigned int)min, (unsigned int)max);
@ -536,8 +536,8 @@ set_range(const DCDoubleRange &range) {
case ST_blob32:
_uint_range.clear();
for (i = 0; i < num_ranges; i++) {
PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
validate_uint64_limits(min, 32, range_error);
validate_uint64_limits(max, 32, range_error);
_uint_range.add_range((unsigned int)min, (unsigned int)max);
@ -634,7 +634,7 @@ pack_double(DCPackData &pack_data, double value,
case ST_int64:
{
PN_int64 int64_value = (PN_int64)floor(real_value + 0.5);
int64_t int64_value = (int64_t)floor(real_value + 0.5);
_int64_range.validate(int64_value, range_error);
do_pack_int64(pack_data.get_write_pointer(8), int64_value);
}
@ -669,7 +669,7 @@ pack_double(DCPackData &pack_data, double value,
case ST_uint64:
{
PN_uint64 int64_value = (PN_uint64)floor(real_value + 0.5);
uint64_t int64_value = (uint64_t)floor(real_value + 0.5);
_uint64_range.validate(int64_value, range_error);
do_pack_uint64(pack_data.get_write_pointer(8), int64_value);
}
@ -696,7 +696,7 @@ pack_int(DCPackData &pack_data, int value,
if (value != 0 && (int_value / value) != (int)_divisor) {
// If we've experienced overflow after applying the divisor, pack it as an
// int64 instead.
pack_int64(pack_data, (PN_int64)value, pack_error, range_error);
pack_int64(pack_data, (int64_t)value, pack_error, range_error);
return;
}
@ -859,9 +859,9 @@ pack_uint(DCPackData &pack_data, unsigned int value,
* Packs the indicated numeric or string value into the stream.
*/
void DCSimpleParameter::
pack_int64(DCPackData &pack_data, PN_int64 value,
pack_int64(DCPackData &pack_data, int64_t value,
bool &pack_error, bool &range_error) const {
PN_int64 int_value = value * _divisor;
int64_t int_value = value * _divisor;
if (_has_modulus && _uint64_modulus != 0) {
if (int_value < 0) {
int_value = _uint64_modulus - 1 - (-int_value - 1) % _uint64_modulus;
@ -899,35 +899,35 @@ pack_int64(DCPackData &pack_data, PN_int64 value,
if (int_value < 0) {
range_error = true;
}
_uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
validate_uint64_limits((PN_uint64)int_value, 8, range_error);
do_pack_uint8(pack_data.get_write_pointer(1), (unsigned int)(PN_uint64)int_value);
_uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
validate_uint64_limits((uint64_t)int_value, 8, range_error);
do_pack_uint8(pack_data.get_write_pointer(1), (unsigned int)(uint64_t)int_value);
break;
case ST_uint16:
if (int_value < 0) {
range_error = true;
}
_uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
validate_uint64_limits((PN_uint64)int_value, 16, range_error);
do_pack_uint16(pack_data.get_write_pointer(2), (unsigned int)(PN_uint64)int_value);
_uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
validate_uint64_limits((uint64_t)int_value, 16, range_error);
do_pack_uint16(pack_data.get_write_pointer(2), (unsigned int)(uint64_t)int_value);
break;
case ST_uint32:
if (int_value < 0) {
range_error = true;
}
_uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
validate_uint64_limits((PN_uint64)int_value, 32, range_error);
do_pack_uint32(pack_data.get_write_pointer(4), (unsigned int)(PN_uint64)int_value);
_uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
validate_uint64_limits((uint64_t)int_value, 32, range_error);
do_pack_uint32(pack_data.get_write_pointer(4), (unsigned int)(uint64_t)int_value);
break;
case ST_uint64:
if (int_value < 0) {
range_error = true;
}
_uint64_range.validate((PN_uint64)int_value, range_error);
do_pack_uint64(pack_data.get_write_pointer(8), (PN_uint64)int_value);
_uint64_range.validate((uint64_t)int_value, range_error);
do_pack_uint64(pack_data.get_write_pointer(8), (uint64_t)int_value);
break;
case ST_float64:
@ -944,47 +944,47 @@ pack_int64(DCPackData &pack_data, PN_int64 value,
* Packs the indicated numeric or string value into the stream.
*/
void DCSimpleParameter::
pack_uint64(DCPackData &pack_data, PN_uint64 value,
pack_uint64(DCPackData &pack_data, uint64_t value,
bool &pack_error, bool &range_error) const {
PN_uint64 int_value = value * _divisor;
uint64_t int_value = value * _divisor;
if (_has_modulus && _uint64_modulus != 0) {
int_value = int_value % _uint64_modulus;
}
switch (_type) {
case ST_int8:
if ((PN_int64)int_value < 0) {
if ((int64_t)int_value < 0) {
range_error = true;
}
_int_range.validate((int)(PN_int64)int_value, range_error);
validate_int64_limits((PN_int64)int_value, 8, range_error);
do_pack_int8(pack_data.get_write_pointer(1), (int)(PN_int64)int_value);
_int_range.validate((int)(int64_t)int_value, range_error);
validate_int64_limits((int64_t)int_value, 8, range_error);
do_pack_int8(pack_data.get_write_pointer(1), (int)(int64_t)int_value);
break;
case ST_int16:
if ((PN_int64)int_value < 0) {
if ((int64_t)int_value < 0) {
range_error = true;
}
_int_range.validate((int)(PN_int64)int_value, range_error);
validate_int64_limits((PN_int64)int_value, 16, range_error);
do_pack_int16(pack_data.get_write_pointer(2), (int)(PN_int64)int_value);
_int_range.validate((int)(int64_t)int_value, range_error);
validate_int64_limits((int64_t)int_value, 16, range_error);
do_pack_int16(pack_data.get_write_pointer(2), (int)(int64_t)int_value);
break;
case ST_int32:
if ((PN_int64)int_value < 0) {
if ((int64_t)int_value < 0) {
range_error = true;
}
_int_range.validate((int)(PN_int64)int_value, range_error);
validate_int64_limits((PN_int64)int_value, 32, range_error);
do_pack_int32(pack_data.get_write_pointer(4), (int)(PN_int64)int_value);
_int_range.validate((int)(int64_t)int_value, range_error);
validate_int64_limits((int64_t)int_value, 32, range_error);
do_pack_int32(pack_data.get_write_pointer(4), (int)(int64_t)int_value);
break;
case ST_int64:
if ((PN_int64)int_value < 0) {
if ((int64_t)int_value < 0) {
range_error = true;
}
_int64_range.validate((PN_int64)int_value, range_error);
do_pack_int64(pack_data.get_write_pointer(8), (PN_int64)int_value);
_int64_range.validate((int64_t)int_value, range_error);
do_pack_int64(pack_data.get_write_pointer(8), (int64_t)int_value);
break;
case ST_char:
@ -1213,7 +1213,7 @@ unpack_double(const char *data, size_t length, size_t &p, double &value,
pack_error = true;
return;
}
PN_int64 int_value = do_unpack_int64(data + p);
int64_t int_value = do_unpack_int64(data + p);
_int64_range.validate(int_value, range_error);
value = (double)int_value;
p += 8;
@ -1266,7 +1266,7 @@ unpack_double(const char *data, size_t length, size_t &p, double &value,
pack_error = true;
return;
}
PN_uint64 uint_value = do_unpack_uint64(data + p);
uint64_t uint_value = do_unpack_uint64(data + p);
_uint64_range.validate(uint_value, range_error);
value = (double)uint_value;
p += 8;
@ -1340,7 +1340,7 @@ unpack_int(const char *data, size_t length, size_t &p, int &value,
pack_error = true;
return;
}
PN_int64 int_value = do_unpack_uint64(data + p);
int64_t int_value = do_unpack_uint64(data + p);
_int64_range.validate(int_value, range_error);
value = (int)int_value;
if (value != int_value) {
@ -1400,7 +1400,7 @@ unpack_int(const char *data, size_t length, size_t &p, int &value,
pack_error = true;
return;
}
PN_uint64 uint_value = do_unpack_uint64(data + p);
uint64_t uint_value = do_unpack_uint64(data + p);
_uint64_range.validate(uint_value, range_error);
value = (int)(unsigned int)uint_value;
if ((unsigned int)value != uint_value || value < 0) {
@ -1496,7 +1496,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
pack_error = true;
return;
}
PN_int64 int_value = do_unpack_int64(data + p);
int64_t int_value = do_unpack_int64(data + p);
_int64_range.validate(int_value, range_error);
if (int_value < 0) {
pack_error = true;
@ -1546,7 +1546,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
pack_error = true;
return;
}
PN_uint64 uint_value = do_unpack_uint64(data + p);
uint64_t uint_value = do_unpack_uint64(data + p);
_uint64_range.validate(uint_value, range_error);
value = (unsigned int)uint_value;
if (value != uint_value) {
@ -1585,7 +1585,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
* Unpacks the current numeric or string value from the stream.
*/
void DCSimpleParameter::
unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
unpack_int64(const char *data, size_t length, size_t &p, int64_t &value,
bool &pack_error, bool &range_error) const {
switch (_type) {
case ST_int8:
@ -1596,7 +1596,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
int int_value = do_unpack_int8(data + p);
_int_range.validate(int_value, range_error);
value = (PN_int64)int_value;
value = (int64_t)int_value;
p++;
}
break;
@ -1609,7 +1609,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
int int_value = do_unpack_int16(data + p);
_int_range.validate(int_value, range_error);
value = (PN_int64)int_value;
value = (int64_t)int_value;
p += 2;
}
break;
@ -1622,7 +1622,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
int int_value = do_unpack_int32(data + p);
_int_range.validate(int_value, range_error);
value = (PN_int64)int_value;
value = (int64_t)int_value;
p += 4;
}
break;
@ -1646,7 +1646,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
unsigned int uint_value = do_unpack_uint8(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_int64)(int)uint_value;
value = (int64_t)(int)uint_value;
p++;
}
break;
@ -1659,7 +1659,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
unsigned int uint_value = do_unpack_uint16(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_int64)(int)uint_value;
value = (int64_t)(int)uint_value;
p += 2;
}
break;
@ -1672,7 +1672,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
unsigned int uint_value = do_unpack_uint32(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_int64)(int)uint_value;
value = (int64_t)(int)uint_value;
p += 4;
}
break;
@ -1683,9 +1683,9 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
pack_error = true;
return;
}
PN_uint64 uint_value = do_unpack_uint64(data + p);
uint64_t uint_value = do_unpack_uint64(data + p);
_uint64_range.validate(uint_value, range_error);
value = (PN_int64)uint_value;
value = (int64_t)uint_value;
if (value < 0) {
pack_error = true;
}
@ -1701,7 +1701,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
}
double real_value = do_unpack_float64(data + p);
_double_range.validate(real_value, range_error);
value = (PN_int64)real_value;
value = (int64_t)real_value;
p += 8;
}
break;
@ -1722,7 +1722,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
* Unpacks the current numeric or string value from the stream.
*/
void DCSimpleParameter::
unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
unpack_uint64(const char *data, size_t length, size_t &p, uint64_t &value,
bool &pack_error, bool &range_error) const {
switch (_type) {
case ST_int8:
@ -1736,7 +1736,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
if (int_value < 0) {
pack_error = true;
}
value = (PN_uint64)(unsigned int)int_value;
value = (uint64_t)(unsigned int)int_value;
p++;
}
break;
@ -1752,7 +1752,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
if (int_value < 0) {
pack_error = true;
}
value = (PN_uint64)(unsigned int)int_value;
value = (uint64_t)(unsigned int)int_value;
p += 2;
}
break;
@ -1768,7 +1768,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
if (int_value < 0) {
pack_error = true;
}
value = (PN_uint64)(unsigned int)int_value;
value = (uint64_t)(unsigned int)int_value;
p += 4;
}
break;
@ -1779,12 +1779,12 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
pack_error = true;
return;
}
PN_int64 int_value = do_unpack_int64(data + p);
int64_t int_value = do_unpack_int64(data + p);
_int64_range.validate(int_value, range_error);
if (int_value < 0) {
pack_error = true;
}
value = (PN_uint64)int_value;
value = (uint64_t)int_value;
p += 8;
}
break;
@ -1798,7 +1798,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
}
unsigned int uint_value = do_unpack_uint8(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_uint64)uint_value;
value = (uint64_t)uint_value;
p++;
}
break;
@ -1811,7 +1811,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
}
unsigned int uint_value = do_unpack_uint16(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_uint64)uint_value;
value = (uint64_t)uint_value;
p += 2;
}
break;
@ -1824,7 +1824,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
}
unsigned int uint_value = do_unpack_uint32(data + p);
_uint_range.validate(uint_value, range_error);
value = (PN_uint64)uint_value;
value = (uint64_t)uint_value;
p += 4;
}
break;
@ -1847,7 +1847,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
}
double real_value = do_unpack_float64(data + p);
_double_range.validate(real_value, range_error);
value = (PN_uint64)real_value;
value = (uint64_t)real_value;
p += 8;
}
break;
@ -1990,7 +1990,7 @@ unpack_validate(const char *data, size_t length, size_t &p,
pack_error = true;
return true;
}
PN_int64 int_value = do_unpack_int64(data + p);
int64_t int_value = do_unpack_int64(data + p);
_int64_range.validate(int_value, range_error);
p += 8;
}
@ -2039,7 +2039,7 @@ unpack_validate(const char *data, size_t length, size_t &p,
pack_error = true;
return true;
}
PN_uint64 uint_value = do_unpack_uint64(data + p);
uint64_t uint_value = do_unpack_uint64(data + p);
_uint64_range.validate(uint_value, range_error);
p += 8;
}

View File

@ -56,9 +56,9 @@ public:
bool &pack_error, bool &range_error) const;
virtual void pack_uint(DCPackData &pack_data, unsigned int value,
bool &pack_error, bool &range_error) const;
virtual void pack_int64(DCPackData &pack_data, PN_int64 value,
virtual void pack_int64(DCPackData &pack_data, int64_t value,
bool &pack_error, bool &range_error) const;
virtual void pack_uint64(DCPackData &pack_data, PN_uint64 value,
virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
bool &pack_error, bool &range_error) const;
virtual void pack_string(DCPackData &pack_data, const string &value,
bool &pack_error, bool &range_error) const;
@ -71,9 +71,9 @@ public:
virtual void unpack_uint(const char *data, size_t length, size_t &p,
unsigned int &value, bool &pack_error, bool &range_error) const;
virtual void unpack_int64(const char *data, size_t length, size_t &p,
PN_int64 &value, bool &pack_error, bool &range_error) const;
int64_t &value, bool &pack_error, bool &range_error) const;
virtual void unpack_uint64(const char *data, size_t length, size_t &p,
PN_uint64 &value, bool &pack_error, bool &range_error) const;
uint64_t &value, bool &pack_error, bool &range_error) const;
virtual void unpack_string(const char *data, size_t length, size_t &p,
string &value, bool &pack_error, bool &range_error) const;
virtual bool unpack_validate(const char *data, size_t length, size_t &p,
@ -125,7 +125,7 @@ private:
// All of these modulus values will be filled in, regardless of the type.
unsigned int _uint_modulus;
PN_uint64 _uint64_modulus;
uint64_t _uint64_modulus;
double _double_modulus;
static DCClassParameter *_uint32uint8_type;

View File

@ -102,17 +102,7 @@ typedef string Filename;
#define pmap map
#define pset set
#ifdef WIN32
typedef __int64 PN_int64;
typedef unsigned __int64 PN_uint64;
#else
typedef long long PN_int64;
typedef unsigned long long PN_uint64;
#endif
typedef unsigned char PN_uint8;
typedef unsigned short PN_uint16;
typedef unsigned int PN_uint32;
#include <stdint.h>
typedef ifstream pifstream;
typedef ofstream pofstream;
@ -121,8 +111,8 @@ typedef fstream pfstream;
#endif // WITHIN_PANDA
// typedef unsigned long CHANNEL_TYPE;
typedef PN_uint64 CHANNEL_TYPE;
typedef PN_uint32 DOID_TYPE;
typedef PN_uint32 ZONEID_TYPE;
typedef uint64_t CHANNEL_TYPE;
typedef uint32_t DOID_TYPE;
typedef uint32_t ZONEID_TYPE;
#endif // DCBASE_H

View File

@ -184,7 +184,7 @@ d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_std
*
*/
INLINE void CDistributedSmoothNodeBase::
d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l) {
d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, uint64_t l) {
// cout << "d_setSmPosHprL: " << x << ", " << y << ", " << z << ", " << h <<
// ", " << p << ", " << r << l << endl;
DCPacker packer;

View File

@ -358,7 +358,7 @@ finish_send_update(DCPacker &packer) {
* Appends the timestamp and sends the update.
*/
void CDistributedSmoothNodeBase::
set_curr_l(PN_uint64 l) {
set_curr_l(uint64_t l) {
_currL[1] = l;
}

View File

@ -51,7 +51,7 @@ PUBLISHED:
void broadcast_pos_hpr_xyh();
void broadcast_pos_hpr_xy();
void set_curr_l(PN_uint64 l);
void set_curr_l(uint64_t l);
void print_curr_l();
private:
@ -67,7 +67,7 @@ private:
INLINE void d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h);
INLINE void d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h);
INLINE void d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
INLINE void d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l);
INLINE void d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, uint64_t l);
void begin_send_update(DCPacker &packer, const string &field_name);
void finish_send_update(DCPacker &packer);
@ -97,7 +97,7 @@ private:
bool _store_stop;
// contains most recently sent location info as index 0, index 1 contains
// most recently set location info
PN_uint64 _currL[2];
uint64_t _currL[2];
};
#include "cDistributedSmoothNodeBase.I"

View File

@ -15,8 +15,8 @@
* Adds a linear sequence of uint32 words to the hash.
*/
INLINE size_t AddHash::
add_hash(size_t start, const PN_uint32 *words, size_t num_words) {
return (size_t)hashword(words, num_words, (PN_uint32)start);
add_hash(size_t start, const uint32_t *words, size_t num_words) {
return (size_t)hashword(words, num_words, (uint32_t)start);
}
/**
@ -24,7 +24,7 @@ add_hash(size_t start, const PN_uint32 *words, size_t num_words) {
*/
INLINE size_t AddHash::
add_hash(size_t start, const PN_float32 *floats, size_t num_floats) {
return add_hash(start, (const PN_uint32 *)floats, num_floats);
return add_hash(start, (const uint32_t *)floats, num_floats);
}
/**
@ -32,5 +32,5 @@ add_hash(size_t start, const PN_float32 *floats, size_t num_floats) {
*/
INLINE size_t AddHash::
add_hash(size_t start, const PN_float64 *floats, size_t num_floats) {
return add_hash(start, (const PN_uint32 *)floats, num_floats * 2);
return add_hash(start, (const uint32_t *)floats, num_floats * 2);
}

View File

@ -17,33 +17,33 @@
* Adds a linear sequence of bytes to the hash.
*/
size_t AddHash::
add_hash(size_t start, const PN_uint8 *bytes, size_t num_bytes) {
add_hash(size_t start, const uint8_t *bytes, size_t num_bytes) {
size_t num_words = num_bytes >> 2;
size_t remaining_bytes = num_bytes - (num_words << 2);
size_t hash = (size_t)hashword((const PN_uint32 *)bytes, num_words, (PN_uint32)start);
size_t hash = (size_t)hashword((const uint32_t *)bytes, num_words, (uint32_t)start);
switch (remaining_bytes) {
case 3:
{
PN_uint32 remaining;
uint32_t remaining;
remaining = (bytes[num_bytes - 3] << 16) | (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
}
break;
case 2:
{
PN_uint32 remaining;
uint32_t remaining;
remaining = (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
}
break;
case 1:
{
PN_uint32 remaining;
uint32_t remaining;
remaining = (bytes[num_bytes - 1]);
hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
}
break;

View File

@ -25,8 +25,8 @@
*/
class EXPCL_DTOOL AddHash {
public:
INLINE static size_t add_hash(size_t start, const PN_uint32 *words, size_t num_words);
static size_t add_hash(size_t start, const PN_uint8 *bytes, size_t num_bytes);
INLINE static size_t add_hash(size_t start, const uint32_t *words, size_t num_words);
static size_t add_hash(size_t start, const uint8_t *bytes, size_t num_bytes);
INLINE static size_t add_hash(size_t start, const PN_float32 *floats, size_t num_floats);
INLINE static size_t add_hash(size_t start, const PN_float64 *floats, size_t num_floats);
};

View File

@ -28,7 +28,7 @@
*/
class EXPCL_DTOOL AtomicAdjustI386Impl {
public:
typedef ALIGN_4BYTE PN_int32 Integer;
typedef ALIGN_4BYTE int32_t Integer;
typedef void *UnalignedPointer;
typedef ALIGN_4BYTE UnalignedPointer Pointer;

View File

@ -149,25 +149,25 @@ and these came close:
/*
--------------------------------------------------------------------
This works on all machines. To be useful, it requires
-- that the key be an array of PN_uint32's, and
-- that the length be the number of PN_uint32's in the key
-- that the key be an array of uint32_t's, and
-- that the length be the number of uint32_t's in the key
The function hashword() is identical to hashlittle() on little-endian
machines, and identical to hashbig() on big-endian machines,
except that the length has to be measured in PN_uint32s rather than in
except that the length has to be measured in uint32_ts rather than in
bytes. hashlittle() is more complicated than hashword() only because
hashlittle() has to dance around fitting the key bytes into registers.
--------------------------------------------------------------------
*/
PN_uint32 hashword(
const PN_uint32 *k, /* the key, an array of PN_uint32 values */
size_t length, /* the length of the key, in PN_uint32s */
PN_uint32 initval) /* the previous hash, or an arbitrary value */
uint32_t hashword(
const uint32_t *k, /* the key, an array of uint32_t values */
size_t length, /* the length of the key, in uint32_ts */
uint32_t initval) /* the previous hash, or an arbitrary value */
{
PN_uint32 a,b,c;
uint32_t a,b,c;
/* Set up the internal state */
a = b = c = 0xdeadbeef + (((PN_uint32)length)<<2) + initval;
a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval;
/*------------------------------------------------- handle most of the key */
while (length > 3)
@ -180,7 +180,7 @@ PN_uint32 initval) /* the previous hash, or an arbitrary value */
k += 3;
}
/*------------------------------------------- handle the last 3 PN_uint32's */
/*------------------------------------------- handle the last 3 uint32_t's */
switch(length) /* all the case statements fall through */
{
case 3 : c+=k[2];
@ -211,7 +211,7 @@ use a bitmask. For example, if you need only 10 bits, do
h = (h & hashmask(10));
In which case, the hash table should have hashsize(10) elements.
If you are hashing n strings (PN_uint8 **)k, do it like this:
If you are hashing n strings (uint8_t **)k, do it like this:
for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
@ -222,19 +222,19 @@ acceptable. Do NOT use for cryptographic purposes.
-------------------------------------------------------------------------------
*/
PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
{
PN_uint32 a,b,c; /* internal state */
uint32_t a,b,c; /* internal state */
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((PN_uint32)length) + initval;
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const PN_uint32 *k =(PN_uint32*) key; /* read 32-bit chunks */
const uint32_t *k =(uint32_t*) key; /* read 32-bit chunks */
#ifdef VALGRIND
const PN_uint8 *k8;
const uint8_t *k8;
#endif
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@ -279,20 +279,20 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
#else /* make valgrind happy */
k8 = (const PN_uint8 *)k;
k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
case 11: c+=((PN_uint32)k8[10])<<16; /* fall through */
case 10: c+=((PN_uint32)k8[9])<<8; /* fall through */
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[1]; a+=k[0]; break;
case 7 : b+=((PN_uint32)k8[6])<<16; /* fall through */
case 6 : b+=((PN_uint32)k8[5])<<8; /* fall through */
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]; break;
case 3 : a+=((PN_uint32)k8[2])<<16; /* fall through */
case 2 : a+=((PN_uint32)k8[1])<<8; /* fall through */
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
case 1 : a+=k8[0]; break;
case 0 : return c;
}
@ -300,45 +300,45 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
#endif /* !valgrind */
} else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
const PN_uint16 *k = (PN_uint16*)key; /* read 16-bit chunks */
const PN_uint8 *k8;
const uint16_t *k = (uint16_t*)key; /* read 16-bit chunks */
const uint8_t *k8;
/*--------------- all but last block: aligned reads and different mixing */
while (length > 12)
{
a += k[0] + (((PN_uint32)k[1])<<16);
b += k[2] + (((PN_uint32)k[3])<<16);
c += k[4] + (((PN_uint32)k[5])<<16);
a += k[0] + (((uint32_t)k[1])<<16);
b += k[2] + (((uint32_t)k[3])<<16);
c += k[4] + (((uint32_t)k[5])<<16);
mix(a,b,c);
length -= 12;
k += 6;
}
/*----------------------------- handle the last (probably partial) block */
k8 = (const PN_uint8 *)k;
k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[4]+(((PN_uint32)k[5])<<16);
b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
case 12: c+=k[4]+(((uint32_t)k[5])<<16);
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 11: c+=((PN_uint32)k8[10])<<16; /* fall through */
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=k[4];
b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 7 : b+=((PN_uint32)k8[6])<<16; /* fall through */
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=k[2];
a+=k[0]+(((PN_uint32)k[1])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]+(((PN_uint32)k[1])<<16);
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 3 : a+=((PN_uint32)k8[2])<<16; /* fall through */
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
@ -347,23 +347,23 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
}
} else { /* need to read the key one byte at a time */
const PN_uint8 *k =(PN_uint8*) key;
const uint8_t *k =(uint8_t*) key;
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
while (length > 12)
{
a += k[0];
a += ((PN_uint32)k[1])<<8;
a += ((PN_uint32)k[2])<<16;
a += ((PN_uint32)k[3])<<24;
a += ((uint32_t)k[1])<<8;
a += ((uint32_t)k[2])<<16;
a += ((uint32_t)k[3])<<24;
b += k[4];
b += ((PN_uint32)k[5])<<8;
b += ((PN_uint32)k[6])<<16;
b += ((PN_uint32)k[7])<<24;
b += ((uint32_t)k[5])<<8;
b += ((uint32_t)k[6])<<16;
b += ((uint32_t)k[7])<<24;
c += k[8];
c += ((PN_uint32)k[9])<<8;
c += ((PN_uint32)k[10])<<16;
c += ((PN_uint32)k[11])<<24;
c += ((uint32_t)k[9])<<8;
c += ((uint32_t)k[10])<<16;
c += ((uint32_t)k[11])<<24;
mix(a,b,c);
length -= 12;
k += 12;
@ -372,17 +372,17 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
case 12: c+=((PN_uint32)k[11])<<24;
case 11: c+=((PN_uint32)k[10])<<16;
case 10: c+=((PN_uint32)k[9])<<8;
case 12: c+=((uint32_t)k[11])<<24;
case 11: c+=((uint32_t)k[10])<<16;
case 10: c+=((uint32_t)k[9])<<8;
case 9 : c+=k[8];
case 8 : b+=((PN_uint32)k[7])<<24;
case 7 : b+=((PN_uint32)k[6])<<16;
case 6 : b+=((PN_uint32)k[5])<<8;
case 8 : b+=((uint32_t)k[7])<<24;
case 7 : b+=((uint32_t)k[6])<<16;
case 6 : b+=((uint32_t)k[5])<<8;
case 5 : b+=k[4];
case 4 : a+=((PN_uint32)k[3])<<24;
case 3 : a+=((PN_uint32)k[2])<<16;
case 2 : a+=((PN_uint32)k[1])<<8;
case 4 : a+=((uint32_t)k[3])<<24;
case 3 : a+=((uint32_t)k[2])<<16;
case 2 : a+=((uint32_t)k[1])<<8;
case 1 : a+=k[0];
break;
case 0 : return c;
@ -407,21 +407,21 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
void hashlittle2(
const void *key, /* the key to hash */
size_t length, /* length of the key */
PN_uint32 *pc, /* IN: primary initval, OUT: primary hash */
PN_uint32 *pb) /* IN: secondary initval, OUT: secondary hash */
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
uint32_t *pb) /* IN: secondary initval, OUT: secondary hash */
{
PN_uint32 a,b,c; /* internal state */
uint32_t a,b,c; /* internal state */
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((PN_uint32)length) + *pc;
a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc;
c += *pb;
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const PN_uint32 *k = (PN_uint32*)key; /* read 32-bit chunks */
const uint32_t *k = (uint32_t*)key; /* read 32-bit chunks */
#ifdef VALGRIND
const PN_uint8 *k8;
const uint8_t *k8;
#endif
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@ -466,20 +466,20 @@ void hashlittle2(
#else /* make valgrind happy */
k8 = (const PN_uint8 *)k;
k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
case 11: c+=((PN_uint32)k8[10])<<16; /* fall through */
case 10: c+=((PN_uint32)k8[9])<<8; /* fall through */
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[1]; a+=k[0]; break;
case 7 : b+=((PN_uint32)k8[6])<<16; /* fall through */
case 6 : b+=((PN_uint32)k8[5])<<8; /* fall through */
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]; break;
case 3 : a+=((PN_uint32)k8[2])<<16; /* fall through */
case 2 : a+=((PN_uint32)k8[1])<<8; /* fall through */
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
case 1 : a+=k8[0]; break;
case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */
}
@ -487,45 +487,45 @@ void hashlittle2(
#endif /* !valgrind */
} else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
const PN_uint16 *k = (PN_uint16*)key; /* read 16-bit chunks */
const PN_uint8 *k8;
const uint16_t *k = (uint16_t*)key; /* read 16-bit chunks */
const uint8_t *k8;
/*--------------- all but last block: aligned reads and different mixing */
while (length > 12)
{
a += k[0] + (((PN_uint32)k[1])<<16);
b += k[2] + (((PN_uint32)k[3])<<16);
c += k[4] + (((PN_uint32)k[5])<<16);
a += k[0] + (((uint32_t)k[1])<<16);
b += k[2] + (((uint32_t)k[3])<<16);
c += k[4] + (((uint32_t)k[5])<<16);
mix(a,b,c);
length -= 12;
k += 6;
}
/*----------------------------- handle the last (probably partial) block */
k8 = (const PN_uint8 *)k;
k8 = (const uint8_t *)k;
switch(length)
{
case 12: c+=k[4]+(((PN_uint32)k[5])<<16);
b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
case 12: c+=k[4]+(((uint32_t)k[5])<<16);
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 11: c+=((PN_uint32)k8[10])<<16; /* fall through */
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=k[4];
b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[2]+(((PN_uint32)k[3])<<16);
a+=k[0]+(((PN_uint32)k[1])<<16);
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 7 : b+=((PN_uint32)k8[6])<<16; /* fall through */
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=k[2];
a+=k[0]+(((PN_uint32)k[1])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]+(((PN_uint32)k[1])<<16);
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
case 3 : a+=((PN_uint32)k8[2])<<16; /* fall through */
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
@ -534,23 +534,23 @@ void hashlittle2(
}
} else { /* need to read the key one byte at a time */
const PN_uint8 *k = (PN_uint8*)key;
const uint8_t *k = (uint8_t*)key;
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
while (length > 12)
{
a += k[0];
a += ((PN_uint32)k[1])<<8;
a += ((PN_uint32)k[2])<<16;
a += ((PN_uint32)k[3])<<24;
a += ((uint32_t)k[1])<<8;
a += ((uint32_t)k[2])<<16;
a += ((uint32_t)k[3])<<24;
b += k[4];
b += ((PN_uint32)k[5])<<8;
b += ((PN_uint32)k[6])<<16;
b += ((PN_uint32)k[7])<<24;
b += ((uint32_t)k[5])<<8;
b += ((uint32_t)k[6])<<16;
b += ((uint32_t)k[7])<<24;
c += k[8];
c += ((PN_uint32)k[9])<<8;
c += ((PN_uint32)k[10])<<16;
c += ((PN_uint32)k[11])<<24;
c += ((uint32_t)k[9])<<8;
c += ((uint32_t)k[10])<<16;
c += ((uint32_t)k[11])<<24;
mix(a,b,c);
length -= 12;
k += 12;
@ -559,17 +559,17 @@ void hashlittle2(
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
case 12: c+=((PN_uint32)k[11])<<24;
case 11: c+=((PN_uint32)k[10])<<16;
case 10: c+=((PN_uint32)k[9])<<8;
case 12: c+=((uint32_t)k[11])<<24;
case 11: c+=((uint32_t)k[10])<<16;
case 10: c+=((uint32_t)k[9])<<8;
case 9 : c+=k[8];
case 8 : b+=((PN_uint32)k[7])<<24;
case 7 : b+=((PN_uint32)k[6])<<16;
case 6 : b+=((PN_uint32)k[5])<<8;
case 8 : b+=((uint32_t)k[7])<<24;
case 7 : b+=((uint32_t)k[6])<<16;
case 6 : b+=((uint32_t)k[5])<<8;
case 5 : b+=k[4];
case 4 : a+=((PN_uint32)k[3])<<24;
case 3 : a+=((PN_uint32)k[2])<<16;
case 2 : a+=((PN_uint32)k[1])<<8;
case 4 : a+=((uint32_t)k[3])<<24;
case 3 : a+=((uint32_t)k[2])<<16;
case 2 : a+=((uint32_t)k[1])<<8;
case 1 : a+=k[0];
break;
case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */
@ -588,19 +588,19 @@ void hashlittle2(
* from hashlittle() on all machines. hashbig() takes advantage of
* big-endian byte ordering.
*/
PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
uint32_t hashbig( const void *key, size_t length, uint32_t initval)
{
PN_uint32 a,b,c;
uint32_t a,b,c;
union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((PN_uint32)length) + initval;
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
u.ptr = key;
if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
const PN_uint32 *k = (PN_uint32*)key; /* read 32-bit chunks */
const uint32_t *k = (uint32_t*)key; /* read 32-bit chunks */
#ifdef VALGRIND
const PN_uint8 *k8;
const uint8_t *k8;
#endif
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@ -645,44 +645,44 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
#else /* make valgrind happy */
k8 = (const PN_uint8 *)k;
k8 = (const uint8_t *)k;
switch(length) /* all the case statements fall through */
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
case 11: c+=((PN_uint32)k8[10])<<8; /* fall through */
case 10: c+=((PN_uint32)k8[9])<<16; /* fall through */
case 9 : c+=((PN_uint32)k8[8])<<24; /* fall through */
case 11: c+=((uint32_t)k8[10])<<8; /* fall through */
case 10: c+=((uint32_t)k8[9])<<16; /* fall through */
case 9 : c+=((uint32_t)k8[8])<<24; /* fall through */
case 8 : b+=k[1]; a+=k[0]; break;
case 7 : b+=((PN_uint32)k8[6])<<8; /* fall through */
case 6 : b+=((PN_uint32)k8[5])<<16; /* fall through */
case 5 : b+=((PN_uint32)k8[4])<<24; /* fall through */
case 7 : b+=((uint32_t)k8[6])<<8; /* fall through */
case 6 : b+=((uint32_t)k8[5])<<16; /* fall through */
case 5 : b+=((uint32_t)k8[4])<<24; /* fall through */
case 4 : a+=k[0]; break;
case 3 : a+=((PN_uint32)k8[2])<<8; /* fall through */
case 2 : a+=((PN_uint32)k8[1])<<16; /* fall through */
case 1 : a+=((PN_uint32)k8[0])<<24; break;
case 3 : a+=((uint32_t)k8[2])<<8; /* fall through */
case 2 : a+=((uint32_t)k8[1])<<16; /* fall through */
case 1 : a+=((uint32_t)k8[0])<<24; break;
case 0 : return c;
}
#endif /* !VALGRIND */
} else { /* need to read the key one byte at a time */
const PN_uint8 *k = (PN_uint8*)key;
const uint8_t *k = (uint8_t*)key;
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
while (length > 12)
{
a += ((PN_uint32)k[0])<<24;
a += ((PN_uint32)k[1])<<16;
a += ((PN_uint32)k[2])<<8;
a += ((PN_uint32)k[3]);
b += ((PN_uint32)k[4])<<24;
b += ((PN_uint32)k[5])<<16;
b += ((PN_uint32)k[6])<<8;
b += ((PN_uint32)k[7]);
c += ((PN_uint32)k[8])<<24;
c += ((PN_uint32)k[9])<<16;
c += ((PN_uint32)k[10])<<8;
c += ((PN_uint32)k[11]);
a += ((uint32_t)k[0])<<24;
a += ((uint32_t)k[1])<<16;
a += ((uint32_t)k[2])<<8;
a += ((uint32_t)k[3]);
b += ((uint32_t)k[4])<<24;
b += ((uint32_t)k[5])<<16;
b += ((uint32_t)k[6])<<8;
b += ((uint32_t)k[7]);
c += ((uint32_t)k[8])<<24;
c += ((uint32_t)k[9])<<16;
c += ((uint32_t)k[10])<<8;
c += ((uint32_t)k[11]);
mix(a,b,c);
length -= 12;
k += 12;
@ -692,17 +692,17 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
switch(length) /* all the case statements fall through */
{
case 12: c+=k[11];
case 11: c+=((PN_uint32)k[10])<<8;
case 10: c+=((PN_uint32)k[9])<<16;
case 9 : c+=((PN_uint32)k[8])<<24;
case 11: c+=((uint32_t)k[10])<<8;
case 10: c+=((uint32_t)k[9])<<16;
case 9 : c+=((uint32_t)k[8])<<24;
case 8 : b+=k[7];
case 7 : b+=((PN_uint32)k[6])<<8;
case 6 : b+=((PN_uint32)k[5])<<16;
case 5 : b+=((PN_uint32)k[4])<<24;
case 7 : b+=((uint32_t)k[6])<<8;
case 6 : b+=((uint32_t)k[5])<<16;
case 5 : b+=((uint32_t)k[4])<<24;
case 4 : a+=k[3];
case 3 : a+=((PN_uint32)k[2])<<8;
case 2 : a+=((PN_uint32)k[1])<<16;
case 1 : a+=((PN_uint32)k[0])<<24;
case 3 : a+=((uint32_t)k[2])<<8;
case 2 : a+=((uint32_t)k[1])<<16;
case 1 : a+=((uint32_t)k[0])<<24;
break;
case 0 : return c;
}
@ -718,9 +718,9 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
/* used for timings */
void driver1()
{
PN_uint8 buf[256];
PN_uint32 i;
PN_uint32 h=0;
uint8_t buf[256];
uint32_t i;
uint32_t h=0;
time_t a,z;
time(&a);
@ -740,11 +740,11 @@ void driver1()
#define MAXLEN 70
void driver2()
{
PN_uint8 qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
PN_uint32 c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z;
PN_uint32 e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
PN_uint32 x[HASHSTATE],y[HASHSTATE];
PN_uint32 hlen;
uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z;
uint32_t e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
uint32_t x[HASHSTATE],y[HASHSTATE];
uint32_t hlen;
printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
for (hlen=0; hlen < MAXLEN; ++hlen)
@ -757,14 +757,14 @@ void driver2()
for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
{
for (l=0; l<HASHSTATE; ++l)
e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((PN_uint32)0);
e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0);
/*---- check that every output bit is affected by that input bit */
for (k=0; k<MAXPAIR; k+=2)
{
PN_uint32 finished=1;
uint32_t finished=1;
/* keys have one bit different */
for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (PN_uint8)0;}
for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;}
/* have a and b be two keys differing in only one bit */
a[i] ^= (k<<j);
a[i] ^= (k>>(8-j));
@ -810,23 +810,23 @@ void driver2()
/* Check for reading beyond the end of the buffer and alignment problems */
void driver3()
{
PN_uint8 buf[MAXLEN+20], *b;
PN_uint32 len;
PN_uint8 q[] = "This is the time for all good men to come to the aid of their country...";
PN_uint32 h;
PN_uint8 qq[] = "xThis is the time for all good men to come to the aid of their country...";
PN_uint32 i;
PN_uint8 qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
PN_uint32 j;
PN_uint8 qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
PN_uint32 ref,x,y;
PN_uint8 *p;
uint8_t buf[MAXLEN+20], *b;
uint32_t len;
uint8_t q[] = "This is the time for all good men to come to the aid of their country...";
uint32_t h;
uint8_t qq[] = "xThis is the time for all good men to come to the aid of their country...";
uint32_t i;
uint8_t qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
uint32_t j;
uint8_t qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
uint32_t ref,x,y;
uint8_t *p;
printf("Endianness. These lines should all be the same (for values filled in):\n");
printf("%.8x %.8x %.8x\n",
hashword((const PN_uint32 *)q, (sizeof(q)-1)/4, 13),
hashword((const PN_uint32 *)q, (sizeof(q)-5)/4, 13),
hashword((const PN_uint32 *)q, (sizeof(q)-9)/4, 13));
hashword((const uint32_t *)q, (sizeof(q)-1)/4, 13),
hashword((const uint32_t *)q, (sizeof(q)-5)/4, 13),
hashword((const uint32_t *)q, (sizeof(q)-9)/4, 13));
p = q;
printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n",
hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
@ -868,11 +868,11 @@ void driver3()
for (j=0; j<i; ++j) *(b+j)=0;
/* these should all be equal */
ref = hashlittle(b, len, (PN_uint32)1);
*(b+i)=(PN_uint8)~0;
*(b-1)=(PN_uint8)~0;
x = hashlittle(b, len, (PN_uint32)1);
y = hashlittle(b, len, (PN_uint32)1);
ref = hashlittle(b, len, (uint32_t)1);
*(b+i)=(uint8_t)~0;
*(b-1)=(uint8_t)~0;
x = hashlittle(b, len, (uint32_t)1);
y = hashlittle(b, len, (uint32_t)1);
if ((ref != x) || (ref != y))
{
printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y,
@ -885,8 +885,8 @@ void driver3()
/* check for problems with nulls */
void driver4()
{
PN_uint8 buf[1];
PN_uint32 h,i,state[HASHSTATE];
uint8_t buf[1];
uint32_t h,i,state[HASHSTATE];
buf[0] = ~0;

View File

@ -21,9 +21,9 @@
extern "C" {
#endif
EXPCL_DTOOL PN_uint32 hashword(const PN_uint32 *k, /* the key, an array of PN_uint32 values */
size_t length, /* the length of the key, in PN_uint32s */
PN_uint32 initval);
EXPCL_DTOOL uint32_t hashword(const uint32_t *k, /* the key, an array of uint32_t values */
size_t length, /* the length of the key, in uint32_ts */
uint32_t initval);
#ifdef __cplusplus
}; /* end of extern "C" */

View File

@ -19,30 +19,7 @@
// This header file defines a number of typedefs that correspond to the
// various numeric types for unsigned and signed numbers of various widths.
#if defined(WIN32_VC) && !defined(CPPPARSER)
typedef signed __int8 PN_int8;
typedef signed __int16 PN_int16;
typedef signed __int32 PN_int32;
typedef signed __int64 PN_int64;
typedef unsigned __int8 PN_uint8;
typedef unsigned __int16 PN_uint16;
typedef unsigned __int32 PN_uint32;
typedef unsigned __int64 PN_uint64;
#else
typedef signed char PN_int8;
typedef short int PN_int16;
typedef int PN_int32;
typedef long long int PN_int64;
typedef unsigned char PN_uint8;
typedef unsigned short int PN_uint16;
typedef unsigned int PN_uint32;
typedef unsigned long long int PN_uint64;
#endif
#include <stdint.h>
typedef double PN_float64;
typedef float PN_float32;

View File

@ -99,7 +99,7 @@ is_equal(const Key &a, const Key &b) const {
template<class Key, class Compare>
INLINE size_t integer_hash<Key, Compare>::
add_hash(size_t hash, const Key &key) {
PN_uint32 key32 = (PN_uint32)(key);
uint32_t key32 = (uint32_t)(key);
return AddHash::add_hash(hash, &key32, 1);
}
@ -109,7 +109,7 @@ add_hash(size_t hash, const Key &key) {
INLINE size_t pointer_hash::
add_hash(size_t hash, const void *key) {
// We don't mind if this loses precision.
PN_uint32 key32 = (PN_uint32)reinterpret_cast<uintptr_t>(key);
uint32_t key32 = (uint32_t)reinterpret_cast<uintptr_t>(key);
return AddHash::add_hash(hash, &key32, 1);
}
@ -147,7 +147,7 @@ operator () (const Key &a, const Key &b) const {
template<class Key>
INLINE size_t floating_point_hash<Key>::
add_hash(size_t hash, const Key &key) const {
PN_uint32 key32 = (PN_uint32)(key / _threshold + 0.5f);
uint32_t key32 = (uint32_t)(key / _threshold + 0.5f);
return AddHash::add_hash(hash, &key32, 1);
}
@ -173,7 +173,7 @@ add_hash(size_t hash, const Key &key) {
}
#endif
size_t num_bytes = (key.size() * sizeof(key[0]));
return AddHash::add_hash(hash, (const PN_uint8 *)&key[0], num_bytes);
return AddHash::add_hash(hash, (const uint8_t *)&key[0], num_bytes);
}
/**

View File

@ -511,10 +511,10 @@ TypeRegistry() {
// Here's a few sanity checks on the sizes of our words. We have to put it
// here, at runtime, since there doesn't appear to be a cross-platform
// compile-time way to verify that we've chosen the right word sizes.
assert(sizeof(PN_uint8) == 1 && sizeof(PN_int8) == 1);
assert(sizeof(PN_uint16) == 2 && sizeof(PN_int16) == 2);
assert(sizeof(PN_uint32) == 4 && sizeof(PN_int32) == 4);
assert(sizeof(PN_uint64) == 8 && sizeof(PN_int64) == 8);
assert(sizeof(uint8_t) == 1 && sizeof(int8_t) == 1);
assert(sizeof(uint16_t) == 2 && sizeof(int16_t) == 2);
assert(sizeof(uint32_t) == 4 && sizeof(int32_t) == 4);
assert(sizeof(uint64_t) == 8 && sizeof(int64_t) == 8);
assert(sizeof(PN_float32) == 4);
assert(sizeof(PN_float64) == 8);

View File

@ -80,13 +80,13 @@ format_string(int value) {
}
INLINE string
format_string(PN_int64 value) {
format_string(int64_t value) {
char buffer[21];
char *p = buffer + 20;
*p = 0;
if (value < 0) {
PN_uint64 posv = (PN_uint64)-value;
uint64_t posv = (uint64_t)-value;
do {
*--p = '0' + (posv % 10);
posv /= 10;

View File

@ -73,7 +73,7 @@ INLINE string format_string(float value);
INLINE string format_string(double value);
INLINE string format_string(unsigned int value);
INLINE string format_string(int value);
INLINE string format_string(PN_int64 value);
INLINE string format_string(int64_t value);
#include "string_utils.I"

View File

@ -187,7 +187,7 @@ get_int_word(size_t n) const {
* Returns the int64 value of the nth word of the declaration's value, or 0 if
* there is no nth value. See also has_int64_word().
*/
INLINE PN_int64 ConfigDeclaration::
INLINE int64_t ConfigDeclaration::
get_int64_word(size_t n) const {
// We use has_string_word() instead of has_int64_word(), so we can return a
// partial answer if there was one.

View File

@ -108,7 +108,7 @@ set_int_word(size_t n, int value) {
* words.
*/
void ConfigDeclaration::
set_int64_word(size_t n, PN_int64 value) {
set_int64_word(size_t n, int64_t value) {
set_string_word(n, format_string(value));
_words[n]._flags |= (F_checked_int64 | F_valid_int64);
@ -294,8 +294,8 @@ check_int64_word(size_t n) {
++pi;
// Negative number.
while (pi != word._str.end() && isdigit(*pi)) {
PN_int64 next = word._int_64 * 10 - (int)((*pi) - '0');
if ((PN_int64)(next / 10) != word._int_64) {
int64_t next = word._int_64 * 10 - (int)((*pi) - '0');
if ((int64_t)(next / 10) != word._int_64) {
// Overflow.
overflow = true;
}
@ -306,8 +306,8 @@ check_int64_word(size_t n) {
} else {
// Positive number.
while (pi != word._str.end() && isdigit(*pi)) {
PN_int64 next = word._int_64 * 10 + (int)((*pi) - '0');
if ((PN_int64)(next / 10) != word._int_64) {
int64_t next = word._int_64 * 10 + (int)((*pi) - '0');
if ((int64_t)(next / 10) != word._int_64) {
// Overflow.
overflow = true;
}

View File

@ -59,13 +59,13 @@ PUBLISHED:
INLINE string get_string_word(size_t n) const;
INLINE bool get_bool_word(size_t n) const;
INLINE int get_int_word(size_t n) const;
INLINE PN_int64 get_int64_word(size_t n) const;
INLINE int64_t get_int64_word(size_t n) const;
INLINE double get_double_word(size_t n) const;
void set_string_word(size_t n, const string &value);
void set_bool_word(size_t n, bool value);
void set_int_word(size_t n, int value);
void set_int64_word(size_t n, PN_int64 value);
void set_int64_word(size_t n, int64_t value);
void set_double_word(size_t n, double value);
INLINE int get_decl_seq() const;
@ -106,7 +106,7 @@ private:
string _str;
bool _bool;
int _int;
PN_int64 _int_64;
int64_t _int_64;
double _double;
short _flags;
};

View File

@ -196,7 +196,7 @@ get_int_word(size_t n) const {
* Returns the int64 value of the nth word of the variable's value, or 0 if
* there is no nth value. See also has_int_word().
*/
INLINE PN_int64 ConfigVariable::
INLINE int64_t ConfigVariable::
get_int64_word(size_t n) const {
nassertr(is_constructed(), 0);
const ConfigDeclaration *decl = _core->get_declaration(0);
@ -249,7 +249,7 @@ set_int_word(size_t n, int value) {
* words.
*/
INLINE void ConfigVariable::
set_int64_word(size_t n, PN_int64 value) {
set_int64_word(size_t n, int64_t value) {
nassertv(is_constructed());
_core->make_local_value()->set_int64_word(n, value);
}

View File

@ -56,13 +56,13 @@ protected:
INLINE string get_string_word(size_t n) const;
INLINE bool get_bool_word(size_t n) const;
INLINE int get_int_word(size_t n) const;
INLINE PN_int64 get_int64_word(size_t n) const;
INLINE int64_t get_int64_word(size_t n) const;
INLINE double get_double_word(size_t n) const;
INLINE void set_string_word(size_t n, const string &value);
INLINE void set_bool_word(size_t n, bool value);
INLINE void set_int_word(size_t n, int value);
INLINE void set_int64_word(size_t n, PN_int64 value);
INLINE void set_int64_word(size_t n, int64_t value);
INLINE void set_double_word(size_t n, double value);
protected:

View File

@ -26,7 +26,7 @@ ConfigVariableInt64(const string &name) :
*
*/
INLINE ConfigVariableInt64::
ConfigVariableInt64(const string &name, PN_int64 default_value,
ConfigVariableInt64(const string &name, int64_t default_value,
const string &description, int flags) :
#ifdef PRC_SAVE_DESCRIPTIONS
ConfigVariable(name, ConfigVariableCore::VT_int64, description, flags),
@ -60,7 +60,7 @@ ConfigVariableInt64(const string &name, const string &default_value,
* Reassigns the variable's local value.
*/
INLINE void ConfigVariableInt64::
operator = (PN_int64 value) {
operator = (int64_t value) {
set_value(value);
}
@ -68,7 +68,7 @@ operator = (PN_int64 value) {
* Returns the variable's value.
*/
INLINE ConfigVariableInt64::
operator PN_int64 () const {
operator int64_t () const {
return get_value();
}
@ -83,7 +83,7 @@ size() const {
/**
* Returns the value of the variable's nth word.
*/
INLINE PN_int64 ConfigVariableInt64::
INLINE int64_t ConfigVariableInt64::
operator [] (size_t n) const {
return get_word(n);
}
@ -92,7 +92,7 @@ operator [] (size_t n) const {
* Reassigns the variable's local value.
*/
INLINE void ConfigVariableInt64::
set_value(PN_int64 value) {
set_value(int64_t value) {
set_string_value("");
set_int64_word(0, value);
}
@ -100,9 +100,9 @@ set_value(PN_int64 value) {
/**
* Returns the variable's value.
*/
INLINE PN_int64 ConfigVariableInt64::
INLINE int64_t ConfigVariableInt64::
get_value() const {
TAU_PROFILE("PN_int64 ConfigVariableInt64::get_value() const", " ", TAU_USER);
TAU_PROFILE("int64_t ConfigVariableInt64::get_value() const", " ", TAU_USER);
if (!is_cache_valid(_local_modified)) {
mark_cache_valid(((ConfigVariableInt64 *)this)->_local_modified);
((ConfigVariableInt64 *)this)->_cache = get_int64_word(0);
@ -113,7 +113,7 @@ get_value() const {
/**
* Returns the variable's default value.
*/
INLINE PN_int64 ConfigVariableInt64::
INLINE int64_t ConfigVariableInt64::
get_default_value() const {
const ConfigDeclaration *decl = ConfigVariable::get_default_value();
if (decl != (ConfigDeclaration *)NULL) {
@ -125,7 +125,7 @@ get_default_value() const {
/**
* Returns the variable's nth value.
*/
INLINE PN_int64 ConfigVariableInt64::
INLINE int64_t ConfigVariableInt64::
get_word(size_t n) const {
return get_int64_word(n);
}
@ -135,6 +135,6 @@ get_word(size_t n) const {
* variable's overall value.
*/
INLINE void ConfigVariableInt64::
set_word(size_t n, PN_int64 value) {
set_word(size_t n, int64_t value) {
set_int64_word(n, value);
}

View File

@ -18,6 +18,6 @@
*
*/
void ConfigVariableInt64::
set_default_value(PN_int64 default_value) {
set_default_value(int64_t default_value) {
_core->set_default_value(format_string(default_value));
}

View File

@ -25,34 +25,34 @@
class EXPCL_DTOOLCONFIG ConfigVariableInt64 : public ConfigVariable {
PUBLISHED:
INLINE ConfigVariableInt64(const string &name);
INLINE ConfigVariableInt64(const string &name, PN_int64 default_value,
INLINE ConfigVariableInt64(const string &name, int64_t default_value,
const string &description = string(),
int flags = 0);
INLINE ConfigVariableInt64(const string &name, const string &default_value,
const string &description = string(),
int flags = 0);
INLINE void operator = (PN_int64 value);
INLINE operator PN_int64 () const;
INLINE void operator = (int64_t value);
INLINE operator int64_t () const;
INLINE size_t size() const;
INLINE PN_int64 operator [] (size_t n) const;
INLINE int64_t operator [] (size_t n) const;
INLINE void set_value(PN_int64 value);
INLINE PN_int64 get_value() const;
INLINE PN_int64 get_default_value() const;
INLINE void set_value(int64_t value);
INLINE int64_t get_value() const;
INLINE int64_t get_default_value() const;
MAKE_PROPERTY(value, get_value, set_value);
MAKE_PROPERTY(default_value, get_default_value);
INLINE PN_int64 get_word(size_t n) const;
INLINE void set_word(size_t n, PN_int64 value);
INLINE int64_t get_word(size_t n) const;
INLINE void set_word(size_t n, int64_t value);
private:
void set_default_value(PN_int64 default_value);
void set_default_value(int64_t default_value);
private:
AtomicAdjust::Integer _local_modified;
PN_int64 _cache;
int64_t _cache;
};
#include "configVariableInt64.I"

View File

@ -276,12 +276,12 @@ open_write(ostream *dest, bool owns_dest, const string &password) {
// Now write the header information to the stream.
StreamWriter sw(_dest, false);
nassertv((PN_uint16)nid == nid);
sw.add_uint16((PN_uint16)nid);
nassertv((PN_uint16)key_length == key_length);
sw.add_uint16((PN_uint16)key_length);
nassertv((PN_uint16)count == count);
sw.add_uint16((PN_uint16)count);
nassertv((uint16_t)nid == nid);
sw.add_uint16((uint16_t)nid);
nassertv((uint16_t)key_length == key_length);
sw.add_uint16((uint16_t)key_length);
nassertv((uint16_t)count == count);
sw.add_uint16((uint16_t)count);
sw.append_data(iv, iv_length);
_write_valid = true;

View File

@ -54,24 +54,24 @@ get_data() const {
// this is for a intel compile .. it is native format and it is readable off
// word boundries
inline void TS_SetVal1(const PN_int8 * src, PN_int8 *dst)
inline void TS_SetVal1(const int8_t * src, int8_t *dst)
{
*dst = *src;
}
inline void TS_SetVal2(const char * src, char *dst)
{
*(reinterpret_cast<PN_int16 *>(dst)) = *(reinterpret_cast <const PN_int16 *>(src));
*(reinterpret_cast<int16_t *>(dst)) = *(reinterpret_cast <const int16_t *>(src));
}
inline void TS_SetVal4(const char * src, char *dst)
{
*(reinterpret_cast <PN_int32 *>(dst)) = *(reinterpret_cast <const PN_int32 *>(src));
*(reinterpret_cast <int32_t *>(dst)) = *(reinterpret_cast <const int32_t *>(src));
}
inline void TS_SetVal8(const char * src, char *dst)
{
*(reinterpret_cast<PN_int64 *>(dst)) = *(reinterpret_cast<const PN_int64 *>(src));
*(reinterpret_cast<int64_t *>(dst)) = *(reinterpret_cast<const int64_t *>(src));
}
template<class type> inline type TS_GetInteger(type &val,const char * _src)

View File

@ -83,25 +83,25 @@ get_bool() {
/**
* Extracts a signed 8-bit integer.
*/
INLINE PN_int8 StreamReader::
INLINE int8_t StreamReader::
get_int8() {
return (PN_int8)_in->get();
return (int8_t)_in->get();
}
/**
* Extracts an unsigned 8-bit integer.
*/
INLINE PN_uint8 StreamReader::
INLINE uint8_t StreamReader::
get_uint8() {
return (PN_uint8)_in->get();
return (uint8_t)_in->get();
}
/**
* Extracts a signed 16-bit integer.
*/
INLINE PN_int16 StreamReader::
INLINE int16_t StreamReader::
get_int16() {
PN_int16 readval, retval;
int16_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -111,9 +111,9 @@ get_int16() {
/**
* Extracts a signed 32-bit integer.
*/
INLINE PN_int32 StreamReader::
INLINE int32_t StreamReader::
get_int32() {
PN_int32 readval, retval;
int32_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -123,9 +123,9 @@ get_int32() {
/**
* Extracts a signed 64-bit integer.
*/
INLINE PN_int64 StreamReader::
INLINE int64_t StreamReader::
get_int64() {
PN_int64 readval, retval;
int64_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -135,9 +135,9 @@ get_int64() {
/**
* Extracts an unsigned 16-bit integer.
*/
INLINE PN_uint16 StreamReader::
INLINE uint16_t StreamReader::
get_uint16() {
PN_uint16 readval, retval;
uint16_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -147,9 +147,9 @@ get_uint16() {
/**
* Extracts an unsigned 32-bit integer.
*/
INLINE PN_uint32 StreamReader::
INLINE uint32_t StreamReader::
get_uint32() {
PN_uint32 readval, retval;
uint32_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -159,9 +159,9 @@ get_uint32() {
/**
* Extracts an unsigned 64-bit integer.
*/
INLINE PN_uint64 StreamReader::
INLINE uint64_t StreamReader::
get_uint64() {
PN_uint64 readval, retval;
uint64_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
LittleEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -202,9 +202,9 @@ get_float64() {
/**
* Extracts a signed big-endian 16-bit integer.
*/
INLINE PN_int16 StreamReader::
INLINE int16_t StreamReader::
get_be_int16() {
PN_int16 readval, retval;
int16_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -214,9 +214,9 @@ get_be_int16() {
/**
* Extracts a signed big-endian 32-bit integer.
*/
INLINE PN_int32 StreamReader::
INLINE int32_t StreamReader::
get_be_int32() {
PN_int32 readval, retval;
int32_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -226,9 +226,9 @@ get_be_int32() {
/**
* Extracts a signed big-endian 64-bit integer.
*/
INLINE PN_int64 StreamReader::
INLINE int64_t StreamReader::
get_be_int64() {
PN_int64 readval, retval;
int64_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -238,9 +238,9 @@ get_be_int64() {
/**
* Extracts an unsigned big-endian 16-bit integer.
*/
INLINE PN_uint16 StreamReader::
INLINE uint16_t StreamReader::
get_be_uint16() {
PN_uint16 readval, retval;
uint16_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -250,9 +250,9 @@ get_be_uint16() {
/**
* Extracts an unsigned big-endian 32-bit integer.
*/
INLINE PN_uint32 StreamReader::
INLINE uint32_t StreamReader::
get_be_uint32() {
PN_uint32 readval, retval;
uint32_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));
@ -262,9 +262,9 @@ get_be_uint32() {
/**
* Extracts an unsigned big-endian 64-bit integer.
*/
INLINE PN_uint64 StreamReader::
INLINE uint64_t StreamReader::
get_be_uint64() {
PN_uint64 readval, retval;
uint64_t readval, retval;
_in->read((char *)&readval, sizeof(readval));
BigEndian s(&readval, 0, sizeof(readval));
s.store_value(&retval, sizeof(retval));

View File

@ -37,24 +37,24 @@ PUBLISHED:
MAKE_PROPERTY(istream, get_istream);
BLOCKING INLINE bool get_bool();
BLOCKING INLINE PN_int8 get_int8();
BLOCKING INLINE PN_uint8 get_uint8();
BLOCKING INLINE int8_t get_int8();
BLOCKING INLINE uint8_t get_uint8();
BLOCKING INLINE PN_int16 get_int16();
BLOCKING INLINE PN_int32 get_int32();
BLOCKING INLINE PN_int64 get_int64();
BLOCKING INLINE PN_uint16 get_uint16();
BLOCKING INLINE PN_uint32 get_uint32();
BLOCKING INLINE PN_uint64 get_uint64();
BLOCKING INLINE int16_t get_int16();
BLOCKING INLINE int32_t get_int32();
BLOCKING INLINE int64_t get_int64();
BLOCKING INLINE uint16_t get_uint16();
BLOCKING INLINE uint32_t get_uint32();
BLOCKING INLINE uint64_t get_uint64();
BLOCKING INLINE float get_float32();
BLOCKING INLINE PN_float64 get_float64();
BLOCKING INLINE PN_int16 get_be_int16();
BLOCKING INLINE PN_int32 get_be_int32();
BLOCKING INLINE PN_int64 get_be_int64();
BLOCKING INLINE PN_uint16 get_be_uint16();
BLOCKING INLINE PN_uint32 get_be_uint32();
BLOCKING INLINE PN_uint64 get_be_uint64();
BLOCKING INLINE int16_t get_be_int16();
BLOCKING INLINE int32_t get_be_int32();
BLOCKING INLINE int64_t get_be_int64();
BLOCKING INLINE uint16_t get_be_uint16();
BLOCKING INLINE uint32_t get_be_uint32();
BLOCKING INLINE uint64_t get_be_uint64();
BLOCKING INLINE float get_be_float32();
BLOCKING INLINE PN_float64 get_be_float64();

View File

@ -92,7 +92,7 @@ add_bool(bool b) {
* Adds a signed 8-bit integer to the stream.
*/
INLINE void StreamWriter::
add_int8(PN_int8 value) {
add_int8(int8_t value) {
append_data(&value, 1);
}
@ -100,7 +100,7 @@ add_int8(PN_int8 value) {
* Adds an unsigned 8-bit integer to the stream.
*/
INLINE void StreamWriter::
add_uint8(PN_uint8 value) {
add_uint8(uint8_t value) {
append_data(&value, 1);
}
@ -108,7 +108,7 @@ add_uint8(PN_uint8 value) {
* Adds a signed 16-bit integer to the stream.
*/
INLINE void StreamWriter::
add_int16(PN_int16 value) {
add_int16(int16_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -117,7 +117,7 @@ add_int16(PN_int16 value) {
* Adds a signed 32-bit integer to the stream.
*/
INLINE void StreamWriter::
add_int32(PN_int32 value) {
add_int32(int32_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -126,7 +126,7 @@ add_int32(PN_int32 value) {
* Adds a signed 64-bit integer to the stream.
*/
INLINE void StreamWriter::
add_int64(PN_int64 value) {
add_int64(int64_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -135,7 +135,7 @@ add_int64(PN_int64 value) {
* Adds an unsigned 16-bit integer to the stream.
*/
INLINE void StreamWriter::
add_uint16(PN_uint16 value) {
add_uint16(uint16_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -144,7 +144,7 @@ add_uint16(PN_uint16 value) {
* Adds an unsigned 32-bit integer to the stream.
*/
INLINE void StreamWriter::
add_uint32(PN_uint32 value) {
add_uint32(uint32_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -153,7 +153,7 @@ add_uint32(PN_uint32 value) {
* Adds an unsigned 64-bit integer to the stream.
*/
INLINE void StreamWriter::
add_uint64(PN_uint64 value) {
add_uint64(uint64_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -186,7 +186,7 @@ add_float64(PN_float64 value) {
* Adds a signed 16-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_int16(PN_int16 value) {
add_be_int16(int16_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -195,7 +195,7 @@ add_be_int16(PN_int16 value) {
* Adds a signed 32-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_int32(PN_int32 value) {
add_be_int32(int32_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -204,7 +204,7 @@ add_be_int32(PN_int32 value) {
* Adds a signed 64-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_int64(PN_int64 value) {
add_be_int64(int64_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -213,7 +213,7 @@ add_be_int64(PN_int64 value) {
* Adds an unsigned 16-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_uint16(PN_uint16 value) {
add_be_uint16(uint16_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -222,7 +222,7 @@ add_be_uint16(PN_uint16 value) {
* Adds an unsigned 32-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_uint32(PN_uint32 value) {
add_be_uint32(uint32_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -231,7 +231,7 @@ add_be_uint32(PN_uint32 value) {
* Adds an unsigned 64-bit big-endian integer to the streamWriter.
*/
INLINE void StreamWriter::
add_be_uint64(PN_uint64 value) {
add_be_uint64(uint64_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -267,10 +267,10 @@ add_be_float64(PN_float64 value) {
INLINE void StreamWriter::
add_string(const string &str) {
// The max sendable length for a string is 2^16.
nassertv(str.length() <= (PN_uint16)0xffff);
nassertv(str.length() <= (uint16_t)0xffff);
// Strings always are preceded by their length
add_uint16((PN_uint16)str.length());
add_uint16((uint16_t)str.length());
// Add the string
append_data(str);
@ -282,7 +282,7 @@ add_string(const string &str) {
INLINE void StreamWriter::
add_string32(const string &str) {
// Strings always are preceded by their length
add_uint32((PN_uint32)str.length());
add_uint32((uint32_t)str.length());
// Add the string
append_data(str);

View File

@ -39,26 +39,26 @@ PUBLISHED:
MAKE_PROPERTY(ostream, get_ostream);
BLOCKING INLINE void add_bool(bool value);
BLOCKING INLINE void add_int8(PN_int8 value);
BLOCKING INLINE void add_uint8(PN_uint8 value);
BLOCKING INLINE void add_int8(int8_t value);
BLOCKING INLINE void add_uint8(uint8_t value);
// The default numeric packing is little-endian.
BLOCKING INLINE void add_int16(PN_int16 value);
BLOCKING INLINE void add_int32(PN_int32 value);
BLOCKING INLINE void add_int64(PN_int64 value);
BLOCKING INLINE void add_uint16(PN_uint16 value);
BLOCKING INLINE void add_uint32(PN_uint32 value);
BLOCKING INLINE void add_uint64(PN_uint64 value);
BLOCKING INLINE void add_int16(int16_t value);
BLOCKING INLINE void add_int32(int32_t value);
BLOCKING INLINE void add_int64(int64_t value);
BLOCKING INLINE void add_uint16(uint16_t value);
BLOCKING INLINE void add_uint32(uint32_t value);
BLOCKING INLINE void add_uint64(uint64_t value);
BLOCKING INLINE void add_float32(float value);
BLOCKING INLINE void add_float64(PN_float64 value);
// These functions pack numbers big-endian, in case that's desired.
BLOCKING INLINE void add_be_int16(PN_int16 value);
BLOCKING INLINE void add_be_int32(PN_int32 value);
BLOCKING INLINE void add_be_int64(PN_int64 value);
BLOCKING INLINE void add_be_uint16(PN_uint16 value);
BLOCKING INLINE void add_be_uint32(PN_uint32 value);
BLOCKING INLINE void add_be_uint64(PN_uint64 value);
BLOCKING INLINE void add_be_int16(int16_t value);
BLOCKING INLINE void add_be_int32(int32_t value);
BLOCKING INLINE void add_be_int64(int64_t value);
BLOCKING INLINE void add_be_uint16(uint16_t value);
BLOCKING INLINE void add_be_uint32(uint32_t value);
BLOCKING INLINE void add_be_uint64(uint64_t value);
BLOCKING INLINE void add_be_float32(float value);
BLOCKING INLINE void add_be_float64(PN_float64 value);

View File

@ -2203,7 +2203,7 @@ DTOOL_CONFIG=[
("PHAVE_DIRENT_H", 'UNDEF', '1'),
("PHAVE_SYS_SOUNDCARD_H", 'UNDEF', '1'),
("PHAVE_UCONTEXT_H", 'UNDEF', '1'),
("PHAVE_STDINT_H", 'UNDEF', '1'),
("PHAVE_STDINT_H", '1', '1'),
("HAVE_RTTI", '1', '1'),
("HAVE_X11", 'UNDEF', '1'),
("HAVE_XRANDR", 'UNDEF', '1'),

View File

@ -438,7 +438,7 @@ get_sound_data(MovieAudio *movie, int mode) {
}
int channels = stream->audio_channels();
int samples = (int)(stream->length() * stream->audio_rate());
PN_int16 *data = new PN_int16[samples * channels];
int16_t *data = new int16_t[samples * channels];
stream->read_samples(samples, data);
alBufferData(sd->_sample,
(channels>1) ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16,

View File

@ -383,8 +383,8 @@ read_stream_data(int bytelen, unsigned char *buffer) {
if (samples > _sd->_stream->ready()) {
samples = _sd->_stream->ready();
}
cursor->read_samples(samples, (PN_int16 *)buffer);
size_t hval = AddHash::add_hash(0, (PN_uint8*)buffer, samples*channels*2);
cursor->read_samples(samples, (int16_t *)buffer);
size_t hval = AddHash::add_hash(0, (uint8_t*)buffer, samples*channels*2);
audio_debug("Streaming " << cursor->get_source()->get_name() << " at " << t << " hash " << hval);
fill += samples;
space -= samples;

View File

@ -81,8 +81,8 @@ DisplayInformation() {
DisplayMode *display_mode_array;
int video_memory;
int texture_memory;
PN_uint64 physical_memory;
PN_uint64 available_physical_memory;
uint64_t physical_memory;
uint64_t available_physical_memory;
state = DisplayInformation::DS_unknown;
get_adapter_display_mode_state = false;
@ -325,7 +325,7 @@ update_memory_information() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_physical_memory() {
return _physical_memory;
}
@ -333,7 +333,7 @@ get_physical_memory() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_available_physical_memory() {
return _available_physical_memory;
}
@ -341,7 +341,7 @@ get_available_physical_memory() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_page_file_size() {
return _page_file_size;
}
@ -349,7 +349,7 @@ get_page_file_size() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_available_page_file_size() {
return _available_page_file_size;
}
@ -357,7 +357,7 @@ get_available_page_file_size() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_process_virtual_memory() {
return _process_virtual_memory;
}
@ -365,7 +365,7 @@ get_process_virtual_memory() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_available_process_virtual_memory() {
return _available_process_virtual_memory;
}
@ -381,7 +381,7 @@ get_memory_load() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_page_fault_count() {
return _page_fault_count;
}
@ -389,7 +389,7 @@ get_page_fault_count() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_process_memory() {
return _process_memory;
}
@ -397,7 +397,7 @@ get_process_memory() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_peak_process_memory() {
return _peak_process_memory;
}
@ -405,7 +405,7 @@ get_peak_process_memory() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_page_file_usage() {
return _page_file_usage;
}
@ -413,7 +413,7 @@ get_page_file_usage() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_peak_page_file_usage() {
return _peak_page_file_usage;
}
@ -570,7 +570,7 @@ get_cpu_brand_index() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_cpu_frequency() {
return _cpu_frequency;
}
@ -578,9 +578,9 @@ get_cpu_frequency() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_cpu_time() {
PN_uint64 cpu_time;
uint64_t cpu_time;
cpu_time = 0;
if (_cpu_time_function) {
@ -593,7 +593,7 @@ get_cpu_time() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_maximum_cpu_frequency() {
return _maximum_cpu_frequency;
}
@ -601,7 +601,7 @@ get_maximum_cpu_frequency() {
/**
*
*/
PN_uint64 DisplayInformation::
uint64_t DisplayInformation::
get_current_cpu_frequency() {
return _current_cpu_frequency;
}

View File

@ -69,18 +69,18 @@ PUBLISHED:
int get_texture_memory();
void update_memory_information();
PN_uint64 get_physical_memory();
PN_uint64 get_available_physical_memory();
PN_uint64 get_page_file_size();
PN_uint64 get_available_page_file_size();
PN_uint64 get_process_virtual_memory();
PN_uint64 get_available_process_virtual_memory();
uint64_t get_physical_memory();
uint64_t get_available_physical_memory();
uint64_t get_page_file_size();
uint64_t get_available_page_file_size();
uint64_t get_process_virtual_memory();
uint64_t get_available_process_virtual_memory();
int get_memory_load();
PN_uint64 get_page_fault_count();
PN_uint64 get_process_memory();
PN_uint64 get_peak_process_memory();
PN_uint64 get_page_file_usage();
PN_uint64 get_peak_page_file_usage();
uint64_t get_page_fault_count();
uint64_t get_process_memory();
uint64_t get_peak_process_memory();
uint64_t get_page_file_usage();
uint64_t get_peak_page_file_usage();
int get_vendor_id();
int get_device_id();
@ -103,11 +103,11 @@ PUBLISHED:
unsigned int get_cpu_version_information();
unsigned int get_cpu_brand_index();
PN_uint64 get_cpu_frequency();
PN_uint64 get_cpu_time();
uint64_t get_cpu_frequency();
uint64_t get_cpu_time();
PN_uint64 get_maximum_cpu_frequency();
PN_uint64 get_current_cpu_frequency();
uint64_t get_maximum_cpu_frequency();
uint64_t get_current_cpu_frequency();
void update_cpu_frequency(int processor_number);
int get_num_cpu_cores();
@ -131,18 +131,18 @@ public:
int _video_memory;
int _texture_memory;
PN_uint64 _physical_memory;
PN_uint64 _available_physical_memory;
PN_uint64 _page_file_size;
PN_uint64 _available_page_file_size;
PN_uint64 _process_virtual_memory;
PN_uint64 _available_process_virtual_memory;
uint64_t _physical_memory;
uint64_t _available_physical_memory;
uint64_t _page_file_size;
uint64_t _available_page_file_size;
uint64_t _process_virtual_memory;
uint64_t _available_process_virtual_memory;
PN_uint64 _page_fault_count;
PN_uint64 _process_memory;
PN_uint64 _peak_process_memory;
PN_uint64 _page_file_usage;
PN_uint64 _peak_page_file_usage;
uint64_t _page_fault_count;
uint64_t _process_memory;
uint64_t _peak_process_memory;
uint64_t _page_file_usage;
uint64_t _peak_page_file_usage;
int _memory_load;
@ -167,16 +167,16 @@ public:
unsigned int _cpu_version_information;
unsigned int _cpu_brand_index;
PN_uint64 _cpu_frequency;
uint64_t _cpu_frequency;
PN_uint64 _maximum_cpu_frequency;
PN_uint64 _current_cpu_frequency;
uint64_t _maximum_cpu_frequency;
uint64_t _current_cpu_frequency;
int _num_cpu_cores;
int _num_logical_cpus;
void (*_get_memory_information_function) (DisplayInformation *display_information);
PN_uint64 (*_cpu_time_function) (void);
uint64_t (*_cpu_time_function) (void);
int (*_update_cpu_frequency_function) (int processor_number, DisplayInformation *display_information);
int _os_version_major;

View File

@ -23,13 +23,13 @@
// Defines
// Written at the top of the file so we know this is a downloadDb
PN_uint32 DownloadDb::_magic_number = 0xfeedfeed;
uint32_t DownloadDb::_magic_number = 0xfeedfeed;
// Written at the top of the file to signify we are not done writing to the
// file yet. If you load a db with this magic number that means the previous
// time it got written out was probably interrupted in the middle of the
// write.
PN_uint32 DownloadDb::_bogus_magic_number = 0x11111111;
uint32_t DownloadDb::_bogus_magic_number = 0x11111111;
static string
@ -505,7 +505,7 @@ add_file_record(PT(FileRecord) fr) {
DownloadDb::Db::
Db() {
// The head is a magic number and the number of multifiles in the db
_header_length = sizeof(_magic_number) + sizeof(PN_int32);
_header_length = sizeof(_magic_number) + sizeof(int32_t);
}
@ -588,7 +588,7 @@ parse_header(const string &data) {
// Make sure we have a good header
DatagramIterator di(dg);
PN_uint32 magic_number = di.get_uint32();
uint32_t magic_number = di.get_uint32();
downloader_cat.debug()
<< "Parsed magic number: " << magic_number << endl;
// If the magic number is equal to the bogus magic number it signifies that
@ -608,7 +608,7 @@ parse_header(const string &data) {
return -1;
}
PN_int32 num_multifiles = di.get_int32();
int32_t num_multifiles = di.get_int32();
downloader_cat.debug()
<< "Parsed number of multifiles: " << num_multifiles << endl;
@ -626,7 +626,7 @@ int DownloadDb::Db::
parse_record_header(const string &data) {
Datagram dg(data);
DatagramIterator di(dg);
PN_int32 record_length = di.get_int32();
int32_t record_length = di.get_int32();
downloader_cat.spam()
<< "Parsed record header length: " << record_length << endl;
@ -645,7 +645,7 @@ parse_mfr(const string &data) {
Datagram dg(data);
DatagramIterator di(dg);
PN_int32 mfr_name_length = di.get_int32();
int32_t mfr_name_length = di.get_int32();
mfr->_name = di.extract_bytes(mfr_name_length);
mfr->_phase = di.get_float64();
mfr->_size = di.get_int32();
@ -682,7 +682,7 @@ parse_fr(const string &data) {
Datagram dg(data);
DatagramIterator di(dg);
PN_int32 fr_name_length = di.get_int32();
int32_t fr_name_length = di.get_int32();
fr->_name = di.extract_bytes(fr_name_length);
// At one time, we stored files in the database with a backslash separator.
@ -725,7 +725,7 @@ read(StreamReader &sr, bool want_server_info) {
for (int i = 0; i < num_multifiles; i++) {
// The multifile record header is just one int which represents the size
// of the record
int mfr_header_length = sizeof(PN_int32);
int mfr_header_length = sizeof(int32_t);
string mfr_header = sr.extract_bytes(mfr_header_length);
if (mfr_header.size() != (size_t)mfr_header_length) {
@ -755,7 +755,7 @@ read(StreamReader &sr, bool want_server_info) {
for (int j = 0; j < mfr->_num_files; j++) {
// The file record header is just one int which represents the size of
// the record
int fr_header_length = sizeof(PN_int32);
int fr_header_length = sizeof(int32_t);
// Read the header
string fr_header = sr.extract_bytes(fr_header_length);
@ -802,11 +802,11 @@ write(StreamWriter &sw, bool want_server_info) {
// Declare these outside the loop so we do not keep creating and deleting
// them
PN_float64 phase;
PN_int32 size;
PN_int32 status;
PN_int32 num_files;
PN_int32 name_length;
PN_int32 header_length;
int32_t size;
int32_t status;
int32_t num_files;
int32_t name_length;
int32_t header_length;
// Iterate over the multifiles writing them to the stream
pvector< PT(MultifileRecord) >::const_iterator i = _mfile_records.begin();
@ -825,7 +825,7 @@ write(StreamWriter &sw, bool want_server_info) {
(*i)->_name.length() + // Size of the name string
sizeof(phase) + sizeof(size) +
sizeof(status) + sizeof(num_files) +
sizeof(PN_uint32)*4; // Size of hash value
sizeof(uint32_t)*4; // Size of hash value
// Add the length of this entire datagram
sw.add_int32(header_length);

View File

@ -156,7 +156,7 @@ public:
int _size;
int _status;
HashVal _hash;
PN_int32 _num_files;
int32_t _num_files;
FileRecords _file_records;
};
@ -182,7 +182,7 @@ public:
bool write_header(ostream &write_stream);
bool write_bogus_header(StreamWriter &sw);
private:
PN_int32 _header_length;
int32_t _header_length;
};
PUBLISHED:
@ -197,8 +197,8 @@ public:
Db _server_db;
// Magic number for knowing this is a download Db
static PN_uint32 _magic_number;
static PN_uint32 _bogus_magic_number;
static uint32_t _magic_number;
static uint32_t _bogus_magic_number;
typedef pvector<HashVal> VectorHash;
typedef pmap<Filename, VectorHash> VersionMap;

View File

@ -127,15 +127,15 @@ init_libexpress() {
// This is a fine place to ensure that the numeric types have been chosen
// correctly.
nassertv(sizeof(PN_int8) == 1 && sizeof(PN_uint8) == 1);
nassertv(sizeof(PN_int16) == 2 && sizeof(PN_uint16) == 2);
nassertv(sizeof(PN_int32) == 4 && sizeof(PN_uint32) == 4);
nassertv(sizeof(PN_int64) == 8 && sizeof(PN_uint64) == 8);
nassertv(sizeof(int8_t) == 1 && sizeof(uint8_t) == 1);
nassertv(sizeof(int16_t) == 2 && sizeof(uint16_t) == 2);
nassertv(sizeof(int32_t) == 4 && sizeof(uint32_t) == 4);
nassertv(sizeof(int64_t) == 8 && sizeof(uint64_t) == 8);
nassertv(sizeof(PN_float32) == 4);
nassertv(sizeof(PN_float64) == 8);
// Also, ensure that we have the right endianness.
PN_uint32 word;
uint32_t word;
memcpy(&word, "\1\2\3\4", 4);
#ifdef WORDS_BIGENDIAN
nassertv(word == 0x01020304);

View File

@ -106,7 +106,7 @@ add_bool(bool b) {
* Adds a signed 8-bit integer to the datagram.
*/
INLINE void Datagram::
add_int8(PN_int8 value) {
add_int8(int8_t value) {
append_data(&value, 1);
}
@ -114,7 +114,7 @@ add_int8(PN_int8 value) {
* Adds an unsigned 8-bit integer to the datagram.
*/
INLINE void Datagram::
add_uint8(PN_uint8 value) {
add_uint8(uint8_t value) {
append_data(&value, 1);
}
@ -122,7 +122,7 @@ add_uint8(PN_uint8 value) {
* Adds a signed 16-bit integer to the datagram.
*/
INLINE void Datagram::
add_int16(PN_int16 value) {
add_int16(int16_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -131,7 +131,7 @@ add_int16(PN_int16 value) {
* Adds a signed 32-bit integer to the datagram.
*/
INLINE void Datagram::
add_int32(PN_int32 value) {
add_int32(int32_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -140,7 +140,7 @@ add_int32(PN_int32 value) {
* Adds a signed 64-bit integer to the datagram.
*/
INLINE void Datagram::
add_int64(PN_int64 value) {
add_int64(int64_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -149,7 +149,7 @@ add_int64(PN_int64 value) {
* Adds an unsigned 16-bit integer to the datagram.
*/
INLINE void Datagram::
add_uint16(PN_uint16 value) {
add_uint16(uint16_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -158,7 +158,7 @@ add_uint16(PN_uint16 value) {
* Adds an unsigned 32-bit integer to the datagram.
*/
INLINE void Datagram::
add_uint32(PN_uint32 value) {
add_uint32(uint32_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -167,7 +167,7 @@ add_uint32(PN_uint32 value) {
* Adds an unsigned 64-bit integer to the datagram.
*/
INLINE void Datagram::
add_uint64(PN_uint64 value) {
add_uint64(uint64_t value) {
LittleEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -209,7 +209,7 @@ add_stdfloat(PN_stdfloat value) {
* Adds a signed 16-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_int16(PN_int16 value) {
add_be_int16(int16_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -218,7 +218,7 @@ add_be_int16(PN_int16 value) {
* Adds a signed 32-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_int32(PN_int32 value) {
add_be_int32(int32_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -227,7 +227,7 @@ add_be_int32(PN_int32 value) {
* Adds a signed 64-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_int64(PN_int64 value) {
add_be_int64(int64_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -236,7 +236,7 @@ add_be_int64(PN_int64 value) {
* Adds an unsigned 16-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_uint16(PN_uint16 value) {
add_be_uint16(uint16_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -245,7 +245,7 @@ add_be_uint16(PN_uint16 value) {
* Adds an unsigned 32-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_uint32(PN_uint32 value) {
add_be_uint32(uint32_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -254,7 +254,7 @@ add_be_uint32(PN_uint32 value) {
* Adds an unsigned 64-bit big-endian integer to the datagram.
*/
INLINE void Datagram::
add_be_uint64(PN_uint64 value) {
add_be_uint64(uint64_t value) {
BigEndian s(&value, sizeof(value));
append_data(s.get_data(), sizeof(value));
}
@ -285,10 +285,10 @@ add_be_float64(PN_float64 value) {
INLINE void Datagram::
add_string(const string &str) {
// The max sendable length for a string is 2^16.
nassertv(str.length() <= (PN_uint16)0xffff);
nassertv(str.length() <= (uint16_t)0xffff);
// Strings always are preceded by their length
add_uint16((PN_uint16)str.length());
add_uint16((uint16_t)str.length());
// Add the string
append_data(str);
@ -301,7 +301,7 @@ add_string(const string &str) {
INLINE void Datagram::
add_string32(const string &str) {
// Strings always are preceded by their length
add_uint32((PN_uint32)str.length());
add_uint32((uint32_t)str.length());
// Add the string
append_data(str);

View File

@ -82,13 +82,13 @@ dump_hex(ostream &out, unsigned int indent) const {
void Datagram::
add_wstring(const wstring &str) {
// By convention, wstrings are marked with 32-bit lengths.
add_uint32((PN_uint32)str.length());
add_uint32((uint32_t)str.length());
// Now append each character in the string. We store each code little-
// endian, for no real good reason.
wstring::const_iterator ci;
for (ci = str.begin(); ci != str.end(); ++ci) {
add_uint16((PN_uint16)*ci);
add_uint16((uint16_t)*ci);
}
}

View File

@ -54,27 +54,27 @@ PUBLISHED:
void dump_hex(ostream &out, unsigned int indent=0) const;
INLINE void add_bool(bool value);
INLINE void add_int8(PN_int8 value);
INLINE void add_uint8(PN_uint8 value);
INLINE void add_int8(int8_t value);
INLINE void add_uint8(uint8_t value);
// The default numeric packing is little-endian.
INLINE void add_int16(PN_int16 value);
INLINE void add_int32(PN_int32 value);
INLINE void add_int64(PN_int64 value);
INLINE void add_uint16(PN_uint16 value);
INLINE void add_uint32(PN_uint32 value);
INLINE void add_uint64(PN_uint64 value);
INLINE void add_int16(int16_t value);
INLINE void add_int32(int32_t value);
INLINE void add_int64(int64_t value);
INLINE void add_uint16(uint16_t value);
INLINE void add_uint32(uint32_t value);
INLINE void add_uint64(uint64_t value);
INLINE void add_float32(PN_float32 value);
INLINE void add_float64(PN_float64 value);
INLINE void add_stdfloat(PN_stdfloat value);
// These functions pack numbers big-endian, in case that's desired.
INLINE void add_be_int16(PN_int16 value);
INLINE void add_be_int32(PN_int32 value);
INLINE void add_be_int64(PN_int64 value);
INLINE void add_be_uint16(PN_uint16 value);
INLINE void add_be_uint32(PN_uint32 value);
INLINE void add_be_uint64(PN_uint64 value);
INLINE void add_be_int16(int16_t value);
INLINE void add_be_int32(int32_t value);
INLINE void add_be_int64(int64_t value);
INLINE void add_be_uint16(uint16_t value);
INLINE void add_be_uint32(uint32_t value);
INLINE void add_be_uint64(uint64_t value);
INLINE void add_be_float32(PN_float32 value);
INLINE void add_be_float64(PN_float64 value);

View File

@ -75,14 +75,14 @@ get_bool() {
/**
* Extracts a signed 8-bit integer.
*/
INLINE PN_int8 DatagramIterator::
INLINE int8_t DatagramIterator::
get_int8() {
nassertr(_datagram != (const Datagram *)NULL, 0);
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index < _datagram->get_length(), 0);
// Get the Data:
const char *ptr = (const char *)_datagram->get_data();
PN_int8 tempvar = (PN_int8)ptr[_current_index];
int8_t tempvar = (int8_t)ptr[_current_index];
++_current_index;
return tempvar;
@ -91,14 +91,14 @@ get_int8() {
/**
* Extracts an unsigned 8-bit integer.
*/
INLINE PN_uint8 DatagramIterator::
INLINE uint8_t DatagramIterator::
get_uint8() {
nassertr(_datagram != (const Datagram *)NULL, 0);
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index < _datagram->get_length(), 0);
// Get the Data:
const char *ptr = (const char *)_datagram->get_data();
PN_uint8 tempvar = (PN_uint8)ptr[_current_index];
uint8_t tempvar = (uint8_t)ptr[_current_index];
++_current_index;
return tempvar;
@ -107,12 +107,12 @@ get_uint8() {
/**
* Extracts a signed 16-bit integer.
*/
INLINE PN_int16 DatagramIterator::
INLINE int16_t DatagramIterator::
get_int16() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int16 tempvar;
int16_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -126,12 +126,12 @@ get_int16() {
/**
* Extracts a signed 32-bit integer.
*/
INLINE PN_int32 DatagramIterator::
INLINE int32_t DatagramIterator::
get_int32() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int32 tempvar;
int32_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -145,12 +145,12 @@ get_int32() {
/**
* Extracts a signed 64-bit integer.
*/
INLINE PN_int64 DatagramIterator::
INLINE int64_t DatagramIterator::
get_int64() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int64 tempvar;
int64_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -164,12 +164,12 @@ get_int64() {
/**
* Extracts an unsigned 16-bit integer.
*/
INLINE PN_uint16 DatagramIterator::
INLINE uint16_t DatagramIterator::
get_uint16() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint16 tempvar;
uint16_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -183,12 +183,12 @@ get_uint16() {
/**
* Extracts an unsigned 32-bit integer.
*/
INLINE PN_uint32 DatagramIterator::
INLINE uint32_t DatagramIterator::
get_uint32() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint32 tempvar;
uint32_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -202,12 +202,12 @@ get_uint32() {
/**
* Extracts an unsigned 64-bit integer.
*/
INLINE PN_uint64 DatagramIterator::
INLINE uint64_t DatagramIterator::
get_uint64() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint64 tempvar;
uint64_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -274,12 +274,12 @@ get_stdfloat() {
/**
* Extracts a signed 16-bit big-endian integer.
*/
INLINE PN_int16 DatagramIterator::
INLINE int16_t DatagramIterator::
get_be_int16() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int16 tempvar;
int16_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -293,12 +293,12 @@ get_be_int16() {
/**
* Extracts a signed 32-bit big-endian integer.
*/
INLINE PN_int32 DatagramIterator::
INLINE int32_t DatagramIterator::
get_be_int32() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int32 tempvar;
int32_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -312,12 +312,12 @@ get_be_int32() {
/**
* Extracts a signed 64-bit big-endian integer.
*/
INLINE PN_int64 DatagramIterator::
INLINE int64_t DatagramIterator::
get_be_int64() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_int64 tempvar;
int64_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -331,12 +331,12 @@ get_be_int64() {
/**
* Extracts an unsigned 16-bit big-endian integer.
*/
INLINE PN_uint16 DatagramIterator::
INLINE uint16_t DatagramIterator::
get_be_uint16() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint16 tempvar;
uint16_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -350,12 +350,12 @@ get_be_uint16() {
/**
* Extracts an unsigned 32-bit big-endian integer.
*/
INLINE PN_uint32 DatagramIterator::
INLINE uint32_t DatagramIterator::
get_be_uint32() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint32 tempvar;
uint32_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:
@ -369,12 +369,12 @@ get_be_uint32() {
/**
* Extracts an unsigned 64-bit big-endian integer.
*/
INLINE PN_uint64 DatagramIterator::
INLINE uint64_t DatagramIterator::
get_be_uint64() {
nassertr(_datagram != (const Datagram *)NULL, 0);
nassertr(_current_index < _datagram->get_length(), 0);
PN_uint64 tempvar;
uint64_t tempvar;
// Avoid reading junk data off the end of the datagram:
nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
// Get the Data:

View File

@ -22,7 +22,7 @@ TypeHandle DatagramIterator::_type_handle;
string DatagramIterator::
get_string() {
// First, get the length of the string
PN_uint16 s_len = get_uint16();
uint16_t s_len = get_uint16();
nassertr(_datagram != (const Datagram *)NULL, "");
nassertr(_current_index + s_len <= _datagram->get_length(), "");
@ -41,7 +41,7 @@ get_string() {
string DatagramIterator::
get_string32() {
// First, get the length of the string
PN_uint32 s_len = get_uint32();
uint32_t s_len = get_uint32();
nassertr(_datagram != (const Datagram *)NULL, "");
nassertr(_current_index + s_len <= _datagram->get_length(), "");
@ -100,7 +100,7 @@ get_fixed_string(size_t size) {
wstring DatagramIterator::
get_wstring() {
// First, get the length of the string
PN_uint32 s_len = get_uint32();
uint32_t s_len = get_uint32();
nassertr(_datagram != (const Datagram *)NULL, wstring());
nassertr(_current_index + s_len * 2 <= _datagram->get_length(), wstring());

View File

@ -36,25 +36,25 @@ PUBLISHED:
INLINE ~DatagramIterator();
INLINE bool get_bool();
INLINE PN_int8 get_int8();
INLINE PN_uint8 get_uint8();
INLINE int8_t get_int8();
INLINE uint8_t get_uint8();
INLINE PN_int16 get_int16();
INLINE PN_int32 get_int32();
INLINE PN_int64 get_int64();
INLINE PN_uint16 get_uint16();
INLINE PN_uint32 get_uint32();
INLINE PN_uint64 get_uint64();
INLINE int16_t get_int16();
INLINE int32_t get_int32();
INLINE int64_t get_int64();
INLINE uint16_t get_uint16();
INLINE uint32_t get_uint32();
INLINE uint64_t get_uint64();
INLINE PN_float32 get_float32();
INLINE PN_float64 get_float64();
INLINE PN_stdfloat get_stdfloat();
INLINE PN_int16 get_be_int16();
INLINE PN_int32 get_be_int32();
INLINE PN_int64 get_be_int64();
INLINE PN_uint16 get_be_uint16();
INLINE PN_uint32 get_be_uint32();
INLINE PN_uint64 get_be_uint64();
INLINE int16_t get_be_int16();
INLINE int32_t get_be_int32();
INLINE int64_t get_be_int64();
INLINE uint16_t get_be_uint16();
INLINE uint32_t get_be_uint32();
INLINE uint64_t get_be_uint64();
INLINE PN_float32 get_be_float32();
INLINE PN_float64 get_be_float64();

View File

@ -258,7 +258,7 @@ hash_buffer(const char *buffer, int length) {
* at the indicated buffer and the following 8 positions.
*/
void HashVal::
encode_hex(PN_uint32 val, char *buffer) {
encode_hex(uint32_t val, char *buffer) {
buffer[0] = tohex(val >> 28);
buffer[1] = tohex(val >> 24);
buffer[2] = tohex(val >> 20);
@ -273,7 +273,7 @@ encode_hex(PN_uint32 val, char *buffer) {
* Decodes the indicated eight-digit hex string into an unsigned integer.
*/
void HashVal::
decode_hex(const char *buffer, PN_uint32 &val) {
decode_hex(const char *buffer, uint32_t &val) {
unsigned int bytes[8];
for (int i = 0; i < 8; i++) {
bytes[i] = fromhex(buffer[i]);

View File

@ -72,12 +72,12 @@ PUBLISHED:
#endif // HAVE_OPENSSL
private:
static void encode_hex(PN_uint32 val, char *buffer);
static void decode_hex(const char *buffer, PN_uint32 &val);
static void encode_hex(uint32_t val, char *buffer);
static void decode_hex(const char *buffer, uint32_t &val);
INLINE static char tohex(unsigned int nibble);
INLINE static unsigned int fromhex(char digit);
PN_uint32 _hv[4];
uint32_t _hv[4];
};
INLINE ostream &operator << (ostream &out, const HashVal &hv);

View File

@ -460,7 +460,7 @@ MemoryUsage(const MemoryHook &copy) : MemoryHook(copy) {
_count_memory_usage = false;
PN_int64 max_heap_size = ConfigVariableInt64
int64_t max_heap_size = ConfigVariableInt64
("max-heap-size", 0,
PRC_DESC("If this is nonzero, it is the maximum number of bytes expected "
"to be allocated on the heap before we enter report-memory-usage "

View File

@ -860,7 +860,7 @@ add_signature(const Multifile::CertChain &cert_chain, EVP_PKEY *pkey) {
// Now encode that list of certs to a stream in DER form.
stringstream der_stream;
StreamWriter der_writer(der_stream);
der_writer.add_uint32((PN_uint32)cert_chain.size());
der_writer.add_uint32((uint32_t)cert_chain.size());
CertChain::const_iterator ci;
for (ci = cert_chain.begin(); ci != cert_chain.end(); ++ci) {

View File

@ -61,19 +61,19 @@ const int _v1_header_length = 4 + 2 + 4 + 16 + 4 + 16;
*/
// Defines
const PN_uint32 Patchfile::_v0_magic_number = 0xfeebfaab;
const PN_uint32 Patchfile::_magic_number = 0xfeebfaac;
const uint32_t Patchfile::_v0_magic_number = 0xfeebfaab;
const uint32_t Patchfile::_magic_number = 0xfeebfaac;
// Created version 1 on 11202 to store length and MD5 of original file. To
// version 2 on 11202 to store copy offsets as relative.
const PN_uint16 Patchfile::_current_version = 2;
const uint16_t Patchfile::_current_version = 2;
const PN_uint32 Patchfile::_HASH_BITS = 24;
const PN_uint32 Patchfile::_HASHTABLESIZE = PN_uint32(1) << Patchfile::_HASH_BITS;
const PN_uint32 Patchfile::_DEFAULT_FOOTPRINT_LENGTH = 9; // this produced the smallest patch file for libpanda.dll when tested, 12/20/2000
const PN_uint32 Patchfile::_NULL_VALUE = PN_uint32(0) - 1;
const PN_uint32 Patchfile::_MAX_RUN_LENGTH = (PN_uint32(1) << 16) - 1;
const PN_uint32 Patchfile::_HASH_MASK = (PN_uint32(1) << Patchfile::_HASH_BITS) - 1;
const uint32_t Patchfile::_HASH_BITS = 24;
const uint32_t Patchfile::_HASHTABLESIZE = uint32_t(1) << Patchfile::_HASH_BITS;
const uint32_t Patchfile::_DEFAULT_FOOTPRINT_LENGTH = 9; // this produced the smallest patch file for libpanda.dll when tested, 12/20/2000
const uint32_t Patchfile::_NULL_VALUE = uint32_t(0) - 1;
const uint32_t Patchfile::_MAX_RUN_LENGTH = (uint32_t(1) << 16) - 1;
const uint32_t Patchfile::_HASH_MASK = (uint32_t(1) << Patchfile::_HASH_BITS) - 1;
/**
* Create a patch file and initializes internal data
@ -118,7 +118,7 @@ init(PT(Buffer) buffer) {
*/
Patchfile::
~Patchfile() {
if (_hash_table != (PN_uint32 *)NULL) {
if (_hash_table != (uint32_t *)NULL) {
PANDA_FREE_ARRAY(_hash_table);
}
@ -261,9 +261,9 @@ run() {
// Now patch the file using the given buffer
int buflen;
int bytes_read;
PN_uint16 ADD_length;
PN_uint16 COPY_length;
PN_int32 COPY_offset;
uint16_t ADD_length;
uint16_t COPY_length;
int32_t COPY_offset;
if (_initiated == false) {
express_cat.error()
@ -305,9 +305,9 @@ run() {
<< _write_stream.tellp() << ")" << endl;
}
PN_uint32 bytes_left = (PN_uint32)ADD_length;
uint32_t bytes_left = (uint32_t)ADD_length;
while (bytes_left > 0) {
PN_uint32 bytes_this_time = (PN_uint32) min(bytes_left, (PN_uint32) buflen);
uint32_t bytes_this_time = (uint32_t) min(bytes_left, (uint32_t) buflen);
_patch_stream->read(_buffer->_buffer, bytes_this_time);
if (_patch_stream->fail()) {
express_cat.error()
@ -368,10 +368,10 @@ run() {
}
// read the copy bytes from original file and write them to output
PN_uint32 bytes_left = (PN_uint32)COPY_length;
uint32_t bytes_left = (uint32_t)COPY_length;
while (bytes_left > 0) {
PN_uint32 bytes_this_time = (PN_uint32) min(bytes_left, (PN_uint32) buflen);
uint32_t bytes_this_time = (uint32_t) min(bytes_left, (uint32_t) buflen);
_origfile_stream->read(_buffer->_buffer, bytes_this_time);
if (_origfile_stream->fail()) {
express_cat.error()
@ -535,7 +535,7 @@ internal_read_header(const Filename &patch_file) {
// check the magic number
nassertr(_buffer->get_length() >= _v0_header_length, false);
PN_uint32 magic_number = patch_reader.get_uint32();
uint32_t magic_number = patch_reader.get_uint32();
if (magic_number != _magic_number && magic_number != _v0_magic_number) {
express_cat.error()
<< "Invalid patch file: " << _patch_file << endl;
@ -555,7 +555,7 @@ internal_read_header(const Filename &patch_file) {
if (_version_number >= 1) {
// Get the length of the source file.
/*PN_uint32 source_file_length =*/ patch_reader.get_uint32();
/*uint32_t source_file_length =*/ patch_reader.get_uint32();
// get the MD5 of the source file.
_MD5_ofSource.read_stream(patch_reader);
@ -578,22 +578,22 @@ internal_read_header(const Filename &patch_file) {
/**
*
*/
PN_uint32 Patchfile::
uint32_t Patchfile::
calc_hash(const char *buffer) {
#ifdef USE_MD5_FOR_HASHTABLE_INDEX_VALUES
HashVal hash;
hash.hash_buffer(buffer, _footprint_length);
// cout << PN_uint16(hash.get_value(0)) << " ";
// cout << uint16_t(hash.get_value(0)) << " ";
return PN_uint16(hash.get_value(0));
return uint16_t(hash.get_value(0));
#else
PN_uint32 hash_value = 0;
uint32_t hash_value = 0;
for(int i = 0; i < (int)_footprint_length; i++) {
// this is probably not such a good hash. to be replaced --> TRIED MD5,
// was not worth it for the execution-time hit on 800Mhz PC
hash_value ^= PN_uint32(*buffer) << ((i * 2) % Patchfile::_HASH_BITS);
hash_value ^= uint32_t(*buffer) << ((i * 2) % Patchfile::_HASH_BITS);
buffer++;
}
@ -624,10 +624,10 @@ calc_hash(const char *buffer) {
* can rapidly produce a list of offsets that all have the same footprint.
*/
void Patchfile::
build_hash_link_tables(const char *buffer_orig, PN_uint32 length_orig,
PN_uint32 *hash_table, PN_uint32 *link_table) {
build_hash_link_tables(const char *buffer_orig, uint32_t length_orig,
uint32_t *hash_table, uint32_t *link_table) {
PN_uint32 i;
uint32_t i;
// clear hash table
for(i = 0; i < _HASHTABLESIZE; i++) {
@ -644,7 +644,7 @@ build_hash_link_tables(const char *buffer_orig, PN_uint32 length_orig,
// run through original file and hash each footprint
for(i = 0; i < (length_orig - _footprint_length); i++) {
PN_uint32 hash_value = calc_hash(&buffer_orig[i]);
uint32_t hash_value = calc_hash(&buffer_orig[i]);
// we must now store this file index in the hash table at the offset of
// the hash value
@ -669,7 +669,7 @@ build_hash_link_tables(const char *buffer_orig, PN_uint32 length_orig,
hash_table[hash_value] = i;
} else {
// hash entry is taken, go to the link table
PN_uint32 link_offset = hash_table[hash_value];
uint32_t link_offset = hash_table[hash_value];
while (_NULL_VALUE != link_table[link_offset]) {
link_offset = link_table[link_offset];
@ -684,9 +684,9 @@ build_hash_link_tables(const char *buffer_orig, PN_uint32 length_orig,
*
* This function calculates the length of a match between two strings of bytes
*/
PN_uint32 Patchfile::
calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length,
PN_uint32 min_length) {
uint32_t Patchfile::
calc_match_length(const char* buf1, const char* buf2, uint32_t max_length,
uint32_t min_length) {
// early out: look ahead and sample the end of the minimum range
if (min_length > 2) {
if (min_length >= max_length)
@ -698,7 +698,7 @@ calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length,
}
}
PN_uint32 length = 0;
uint32_t length = 0;
while ((length < max_length) && (*buf1 == *buf2)) {
buf1++, buf2++, length++;
}
@ -711,15 +711,15 @@ calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length,
* matches a string in the new file.
*/
void Patchfile::
find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_length,
PN_uint32 *hash_table, PN_uint32 *link_table, const char* buffer_orig,
PN_uint32 length_orig, const char* buffer_new, PN_uint32 length_new) {
find_longest_match(uint32_t new_pos, uint32_t &copy_pos, uint16_t &copy_length,
uint32_t *hash_table, uint32_t *link_table, const char* buffer_orig,
uint32_t length_orig, const char* buffer_new, uint32_t length_new) {
// set length to a safe value
copy_length = 0;
// get offset of matching string (in orig file) from hash table
PN_uint32 hash_value = calc_hash(&buffer_new[new_pos]);
uint32_t hash_value = calc_hash(&buffer_new[new_pos]);
// if no match, bail
if (_NULL_VALUE == hash_table[hash_value])
@ -728,7 +728,7 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_lengt
copy_pos = hash_table[hash_value];
// calc match length
copy_length = (PN_uint16)calc_match_length(&buffer_new[new_pos],
copy_length = (uint16_t)calc_match_length(&buffer_new[new_pos],
&buffer_orig[copy_pos],
min(min((length_new - new_pos),
(length_orig - copy_pos)),
@ -736,12 +736,12 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_lengt
0);
// run through link table, see if we find any longer matches
PN_uint32 match_offset;
PN_uint16 match_length;
uint32_t match_offset;
uint16_t match_length;
match_offset = link_table[copy_pos];
while (match_offset != _NULL_VALUE) {
match_length = (PN_uint16)calc_match_length(&buffer_new[new_pos],
match_length = (uint16_t)calc_match_length(&buffer_new[new_pos],
&buffer_orig[match_offset],
min(min((length_new - new_pos),
(length_orig - match_offset)),
@ -763,8 +763,8 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_lengt
*
*/
void Patchfile::
emit_ADD(ostream &write_stream, PN_uint32 length, const char* buffer) {
nassertv(length == (PN_uint16)length); //we only write a uint16
emit_ADD(ostream &write_stream, uint32_t length, const char* buffer) {
nassertv(length == (uint16_t)length); //we only write a uint16
if (express_cat.is_spam()) {
express_cat.spam()
@ -773,11 +773,11 @@ emit_ADD(ostream &write_stream, PN_uint32 length, const char* buffer) {
// write ADD length
StreamWriter patch_writer(write_stream);
patch_writer.add_uint16((PN_uint16)length);
patch_writer.add_uint16((uint16_t)length);
// if there are bytes to add, add them
if (length > 0) {
patch_writer.append_data(buffer, (PN_uint16)length);
patch_writer.append_data(buffer, (uint16_t)length);
}
_add_pos += length;
@ -787,10 +787,10 @@ emit_ADD(ostream &write_stream, PN_uint32 length, const char* buffer) {
*
*/
void Patchfile::
emit_COPY(ostream &write_stream, PN_uint32 length, PN_uint32 copy_pos) {
nassertv(length == (PN_uint16)length); //we only write a uint16
emit_COPY(ostream &write_stream, uint32_t length, uint32_t copy_pos) {
nassertv(length == (uint16_t)length); //we only write a uint16
PN_int32 offset = (int)copy_pos - (int)_last_copy_pos;
int32_t offset = (int)copy_pos - (int)_last_copy_pos;
if (express_cat.is_spam()) {
express_cat.spam()
<< "COPY: " << length << " bytes from offset " << offset
@ -799,9 +799,9 @@ emit_COPY(ostream &write_stream, PN_uint32 length, PN_uint32 copy_pos) {
// write COPY length
StreamWriter patch_writer(write_stream);
patch_writer.add_uint16((PN_uint16)length);
patch_writer.add_uint16((uint16_t)length);
if ((PN_uint16)length != 0) {
if ((uint16_t)length != 0) {
// write COPY offset
patch_writer.add_int32(offset);
_last_copy_pos = copy_pos + length;
@ -816,14 +816,14 @@ emit_COPY(ostream &write_stream, PN_uint32 length, PN_uint32 copy_pos) {
*/
void Patchfile::
emit_add_and_copy(ostream &write_stream,
PN_uint32 add_length, const char *add_buffer,
PN_uint32 copy_length, PN_uint32 copy_pos) {
uint32_t add_length, const char *add_buffer,
uint32_t copy_length, uint32_t copy_pos) {
if (add_length == 0 && copy_length == 0) {
// Don't accidentally emit a termination code.
return;
}
static const PN_uint16 max_write = 65535;
static const uint16_t max_write = 65535;
while (add_length > max_write) {
// Overflow. This chunk is too large to fit into a single ADD block, so
// we have to write it as multiple ADDs.
@ -852,8 +852,8 @@ emit_add_and_copy(ostream &write_stream,
*/
void Patchfile::
cache_add_and_copy(ostream &write_stream,
PN_uint32 add_length, const char *add_buffer,
PN_uint32 copy_length, PN_uint32 copy_pos) {
uint32_t add_length, const char *add_buffer,
uint32_t copy_length, uint32_t copy_pos) {
if (add_length != 0) {
if (_cache_copy_length != 0) {
// Have to flush.
@ -912,7 +912,7 @@ write_header(ostream &write_stream,
stream_orig.seekg(0, ios::end);
streampos source_file_length = stream_orig.tellg();
patch_writer.add_uint32((PN_uint32)source_file_length);
patch_writer.add_uint32((uint32_t)source_file_length);
// calc MD5 of original file
_MD5_ofSource.hash_stream(stream_orig);
@ -926,7 +926,7 @@ write_header(ostream &write_stream,
stream_new.seekg(0, ios::end);
streampos result_file_length = stream_new.tellg();
patch_writer.add_uint32((PN_uint32)result_file_length);
patch_writer.add_uint32((uint32_t)result_file_length);
// calc MD5 of resultant patched file
_MD5_ofResult.hash_stream(stream_new);
@ -958,12 +958,12 @@ write_terminator(ostream &write_stream) {
*/
bool Patchfile::
compute_file_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new) {
// read in original file
stream_orig.seekg(0, ios::end);
nassertr(stream_orig, false);
PN_uint32 source_file_length = stream_orig.tellg();
uint32_t source_file_length = stream_orig.tellg();
if (express_cat.is_debug()) {
express_cat.debug()
<< "Allocating " << source_file_length << " bytes to read orig\n";
@ -975,7 +975,7 @@ compute_file_patches(ostream &write_stream,
// read in new file
stream_new.seekg(0, ios::end);
PN_uint32 result_file_length = stream_new.tellg();
uint32_t result_file_length = stream_new.tellg();
nassertr(stream_new, false);
if (express_cat.is_debug()) {
express_cat.debug()
@ -987,12 +987,12 @@ compute_file_patches(ostream &write_stream,
stream_new.read(buffer_new, result_file_length);
// allocate hashlink tables
if (_hash_table == (PN_uint32 *)NULL) {
if (_hash_table == (uint32_t *)NULL) {
if (express_cat.is_debug()) {
express_cat.debug()
<< "Allocating hashtable of size " << _HASHTABLESIZE << " * 4\n";
}
_hash_table = (PN_uint32 *)PANDA_MALLOC_ARRAY(_HASHTABLESIZE * sizeof(PN_uint32));
_hash_table = (uint32_t *)PANDA_MALLOC_ARRAY(_HASHTABLESIZE * sizeof(uint32_t));
}
if (express_cat.is_debug()) {
@ -1000,23 +1000,23 @@ compute_file_patches(ostream &write_stream,
<< "Allocating linktable of size " << source_file_length << " * 4\n";
}
PN_uint32 *link_table = (PN_uint32 *)PANDA_MALLOC_ARRAY(source_file_length * sizeof(PN_uint32));
uint32_t *link_table = (uint32_t *)PANDA_MALLOC_ARRAY(source_file_length * sizeof(uint32_t));
// build hash and link tables for original file
build_hash_link_tables(buffer_orig, source_file_length, _hash_table, link_table);
// run through new file
PN_uint32 new_pos = 0;
PN_uint32 start_pos = new_pos; // this is the position for the start of ADD operations
uint32_t new_pos = 0;
uint32_t start_pos = new_pos; // this is the position for the start of ADD operations
if(((PN_uint32) result_file_length) >= _footprint_length)
if(((uint32_t) result_file_length) >= _footprint_length)
{
while (new_pos < (result_file_length - _footprint_length)) {
// find best match for current position
PN_uint32 COPY_pos;
PN_uint16 COPY_length;
uint32_t COPY_pos;
uint16_t COPY_length;
find_longest_match(new_pos, COPY_pos, COPY_length, _hash_table, link_table,
buffer_orig, source_file_length, buffer_new, result_file_length);
@ -1036,7 +1036,7 @@ compute_file_patches(ostream &write_stream,
}
cache_add_and_copy(write_stream, num_skipped, &buffer_new[start_pos],
COPY_length, COPY_pos + offset_orig);
new_pos += (PN_uint32)COPY_length;
new_pos += (uint32_t)COPY_length;
start_pos = new_pos;
}
}
@ -1053,7 +1053,7 @@ compute_file_patches(ostream &write_stream,
if (start_pos != result_file_length) {
// emit ADD for all remaining bytes
PN_uint32 remaining_bytes = result_file_length - start_pos;
uint32_t remaining_bytes = result_file_length - start_pos;
cache_add_and_copy(write_stream, remaining_bytes, &buffer_new[start_pos],
0, 0);
start_pos += remaining_bytes;
@ -1075,7 +1075,7 @@ compute_file_patches(ostream &write_stream,
*/
bool Patchfile::
compute_mf_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new) {
Multifile mf_orig, mf_new;
IStreamWrapper stream_origw(stream_orig);
@ -1219,7 +1219,7 @@ read_tar(TarDef &tar, istream &stream) {
*/
bool Patchfile::
compute_tar_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new,
TarDef &tar_orig, TarDef &tar_new) {
@ -1424,7 +1424,7 @@ build(Filename file_orig, Filename file_new, Filename patch_name) {
bool Patchfile::
do_compute_patches(const Filename &file_orig, const Filename &file_new,
ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new) {
nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new, false);
@ -1505,7 +1505,7 @@ do_compute_patches(const Filename &file_orig, const Filename &file_new,
*/
bool Patchfile::
patch_subfile(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
const Filename &filename,
IStreamWrapper &stream_orig, streampos orig_start, streampos orig_end,
IStreamWrapper &stream_new, streampos new_start, streampos new_end) {

View File

@ -79,23 +79,23 @@ private:
private:
// stuff for the build operation
void build_hash_link_tables(const char *buffer_orig, PN_uint32 length_orig,
PN_uint32 *hash_table, PN_uint32 *link_table);
PN_uint32 calc_hash(const char *buffer);
void find_longest_match(PN_uint32 new_pos, PN_uint32 &copy_pos, PN_uint16 &copy_length,
PN_uint32 *hash_table, PN_uint32 *link_table, const char* buffer_orig,
PN_uint32 length_orig, const char* buffer_new, PN_uint32 length_new);
PN_uint32 calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length,
PN_uint32 min_length);
void build_hash_link_tables(const char *buffer_orig, uint32_t length_orig,
uint32_t *hash_table, uint32_t *link_table);
uint32_t calc_hash(const char *buffer);
void find_longest_match(uint32_t new_pos, uint32_t &copy_pos, uint16_t &copy_length,
uint32_t *hash_table, uint32_t *link_table, const char* buffer_orig,
uint32_t length_orig, const char* buffer_new, uint32_t length_new);
uint32_t calc_match_length(const char* buf1, const char* buf2, uint32_t max_length,
uint32_t min_length);
void emit_ADD(ostream &write_stream, PN_uint32 length, const char* buffer);
void emit_COPY(ostream &write_stream, PN_uint32 length, PN_uint32 COPY_pos);
void emit_ADD(ostream &write_stream, uint32_t length, const char* buffer);
void emit_COPY(ostream &write_stream, uint32_t length, uint32_t COPY_pos);
void emit_add_and_copy(ostream &write_stream,
PN_uint32 add_length, const char *add_buffer,
PN_uint32 copy_length, PN_uint32 copy_pos);
uint32_t add_length, const char *add_buffer,
uint32_t copy_length, uint32_t copy_pos);
void cache_add_and_copy(ostream &write_stream,
PN_uint32 add_length, const char *add_buffer,
PN_uint32 copy_length, PN_uint32 copy_pos);
uint32_t add_length, const char *add_buffer,
uint32_t copy_length, uint32_t copy_pos);
void cache_flush(ostream &write_stream);
void write_header(ostream &write_stream,
@ -103,10 +103,10 @@ private:
void write_terminator(ostream &write_stream);
bool compute_file_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new);
bool compute_mf_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new);
#ifdef HAVE_TAR
class TarSubfile {
@ -124,7 +124,7 @@ private:
bool read_tar(TarDef &tar, istream &stream);
bool compute_tar_patches(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new,
TarDef &tar_orig, TarDef &tar_new);
@ -140,33 +140,33 @@ private:
bool do_compute_patches(const Filename &file_orig, const Filename &file_new,
ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
istream &stream_orig, istream &stream_new);
bool patch_subfile(ostream &write_stream,
PN_uint32 offset_orig, PN_uint32 offset_new,
uint32_t offset_orig, uint32_t offset_new,
const Filename &filename,
IStreamWrapper &stream_orig, streampos orig_start, streampos orig_end,
IStreamWrapper &stream_new, streampos new_start, streampos new_end);
static const PN_uint32 _HASH_BITS;
static const PN_uint32 _HASHTABLESIZE;
static const PN_uint32 _DEFAULT_FOOTPRINT_LENGTH;
static const PN_uint32 _NULL_VALUE;
static const PN_uint32 _MAX_RUN_LENGTH;
static const PN_uint32 _HASH_MASK;
static const uint32_t _HASH_BITS;
static const uint32_t _HASHTABLESIZE;
static const uint32_t _DEFAULT_FOOTPRINT_LENGTH;
static const uint32_t _NULL_VALUE;
static const uint32_t _MAX_RUN_LENGTH;
static const uint32_t _HASH_MASK;
bool _allow_multifile;
PN_uint32 _footprint_length;
uint32_t _footprint_length;
PN_uint32 *_hash_table;
uint32_t *_hash_table;
PN_uint32 _add_pos;
PN_uint32 _last_copy_pos;
uint32_t _add_pos;
uint32_t _last_copy_pos;
string _cache_add_data;
PN_uint32 _cache_copy_start;
PN_uint32 _cache_copy_length;
uint32_t _cache_copy_start;
uint32_t _cache_copy_length;
private:
PT(Buffer) _buffer; // this is the work buffer for apply -- used to prevent virtual memory swapping
@ -174,14 +174,14 @@ private:
// async patch apply state variables
bool _initiated;
PN_uint16 _version_number;
uint16_t _version_number;
HashVal _MD5_ofSource;
HashVal _MD5_ofResult;
PN_uint32 _total_bytes_to_process;
PN_uint32 _total_bytes_processed;
uint32_t _total_bytes_to_process;
uint32_t _total_bytes_processed;
istream *_patch_stream;
pofstream _write_stream;
@ -193,9 +193,9 @@ private:
bool _rename_output_to_orig;
bool _delete_patchfile;
static const PN_uint32 _v0_magic_number;
static const PN_uint32 _magic_number;
static const PN_uint16 _current_version;
static const uint32_t _v0_magic_number;
static const uint32_t _magic_number;
static const uint16_t _current_version;
};
#include "patchfile.I"

View File

@ -90,7 +90,7 @@ get_short_raw_time() {
* accurate and seems to lose seconds of time per hour, and (d) someone could
* be running a program such as Speed Gear which munges this value anyway.
*/
PN_int64 count;
int64_t count;
QueryPerformanceCounter((LARGE_INTEGER *)&count);
time = (double)(count - _init_count) * _recip_frequency;
@ -114,7 +114,7 @@ typedef BOOL (WINAPI * PFNSETPROCESSAFFINITYMASK)(HANDLE, DWORD_PTR);
typedef BOOL (WINAPI * PFNGETPROCESSAFFINITYMASK)(HANDLE, DWORD_PTR*, DWORD_PTR*);
bool TrueClock::
set_cpu_affinity(PN_uint32 mask) const {
set_cpu_affinity(uint32_t mask) const {
HMODULE hker = GetModuleHandle("kernel32");
if (hker != 0) {
PFNGETPROCESSAFFINITYMASK gp = (PFNGETPROCESSAFFINITYMASK)
@ -163,7 +163,7 @@ TrueClock() {
}
if (get_use_high_res_clock()) {
PN_int64 int_frequency;
int64_t int_frequency;
_has_high_res =
(QueryPerformanceFrequency((LARGE_INTEGER *)&int_frequency) != 0);
if (_has_high_res) {
@ -223,7 +223,7 @@ TrueClock() {
double TrueClock::
correct_time(double time) {
// First, get the current time of day measurement.
PN_uint64 int_tod;
uint64_t int_tod;
GetSystemTimeAsFileTime((FILETIME *)&int_tod);
double tod = (double)(int_tod - _init_tod) * _00000001;
@ -545,7 +545,7 @@ get_short_raw_time() {
*
*/
bool TrueClock::
set_cpu_affinity(PN_uint32 mask) const {
set_cpu_affinity(uint32_t mask) const {
return false;
}

View File

@ -54,7 +54,7 @@ PUBLISHED:
INLINE static TrueClock *get_global_ptr();
bool set_cpu_affinity(PN_uint32 mask) const;
bool set_cpu_affinity(uint32_t mask) const;
protected:
TrueClock();
@ -69,10 +69,10 @@ protected:
void set_time_scale(double time, double new_time_scale);
bool _has_high_res;
PN_int64 _init_count;
int64_t _init_count;
double _frequency, _recip_frequency;
int _init_tc;
PN_uint64 _init_tod;
uint64_t _init_tod;
// The rest of the data structures in this block are strictly for
// implementing paranoid_clock: they are designed to allow us to cross-check

View File

@ -22,8 +22,8 @@ typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef PN_int64 longlong;
typedef PN_uint64 ulonglong;
typedef int64_t longlong;
typedef uint64_t ulonglong;
#endif

View File

@ -153,7 +153,7 @@ FfmpegAudioCursor(FfmpegAudio *src) :
_packet = new AVPacket;
_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / 2;
_buffer_alloc = new PN_int16[_buffer_size + 64];
_buffer_alloc = new int16_t[_buffer_size + 64];
// Allocate enough space for 1024 samples per channel.
if ((_packet == 0)||(_buffer_alloc == 0)) {
@ -362,8 +362,8 @@ reload_buffer() {
*/
void FfmpegAudioCursor::
seek(double t) {
PN_int64 target_ts = (PN_int64)(t / _audio_timebase);
if (target_ts < (PN_int64)(_initial_dts)) {
int64_t target_ts = (int64_t)(t / _audio_timebase);
if (target_ts < (int64_t)(_initial_dts)) {
// Attempts to seek before the first packet will fail.
target_ts = _initial_dts;
}
@ -404,7 +404,7 @@ seek(double t) {
* audio will be interleaved.
*/
void FfmpegAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int desired = n * _audio_channels;
while (desired > 0) {

View File

@ -48,7 +48,7 @@ PUBLISHED:
virtual void seek(double offset);
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
protected:
void fetch_packet();
@ -66,9 +66,9 @@ protected:
double _audio_timebase;
AVFrame *_frame;
PN_int16 *_buffer;
int16_t *_buffer;
int _buffer_size;
PN_int16 *_buffer_alloc;
int16_t *_buffer_alloc;
int _buffer_head;
int _buffer_tail;

View File

@ -884,8 +884,8 @@ seek(int frame, bool backward) {
*/
void FfmpegVideoCursor::
do_seek(int frame, bool backward) {
PN_int64 target_ts = (PN_int64)frame;
if (target_ts < (PN_int64)(_initial_dts)) {
int64_t target_ts = (int64_t)frame;
if (target_ts < (int64_t)(_initial_dts)) {
// Attempts to seek before the first packet will fail.
target_ts = _initial_dts;
}

View File

@ -10683,7 +10683,7 @@ upload_usage_texture(int width, int height) {
// Allocate a temporary array large enough to contain the toplevel mipmap.
PN_uint32 *buffer = (PN_uint32 *)PANDA_MALLOC_ARRAY(width * height * 4);
uint32_t *buffer = (uint32_t *)PANDA_MALLOC_ARRAY(width * height * 4);
int n = 0;
while (true) {
@ -10696,7 +10696,7 @@ upload_usage_texture(int width, int height) {
struct {
unsigned char r, g, b, a;
} b;
PN_uint32 w;
uint32_t w;
} store;
store.b.r = (unsigned char)(c[0] * 255.0f);

File diff suppressed because it is too large Load Diff

View File

@ -273,7 +273,7 @@ get_modified(Thread *current_thread) const {
/**
* Packs four values in a DirectX-style NT_packed_abcd value.
*/
INLINE PN_uint32 GeomVertexData::
INLINE uint32_t GeomVertexData::
pack_abcd(unsigned int a, unsigned int b,
unsigned int c, unsigned int d) {
return (((a & 0xff) << 24) |
@ -286,7 +286,7 @@ pack_abcd(unsigned int a, unsigned int b,
* Returns the first packed value from a DirectX-style NT_packed_abcd.
*/
INLINE unsigned int GeomVertexData::
unpack_abcd_a(PN_uint32 data) {
unpack_abcd_a(uint32_t data) {
return (data >> 24) & 0xff;
}
@ -294,7 +294,7 @@ unpack_abcd_a(PN_uint32 data) {
* Returns the second packed value from a DirectX-style NT_packed_abcd.
*/
INLINE unsigned int GeomVertexData::
unpack_abcd_b(PN_uint32 data) {
unpack_abcd_b(uint32_t data) {
return (data >> 16) & 0xff;
}
@ -302,7 +302,7 @@ unpack_abcd_b(PN_uint32 data) {
* Returns the third packed value from a DirectX-style NT_packed_abcd.
*/
INLINE unsigned int GeomVertexData::
unpack_abcd_c(PN_uint32 data) {
unpack_abcd_c(uint32_t data) {
return (data >> 8) & 0xff;
}
@ -310,19 +310,19 @@ unpack_abcd_c(PN_uint32 data) {
* Returns the fourth packed value from a DirectX-style NT_packed_abcd.
*/
INLINE unsigned int GeomVertexData::
unpack_abcd_d(PN_uint32 data) {
unpack_abcd_d(uint32_t data) {
return data & 0xff;
}
/**
* Packs three float values in an unsigned 32-bit int.
*/
INLINE PN_uint32 GeomVertexData::
INLINE uint32_t GeomVertexData::
pack_ufloat(float a, float b, float c) {
// Since we have to clamp both low exponents and negative numbers to 0, it's
// easier to see a float as having a 9-bit signed exponent.
union {
PN_int32 _packed;
int32_t _packed;
float _float;
} f0, f1, f2;
@ -335,7 +335,7 @@ pack_ufloat(float a, float b, float c) {
// normalized float 4. exponent 0: denormal float 5. zero or anything
// negative, clamped to 0
PN_uint32 packed = 0;
uint32_t packed = 0;
if ((f0._packed & 0x7f800000) == 0x7f800000 && (unsigned)f0._packed != 0xff800000u) {
packed |= (f0._packed >> 17) & 0x7ffu;
@ -374,14 +374,14 @@ pack_ufloat(float a, float b, float c) {
* Unpacks an unsigned float11 value from an uint32.
*/
INLINE float GeomVertexData::
unpack_ufloat_a(PN_uint32 data) {
unpack_ufloat_a(uint32_t data) {
if ((data & 0x7c0) == 0) {
// Denormal float (includes zero).
return ldexpf((data & 63) / 64.0f, -14);
}
union {
PN_uint32 _packed;
uint32_t _packed;
float _float;
} value;
value._packed = ((data & 0x7ff) << 17);
@ -400,14 +400,14 @@ unpack_ufloat_a(PN_uint32 data) {
* Unpacks an unsigned float11 value from an uint32.
*/
INLINE float GeomVertexData::
unpack_ufloat_b(PN_uint32 data) {
unpack_ufloat_b(uint32_t data) {
if ((data & 0x3e0000) == 0) {
// Denormal float (includes zero).
return ldexpf(((data >> 11) & 63) / 64.0f, -14);
}
union {
PN_uint32 _packed;
uint32_t _packed;
float _float;
} value;
value._packed = ((data & 0x3ff800) << 6);
@ -426,14 +426,14 @@ unpack_ufloat_b(PN_uint32 data) {
* Unpacks an unsigned float10 value from an uint32.
*/
INLINE float GeomVertexData::
unpack_ufloat_c(PN_uint32 data) {
unpack_ufloat_c(uint32_t data) {
if ((data & 0xf8000000u) == 0) {
// Denormal float (includes zero).
return ldexpf(((data >> 22) & 31) / 32.0f, -14);
}
union {
PN_uint32 _packed;
uint32_t _packed;
float _float;
} value;
value._packed = ((data & 0xffc00000u) >> 4);

View File

@ -1434,7 +1434,7 @@ packed_argb_to_uint8_rgba(unsigned char *to, int to_stride,
}
while (num_records > 0) {
PN_uint32 dword = *(const PN_uint32 *)from;
uint32_t dword = *(const uint32_t *)from;
to[0] = unpack_abcd_b(dword);
to[1] = unpack_abcd_c(dword);
to[2] = unpack_abcd_d(dword);
@ -1461,7 +1461,7 @@ uint8_rgba_to_packed_argb(unsigned char *to, int to_stride,
}
while (num_records > 0) {
*(PN_uint32 *)to = pack_abcd(from[3], from[0], from[1], from[2]);
*(uint32_t *)to = pack_abcd(from[3], from[0], from[1], from[2]);
to += to_stride;
from += from_stride;
@ -2515,7 +2515,7 @@ set_num_rows(int n) {
case NT_packed_ufloat:
while (pointer < stop) {
*(PN_int32 *)pointer = 0x781e03c0;
*(int32_t *)pointer = 0x781e03c0;
pointer += stride;
}
break;

View File

@ -170,17 +170,17 @@ PUBLISHED:
void clear_cache_stage();
public:
static INLINE PN_uint32 pack_abcd(unsigned int a, unsigned int b,
static INLINE uint32_t pack_abcd(unsigned int a, unsigned int b,
unsigned int c, unsigned int d);
static INLINE unsigned int unpack_abcd_a(PN_uint32 data);
static INLINE unsigned int unpack_abcd_b(PN_uint32 data);
static INLINE unsigned int unpack_abcd_c(PN_uint32 data);
static INLINE unsigned int unpack_abcd_d(PN_uint32 data);
static INLINE unsigned int unpack_abcd_a(uint32_t data);
static INLINE unsigned int unpack_abcd_b(uint32_t data);
static INLINE unsigned int unpack_abcd_c(uint32_t data);
static INLINE unsigned int unpack_abcd_d(uint32_t data);
static INLINE PN_uint32 pack_ufloat(float a, float b, float c);
static INLINE float unpack_ufloat_a(PN_uint32 data);
static INLINE float unpack_ufloat_b(PN_uint32 data);
static INLINE float unpack_ufloat_c(PN_uint32 data);
static INLINE uint32_t pack_ufloat(float a, float b, float c);
static INLINE float unpack_ufloat_a(uint32_t data);
static INLINE float unpack_ufloat_b(uint32_t data);
static INLINE float unpack_ufloat_c(uint32_t data);
private:
static void do_set_color(GeomVertexData *vdata, const LColor &color);

View File

@ -635,7 +635,7 @@ ShaderPtrData(const LVecBase2i &vec) :
INLINE void Shader::ShaderPtrData::
write_datagram(Datagram &dg) const {
dg.add_uint8(_type);
dg.add_uint32((PN_uint32)_size);
dg.add_uint32((uint32_t)_size);
if (_type == SPT_double) {
const double *data = (const double *) _ptr;

View File

@ -1035,7 +1035,7 @@ clear_ram_mipmap_image(int n) {
PTA_uchar Texture::
modify_simple_ram_image() {
CDWriter cdata(_cycler, true);
cdata->_simple_image_date_generated = (PN_int32)time(NULL);
cdata->_simple_image_date_generated = (int32_t)time(NULL);
return cdata->_simple_ram_image._image;
}
@ -1053,7 +1053,7 @@ new_simple_ram_image(int x_size, int y_size) {
cdata->_simple_y_size = y_size;
cdata->_simple_ram_image._image = PTA_uchar::empty_array(expected_page_size);
cdata->_simple_ram_image._page_size = expected_page_size;
cdata->_simple_image_date_generated = (PN_int32)time(NULL);
cdata->_simple_image_date_generated = (int32_t)time(NULL);
cdata->inc_simple_image_modified();
return cdata->_simple_ram_image._image;
@ -1139,7 +1139,7 @@ generate_simple_ram_image() {
convert_from_pnmimage(image, expected_page_size, x_size, 0, 0, 0, scaled, 4, 1);
do_set_simple_ram_image(cdata, image, x_size, y_size);
cdata->_simple_image_date_generated = (PN_int32)time(NULL);
cdata->_simple_image_date_generated = (int32_t)time(NULL);
}
/**
@ -5206,7 +5206,7 @@ do_uncompress_ram_image_bc4(const RamImage &compressed_image,
unsigned const char *src = compressed_image._image.p() + z * compressed_image._page_size;
// Unconvert one 4 x 4 block at a time.
PN_uint8 tbl[8];
uint8_t tbl[8];
for (int y = 0; y < y_blocks; ++y) {
for (int x = 0; x < x_blocks; ++x) {
unsigned char *blk = dest;
@ -5273,8 +5273,8 @@ do_uncompress_ram_image_bc5(const RamImage &compressed_image,
unsigned const char *src = compressed_image._image.p() + z * compressed_image._page_size;
// Unconvert one 4 x 4 block at a time.
PN_uint8 red[8];
PN_uint8 grn[8];
uint8_t red[8];
uint8_t grn[8];
for (int y = 0; y < y_blocks; ++y) {
for (int x = 0; x < x_blocks; ++x) {
unsigned char *blk = dest;
@ -6168,11 +6168,11 @@ get_ram_image_as(const string &requested_format) {
// These ifs are for optimization of commonly used image types.
if (cdata->_component_width == 1) {
if (format == "RGBA" && cdata->_num_components == 4) {
const PN_uint32 *src = (const PN_uint32 *)data.p();
PN_uint32 *dst = (PN_uint32 *)newdata.p();
const uint32_t *src = (const uint32_t *)data.p();
uint32_t *dst = (uint32_t *)newdata.p();
for (int p = 0; p < imgsize; ++p) {
PN_uint32 v = *src++;
uint32_t v = *src++;
*dst++ = ((v & 0xff00ff00u)) |
((v & 0x00ff0000u) >> 16) |
((v & 0x000000ffu) << 16);
@ -6180,17 +6180,17 @@ get_ram_image_as(const string &requested_format) {
return newdata;
}
if (format == "RGB" && cdata->_num_components == 4) {
const PN_uint32 *src = (const PN_uint32 *)data.p();
PN_uint32 *dst = (PN_uint32 *)newdata.p();
const uint32_t *src = (const uint32_t *)data.p();
uint32_t *dst = (uint32_t *)newdata.p();
// Convert blocks of 4 pixels at a time, so that we can treat both the
// source and destination as 32-bit integers.
int blocks = imgsize >> 2;
for (int i = 0; i < blocks; ++i) {
PN_uint32 v0 = *src++;
PN_uint32 v1 = *src++;
PN_uint32 v2 = *src++;
PN_uint32 v3 = *src++;
uint32_t v0 = *src++;
uint32_t v1 = *src++;
uint32_t v2 = *src++;
uint32_t v3 = *src++;
*dst++ = ((v0 & 0x00ff0000u) >> 16) |
((v0 & 0x0000ff00u)) |
((v0 & 0x000000ffu) << 16) |
@ -6207,9 +6207,9 @@ get_ram_image_as(const string &requested_format) {
// If the image size wasn't a multiple of 4, we may have a handful of
// pixels left over. Convert those the slower way.
PN_uint8 *tail = (PN_uint8 *)dst;
uint8_t *tail = (uint8_t *)dst;
for (int i = (imgsize & ~0x3); i < imgsize; ++i) {
PN_uint32 v = *src++;
uint32_t v = *src++;
*tail++ = (v & 0x00ff0000u) >> 16;
*tail++ = (v & 0x0000ff00u) >> 8;
*tail++ = (v & 0x000000ffu);
@ -6217,17 +6217,17 @@ get_ram_image_as(const string &requested_format) {
return newdata;
}
if (format == "BGR" && cdata->_num_components == 4) {
const PN_uint32 *src = (const PN_uint32 *)data.p();
PN_uint32 *dst = (PN_uint32 *)newdata.p();
const uint32_t *src = (const uint32_t *)data.p();
uint32_t *dst = (uint32_t *)newdata.p();
// Convert blocks of 4 pixels at a time, so that we can treat both the
// source and destination as 32-bit integers.
int blocks = imgsize >> 2;
for (int i = 0; i < blocks; ++i) {
PN_uint32 v0 = *src++;
PN_uint32 v1 = *src++;
PN_uint32 v2 = *src++;
PN_uint32 v3 = *src++;
uint32_t v0 = *src++;
uint32_t v1 = *src++;
uint32_t v2 = *src++;
uint32_t v3 = *src++;
*dst++ = (v0 & 0x00ffffffu) | ((v1 & 0x000000ffu) << 24);
*dst++ = ((v1 & 0x00ffff00u) >> 8) | ((v2 & 0x0000ffffu) << 16);
*dst++ = ((v2 & 0x00ff0000u) >> 16) | ((v3 & 0x00ffffffu) << 8);
@ -6235,17 +6235,17 @@ get_ram_image_as(const string &requested_format) {
// If the image size wasn't a multiple of 4, we may have a handful of
// pixels left over. Convert those the slower way.
PN_uint8 *tail = (PN_uint8 *)dst;
uint8_t *tail = (uint8_t *)dst;
for (int i = (imgsize & ~0x3); i < imgsize; ++i) {
PN_uint32 v = *src++;
uint32_t v = *src++;
*tail++ = (v & 0x000000ffu);
*tail++ = (v & 0x0000ff00u) >> 8;
*tail++ = (v & 0x00ff0000u) >> 16;
}
return newdata;
}
const PN_uint8 *src = (const PN_uint8 *)data.p();
PN_uint8 *dst = (PN_uint8 *)newdata.p();
const uint8_t *src = (const uint8_t *)data.p();
uint8_t *dst = (uint8_t *)newdata.p();
if (format == "RGB" && cdata->_num_components == 3) {
for (int i = 0; i < imgsize; ++i) {
@ -6335,7 +6335,7 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size)
cdata->_simple_y_size = y_size;
cdata->_simple_ram_image._image = image.cast_non_const();
cdata->_simple_ram_image._page_size = image.size();
cdata->_simple_image_date_generated = (PN_int32)time(NULL);
cdata->_simple_image_date_generated = (int32_t)time(NULL);
cdata->inc_simple_image_modified();
}
@ -7019,9 +7019,9 @@ read_dds_level_abgr8(Texture *tex, CData *cdata, const DDSHeader &header, int n,
unsigned char *p = image.p() + y * row_bytes;
in.read((char *)p, row_bytes);
PN_uint32 *pw = (PN_uint32 *)p;
uint32_t *pw = (uint32_t *)p;
for (int x = 0; x < x_size; ++x) {
PN_uint32 w = *pw;
uint32_t w = *pw;
#ifdef WORDS_BIGENDIAN
// bigendian: convert R, G, B, A to B, G, R, A.
w = ((w & 0xff00) << 16) | ((w & 0xff000000U) >> 16) | (w & 0xff00ff);
@ -7075,7 +7075,7 @@ read_dds_level_abgr16(Texture *tex, CData *cdata, const DDSHeader &header, int n
unsigned char *p = image.p() + y * row_bytes;
in.read((char *)p, row_bytes);
PN_uint16 *pw = (PN_uint16 *)p;
uint16_t *pw = (uint16_t *)p;
for (int x = 0; x < x_size; ++x) {
swap(pw[0], pw[2]);
pw += 4;
@ -7102,7 +7102,7 @@ read_dds_level_abgr32(Texture *tex, CData *cdata, const DDSHeader &header, int n
unsigned char *p = image.p() + y * row_bytes;
in.read((char *)p, row_bytes);
PN_uint32 *pw = (PN_uint32 *)p;
uint32_t *pw = (uint32_t *)p;
for (int x = 0; x < x_size; ++x) {
swap(pw[0], pw[2]);
pw += 4;
@ -7331,8 +7331,8 @@ read_dds_level_bc1(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
for (int ci = 0; ci < num_cols; ++ci) {
// . . . and (b) within each block, we reverse the 4 individual rows
// of 4 pixels.
PN_uint32 *cells = (PN_uint32 *)p;
PN_uint32 w = cells[1];
uint32_t *cells = (uint32_t *)p;
uint32_t w = cells[1];
w = ((w & 0xff) << 24) | ((w & 0xff00) << 8) | ((w & 0xff0000) >> 8) | ((w & 0xff000000U) >> 24);
cells[1] = w;
@ -7346,8 +7346,8 @@ read_dds_level_bc1(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
in.read((char *)p, row_length);
for (int ci = 0; ci < num_cols; ++ci) {
PN_uint32 *cells = (PN_uint32 *)p;
PN_uint32 w = cells[1];
uint32_t *cells = (uint32_t *)p;
uint32_t w = cells[1];
w = ((w & 0xff) << 8) | ((w & 0xff00) >> 8);
cells[1] = w;
@ -7401,11 +7401,11 @@ read_dds_level_bc2(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
for (int ci = 0; ci < num_cols; ++ci) {
// . . . and (b) within each block, we reverse the 4 individual rows
// of 4 pixels.
PN_uint32 *cells = (PN_uint32 *)p;
uint32_t *cells = (uint32_t *)p;
// Alpha. The block is four 16-bit words of pixel data.
PN_uint32 w0 = cells[0];
PN_uint32 w1 = cells[1];
uint32_t w0 = cells[0];
uint32_t w1 = cells[1];
w0 = ((w0 & 0xffff) << 16) | ((w0 & 0xffff0000U) >> 16);
w1 = ((w1 & 0xffff) << 16) | ((w1 & 0xffff0000U) >> 16);
cells[0] = w1;
@ -7413,7 +7413,7 @@ read_dds_level_bc2(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
// Color. Only the second 32-bit dword of the color block represents
// the pixel data.
PN_uint32 w = cells[3];
uint32_t w = cells[3];
w = ((w & 0xff) << 24) | ((w & 0xff00) << 8) | ((w & 0xff0000) >> 8) | ((w & 0xff000000U) >> 24);
cells[3] = w;
@ -7427,13 +7427,13 @@ read_dds_level_bc2(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
in.read((char *)p, row_length);
for (int ci = 0; ci < num_cols; ++ci) {
PN_uint32 *cells = (PN_uint32 *)p;
uint32_t *cells = (uint32_t *)p;
PN_uint32 w0 = cells[0];
uint32_t w0 = cells[0];
w0 = ((w0 & 0xffff) << 16) | ((w0 & 0xffff0000U) >> 16);
cells[0] = w0;
PN_uint32 w = cells[3];
uint32_t w = cells[3];
w = ((w & 0xff) << 8) | ((w & 0xff00) >> 8);
cells[3] = w;
@ -7487,7 +7487,7 @@ read_dds_level_bc3(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
for (int ci = 0; ci < num_cols; ++ci) {
// . . . and (b) within each block, we reverse the 4 individual rows
// of 4 pixels.
PN_uint32 *cells = (PN_uint32 *)p;
uint32_t *cells = (uint32_t *)p;
// Alpha. The block is one 16-bit word of reference values, followed
// by six words of pixel values, in 12-bit rows. Tricky to invert.
@ -7507,7 +7507,7 @@ read_dds_level_bc3(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
// Color. Only the second 32-bit dword of the color block represents
// the pixel data.
PN_uint32 w = cells[3];
uint32_t w = cells[3];
w = ((w & 0xff) << 24) | ((w & 0xff00) << 8) | ((w & 0xff0000) >> 8) | ((w & 0xff000000U) >> 24);
cells[3] = w;
@ -7521,7 +7521,7 @@ read_dds_level_bc3(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
in.read((char *)p, row_length);
for (int ci = 0; ci < num_cols; ++ci) {
PN_uint32 *cells = (PN_uint32 *)p;
uint32_t *cells = (uint32_t *)p;
unsigned char p2 = p[2];
unsigned char p3 = p[3];
@ -7531,11 +7531,11 @@ read_dds_level_bc3(Texture *tex, CData *cdata, const DDSHeader &header, int n, i
p[3] = ((p2 & 0xf) << 4) | ((p4 & 0xf0) >> 4);
p[4] = ((p3 & 0xf) << 4) | ((p2 & 0xf0) >> 4);
PN_uint32 w0 = cells[0];
uint32_t w0 = cells[0];
w0 = ((w0 & 0xffff) << 16) | ((w0 & 0xffff0000U) >> 16);
cells[0] = w0;
PN_uint32 w = cells[3];
uint32_t w = cells[3];
w = ((w & 0xff) << 8) | ((w & 0xff00) >> 8);
cells[3] = w;

View File

@ -977,7 +977,7 @@ protected:
RamImage _simple_ram_image;
int _simple_x_size;
int _simple_y_size;
PN_int32 _simple_image_date_generated;
int32_t _simple_image_date_generated;
// This is the color that should be used when no image was given.
bool _has_clear_color;

View File

@ -849,7 +849,7 @@ write_run(Datagram &datagram, FFTCompressor::RunWidth run_width,
// In the case of RW_double, we only write the numbers one at a time,
// each time preceded by the RW_double flag. Hopefully this will happen
// only rarely.
datagram.add_int8((PN_int8)RW_double);
datagram.add_int8((int8_t)RW_double);
datagram.add_float64(*ri);
}
break;
@ -869,7 +869,7 @@ write_run(Datagram &datagram, FFTCompressor::RunWidth run_width,
*/
int FFTCompressor::
read_run(DatagramIterator &di, vector_double &run) {
PN_uint8 start = di.get_uint8();
uint8_t start = di.get_uint8();
RunWidth run_width;
int length;

View File

@ -114,7 +114,7 @@ seek(double t) {
* audio will be interleaved.
*/
void FlacAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int desired = n * _audio_channels;
_samples_read += drflac_read_s16(_drflac, desired, data) / _audio_channels;
}

View File

@ -35,7 +35,7 @@ PUBLISHED:
virtual void seek(double offset);
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
bool _is_valid;

View File

@ -91,7 +91,7 @@ public:
int _samples_per_buffer;
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
virtual int ready() const;
public:
@ -324,7 +324,7 @@ MicrophoneAudioCursorDS::
*
*/
void MicrophoneAudioCursorDS::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int orign = n;
if (_handle) {
while (1) {
@ -334,7 +334,7 @@ read_samples(int n, PN_int16 *data) {
}
// Find start of data in buffer.
PN_int16 *src = (PN_int16*)(_buffers[index]._storage);
int16_t *src = (int16_t*)(_buffers[index]._storage);
src += (_offset * _audio_channels);
// Decide how many samples to extract from this buffer.

View File

@ -100,5 +100,5 @@ tell() const {
*/
INLINE void MovieAudioCursor::
skip_samples(int n) {
read_samples(n, (PN_int16*)0);
read_samples(n, (int16_t*)0);
}

View File

@ -46,7 +46,7 @@ MovieAudioCursor::
* audio will be interleaved.
*/
void MovieAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
// This is the null implementation, which generates pure silence. Normally,
// this method will be overridden by a subclass.
@ -71,7 +71,7 @@ read_samples(int n, PN_int16 *data) {
*/
void MovieAudioCursor::
read_samples(int n, Datagram *dg) {
PN_int16 tmp[4096];
int16_t tmp[4096];
while (n > 0) {
int blocksize = (4096 / _audio_channels);
if (blocksize > n) blocksize = n;
@ -95,14 +95,14 @@ read_samples(int n, Datagram *dg) {
string MovieAudioCursor::
read_samples(int n) {
ostringstream result;
PN_int16 tmp[4096];
int16_t tmp[4096];
while (n > 0) {
int blocksize = (4096 / _audio_channels);
if (blocksize > n) blocksize = n;
int words = blocksize * _audio_channels;
read_samples(blocksize, tmp);
for (int i=0; i<words; i++) {
PN_int16 word = tmp[i];
int16_t word = tmp[i];
result.put((char)(word & 255));
result.put((char)((word>>8) & 255));
}

View File

@ -51,7 +51,7 @@ PUBLISHED:
string read_samples(int n);
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
protected:
PT(MovieAudio) _source;
@ -62,7 +62,7 @@ protected:
bool _can_seek_fast;
bool _aborted;
double _last_seek;
PN_int64 _samples_read;
int64_t _samples_read;
public:
static TypeHandle get_class_type() {

View File

@ -58,7 +58,7 @@ open() {
* audio will be interleaved.
*/
void UserDataAudio::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int ready = (_data.size() / _desired_channels);
int desired = n * _desired_channels;
int avail = ready * _desired_channels;
@ -78,7 +78,7 @@ read_samples(int n, PN_int16 *data) {
* Appends audio samples to the buffer.
*/
void UserDataAudio::
append(PN_int16 *data, int n) {
append(int16_t *data, int n) {
nassertv(!_aborted);
int words = n * _desired_channels;
for (int i=0; i<words; i++) {
@ -114,7 +114,7 @@ append(const string &str) {
for (int i=0; i<words; i++) {
int c1 = ((unsigned char)str[i*2+0]);
int c2 = ((unsigned char)str[i*2+1]);
PN_int16 n = (c1 | (c2 << 8));
int16_t n = (c1 | (c2 << 8));
_data.push_back(n);
}
}

View File

@ -35,18 +35,18 @@ class EXPCL_PANDA_MOVIES UserDataAudio : public MovieAudio {
virtual ~UserDataAudio();
virtual PT(MovieAudioCursor) open();
void append(PN_int16 *data, int n);
void append(int16_t *data, int n);
void append(DatagramIterator *src, int len=0x40000000);
void append(const string &str);
void done(); // A promise not to write any more samples.
private:
void read_samples(int n, PN_int16 *data);
void read_samples(int n, int16_t *data);
void update_cursor();
int _desired_rate;
int _desired_channels;
UserDataAudioCursor *_cursor;
pdeque<PN_int16> _data;
pdeque<int16_t> _data;
bool _aborted;
bool _remove_after_read;
friend class UserDataAudioCursor;

View File

@ -48,7 +48,7 @@ UserDataAudioCursor::
* audio will be interleaved.
*/
void UserDataAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
UserDataAudio *source = (UserDataAudio*)(MovieAudio*)_source;
if(source->_remove_after_read) {

View File

@ -33,7 +33,7 @@ PUBLISHED:
virtual ~UserDataAudioCursor();
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
virtual int ready() const;
virtual void seek(double offset);

View File

@ -109,7 +109,7 @@ seek(double t) {
* audio will be interleaved.
*/
void VorbisAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int desired = n * _audio_channels;
char *buffer = (char*) data;

View File

@ -35,7 +35,7 @@ PUBLISHED:
virtual void seek(double offset);
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
bool _is_valid;

View File

@ -17,7 +17,7 @@
#include "wavAudio.h"
// Tables for decompressing mu-law and A-law wav files.
static PN_int16 mulaw_table[256] = {
static int16_t mulaw_table[256] = {
-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
@ -52,7 +52,7 @@ static PN_int16 mulaw_table[256] = {
56, 48, 40, 32, 24, 16, 8, 0
};
static PN_int16 alaw_table[256] = {
static int16_t alaw_table[256] = {
-5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
-7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
-2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
@ -143,7 +143,7 @@ WavAudioCursor(WavAudio *src, istream *stream) :
_block_align = _reader.get_uint16();
// We can round up to next multiple of 8.
PN_uint16 bps = _reader.get_uint16();
uint16_t bps = _reader.get_uint16();
bps = (bps + 7) & 0xfff8;
// How many bytes in this chunk we've read so far.
@ -324,7 +324,7 @@ seek(double t) {
* audio will be interleaved.
*/
void WavAudioCursor::
read_samples(int n, PN_int16 *data) {
read_samples(int n, int16_t *data) {
int desired = n * _audio_channels;
int read_samples = min(desired, ((int) (_data_size - _data_pos)) / _bytes_per_sample);
@ -359,7 +359,7 @@ read_samples(int n, PN_int16 *data) {
} case 4: {
// Downsample.
const PN_int32 scale_factor = 0x7fffffff / 0x7fff;
const int32_t scale_factor = 0x7fffffff / 0x7fff;
for (int i = 0; i < read_samples; ++i) {
data[i] = _reader.get_int32() / scale_factor;
@ -368,7 +368,7 @@ read_samples(int n, PN_int16 *data) {
} case 8: {
// Downsample.
const PN_int64 scale_factor = 0x7fffffffffffffffLL / 0x7fffLL;
const int64_t scale_factor = 0x7fffffffffffffffLL / 0x7fffLL;
for (int i = 0; i < read_samples; ++i) {
data[i] = _reader.get_int64() / scale_factor;
@ -386,13 +386,13 @@ read_samples(int n, PN_int16 *data) {
switch (_bytes_per_sample) {
case 4:
for (int i = 0; i < read_samples; ++i) {
data[i] = (PN_int16) (_reader.get_float32() * 0x7fff);
data[i] = (int16_t) (_reader.get_float32() * 0x7fff);
}
break;
case 8:
for (int i = 0; i < read_samples; ++i) {
data[i] = (PN_int16) (_reader.get_float64() * 0x7fff);
data[i] = (int16_t) (_reader.get_float64() * 0x7fff);
}
break;

View File

@ -31,7 +31,7 @@ PUBLISHED:
virtual void seek(double offset);
public:
virtual void read_samples(int n, PN_int16 *data);
virtual void read_samples(int n, int16_t *data);
bool _is_valid;

View File

@ -158,7 +158,7 @@ set_host(const std::string &hostname, unsigned short port) {
}
PN_uint32 addr = (PN_uint32)inet_addr(hostname.c_str());
uint32_t addr = (uint32_t)inet_addr(hostname.c_str());
if (addr == INADDR_NONE) {
hp = gethostbyname(hostname.c_str());
if (hp == NULL) {
@ -195,7 +195,7 @@ set_host(const std::string &hostname) {
*
*/
INLINE bool Socket_Address::
set_host(PN_uint32 in_hostname, unsigned short port) {
set_host(uint32_t in_hostname, unsigned short port) {
memcpy(&_addr.sin_addr, &in_hostname, sizeof(in_hostname));
_addr.sin_port = htons(port);
_addr.sin_family = AF_INET;
@ -227,7 +227,7 @@ operator < (const Socket_Address &in) const {
*/
INLINE bool Socket_Address::
is_mcast_range(void) const {
PN_uint32 address = ntohl(_addr.sin_addr.s_addr);
uint32_t address = ntohl(_addr.sin_addr.s_addr);
// 224.0.0.0-239.255.255.255 .. e0,ef
return (address >= 0xe0000000 && address < 0xefffffff);
}

View File

@ -18,9 +18,9 @@ PUBLISHED:
inline Socket_fdset();
inline void setForSocket(const Socket_IP &incon);
inline bool IsSetFor(const Socket_IP &incon) const;
inline int WaitForRead(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
inline int WaitForWrite(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
inline int WaitForError(bool zeroFds, PN_uint32 sleep_time = 0xffffffff);
inline int WaitForRead(bool zeroFds, uint32_t sleep_time = 0xffffffff);
inline int WaitForWrite(bool zeroFds, uint32_t sleep_time = 0xffffffff);
inline int WaitForError(bool zeroFds, uint32_t sleep_time = 0xffffffff);
inline int WaitForRead(bool zeroFds, const Time_Span & timeout);
inline void clear();
@ -86,7 +86,7 @@ inline bool Socket_fdset::IsSetFor(const Socket_IP & incon) const
/**
*
*/
inline int Socket_fdset::WaitForRead(bool zeroFds, PN_uint32 sleep_time)
inline int Socket_fdset::WaitForRead(bool zeroFds, uint32_t sleep_time)
{
int retVal = 0;
if (sleep_time == 0xffffffff) {
@ -139,7 +139,7 @@ inline void Socket_fdset::setForSocket(const Socket_IP &incon)
* This is the function that will wait till one of the sockets is ready for
* writing
*/
inline int Socket_fdset::WaitForWrite(bool zeroFds, PN_uint32 sleep_time)
inline int Socket_fdset::WaitForWrite(bool zeroFds, uint32_t sleep_time)
{
int retVal = 0;
if (sleep_time == 0xffffffff)
@ -164,7 +164,7 @@ inline int Socket_fdset::WaitForWrite(bool zeroFds, PN_uint32 sleep_time)
* This is the function that will wait till one of the sockets is in error
* state
*/
inline int Socket_fdset::WaitForError(bool zeroFds, PN_uint32 sleep_time)
inline int Socket_fdset::WaitForError(bool zeroFds, uint32_t sleep_time)
{
int retVal = 0;
if (sleep_time == 0xffffffff)

View File

@ -285,12 +285,12 @@ inline void Socket_TCP_SSL::DetailErrorFormat(void)
{
return; // turn on fir debuging
PN_uint32 l;
uint32_t l;
char buf[256];
char buf2[4096];
const char *file,*data;
int line,flags;
PN_uint32 es;
uint32_t es;
es=CRYPTO_thread_id();
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)

View File

@ -412,7 +412,7 @@ wait_for_readers(double timeout) {
wait_timeout = min(wait_timeout, stop - now);
}
PN_uint32 wait_timeout_ms = (PN_uint32)(wait_timeout * 1000.0);
uint32_t wait_timeout_ms = (uint32_t)(wait_timeout * 1000.0);
if (any_threaded) {
// If there are any threaded ConnectionReaders, we can't block at all.
wait_timeout_ms = 0;
@ -517,7 +517,7 @@ scan_interfaces() {
// Now, we can infer the netmask by the difference between the
// network address (the first address) and the broadcast address
// (the last address).
PN_uint32 netmask = addresses[0].get_ip() - addresses[2].get_ip() - 1;
uint32_t netmask = addresses[0].get_ip() - addresses[2].get_ip() - 1;
Socket_Address sa;
sa.set_host(netmask, 0);
iface.set_netmask(NetAddress(sa));

View File

@ -834,7 +834,7 @@ get_next_available_socket(bool allow_block, int current_thread_index) {
_next_index = 0;
if (!_shutdown) {
PN_uint32 timeout = (PN_uint32)(get_net_max_block() * 1000.0);
uint32_t timeout = (uint32_t)(get_net_max_block() * 1000.0);
if (!allow_block) {
timeout = 0;
}

View File

@ -31,7 +31,7 @@ DatagramTCPHeader(const NetDatagram &datagram, int header_size) {
case datagram_tcp16_header_size:
{
PN_uint16 size = str.length();
uint16_t size = str.length();
nassertv(size == str.length());
_header.add_uint16(size);
}
@ -39,7 +39,7 @@ DatagramTCPHeader(const NetDatagram &datagram, int header_size) {
case datagram_tcp32_header_size:
{
PN_uint32 size = str.length();
uint32_t size = str.length();
nassertv(size == str.length());
_header.add_uint32(size);
}

View File

@ -21,8 +21,8 @@
#include "datagramIterator.h"
#include "numeric_types.h"
static const int datagram_tcp16_header_size = sizeof(PN_uint16);
static const int datagram_tcp32_header_size = sizeof(PN_uint32);
static const int datagram_tcp16_header_size = sizeof(uint16_t);
static const int datagram_tcp32_header_size = sizeof(uint32_t);
class NetDatagram;

View File

@ -25,9 +25,9 @@
DatagramUDPHeader::
DatagramUDPHeader(const NetDatagram &datagram) {
const string &str = datagram.get_message();
PN_uint16 checksum = 0;
uint16_t checksum = 0;
for (size_t p = 0; p < str.size(); p++) {
checksum += (PN_uint16)(PN_uint8)str[p];
checksum += (uint16_t)(uint8_t)str[p];
}
// Now pack the header.
@ -51,9 +51,9 @@ bool DatagramUDPHeader::
verify_datagram(const NetDatagram &datagram) const {
const string &str = datagram.get_message();
PN_uint16 checksum = 0;
uint16_t checksum = 0;
for (size_t p = 0; p < str.size(); p++) {
checksum += (PN_uint16)(PN_uint8)str[p];
checksum += (uint16_t)(uint8_t)str[p];
}
if (checksum == get_datagram_checksum()) {

View File

@ -21,7 +21,7 @@
#include "datagramIterator.h"
#include "numeric_types.h"
static const int datagram_udp_header_size = sizeof(PN_uint16);
static const int datagram_udp_header_size = sizeof(uint16_t);
class NetDatagram;

View File

@ -103,7 +103,7 @@ get_ip_string() const {
* Returns the IP address to which this address refers, as a 32-bit integer,
* in host byte order.
*/
PN_uint32 NetAddress::
uint32_t NetAddress::
get_ip() const {
return _addr.GetIPAddressRaw();
}
@ -113,11 +113,11 @@ get_ip() const {
* components; component 0 is the first (leftmost), and component 3 is the
* last (rightmost) in the dotted number convention.
*/
PN_uint8 NetAddress::
uint8_t NetAddress::
get_ip_component(int n) const {
nassertr(n >= 0 && n < 4, 0);
PN_uint32 ip_long = _addr.GetIPAddressRaw();
const PN_uint8 *ip = (const PN_uint8 *)&ip_long;
uint32_t ip_long = _addr.GetIPAddressRaw();
const uint8_t *ip = (const uint8_t *)&ip_long;
return ip[n];
}

Some files were not shown because too many files have changed in this diff Show More