mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
general: pvector<unsigned char> -> vector_uchar
This commit is contained in:
parent
f1eb811c0e
commit
3c6ebb56bd
@ -26,6 +26,7 @@
|
|||||||
#include "subfileInfo.h"
|
#include "subfileInfo.h"
|
||||||
#include "reMutexHolder.h"
|
#include "reMutexHolder.h"
|
||||||
#include "virtualFileSystem.h"
|
#include "virtualFileSystem.h"
|
||||||
|
#include "vector_uchar.h"
|
||||||
|
|
||||||
TypeHandle FmodAudioSound::_type_handle;
|
TypeHandle FmodAudioSound::_type_handle;
|
||||||
|
|
||||||
@ -107,7 +108,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||||||
const char *name_or_data = _file_name.c_str();
|
const char *name_or_data = _file_name.c_str();
|
||||||
string os_filename;
|
string os_filename;
|
||||||
|
|
||||||
pvector<unsigned char> mem_buffer;
|
vector_uchar mem_buffer;
|
||||||
SubfileInfo info;
|
SubfileInfo info;
|
||||||
if (preload) {
|
if (preload) {
|
||||||
// Pre-read the file right now, and pass it in as a memory buffer. This
|
// Pre-read the file right now, and pass it in as a memory buffer. This
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
// For software MIDI:
|
// For software MIDI:
|
||||||
HDLSDEVICE _dls_device;
|
HDLSDEVICE _dls_device;
|
||||||
HDLSFILEID _dls_file;
|
HDLSFILEID _dls_file;
|
||||||
pvector<unsigned char> _dls_data;
|
vector_uchar _dls_data;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void open_api();
|
void open_api();
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "pmutex.h"
|
#include "pmutex.h"
|
||||||
#include "lightReMutex.h"
|
#include "lightReMutex.h"
|
||||||
#include "conditionVar.h"
|
#include "conditionVar.h"
|
||||||
|
#include "vector_uchar.h"
|
||||||
|
|
||||||
class MilesAudioSound;
|
class MilesAudioSound;
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ private:
|
|||||||
|
|
||||||
Filename _basename;
|
Filename _basename;
|
||||||
S32 _file_type;
|
S32 _file_type;
|
||||||
pvector<unsigned char> _raw_data;
|
vector_uchar _raw_data;
|
||||||
bool _has_length;
|
bool _has_length;
|
||||||
PN_stdfloat _length; // in seconds.
|
PN_stdfloat _length; // in seconds.
|
||||||
};
|
};
|
||||||
|
@ -191,7 +191,7 @@ hash_string(const std::string &data) {
|
|||||||
* functionality) available.
|
* functionality) available.
|
||||||
*/
|
*/
|
||||||
INLINE void HashVal::
|
INLINE void HashVal::
|
||||||
hash_bytes(const pvector<unsigned char> &data) {
|
hash_bytes(const vector_uchar &data) {
|
||||||
hash_buffer((const char *)&data[0], data.size());
|
hash_buffer((const char *)&data[0], data.size());
|
||||||
}
|
}
|
||||||
#endif // HAVE_OPENSSL
|
#endif // HAVE_OPENSSL
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "datagramIterator.h"
|
#include "datagramIterator.h"
|
||||||
#include "streamWriter.h"
|
#include "streamWriter.h"
|
||||||
#include "streamReader.h"
|
#include "streamReader.h"
|
||||||
|
#include "vector_uchar.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a 128-bit value that represents the hashed contents (typically MD5)
|
* Stores a 128-bit value that represents the hashed contents (typically MD5)
|
||||||
@ -68,7 +69,7 @@ PUBLISHED:
|
|||||||
bool hash_stream(std::istream &stream);
|
bool hash_stream(std::istream &stream);
|
||||||
INLINE void hash_ramfile(const Ramfile &ramfile);
|
INLINE void hash_ramfile(const Ramfile &ramfile);
|
||||||
INLINE void hash_string(const std::string &data);
|
INLINE void hash_string(const std::string &data);
|
||||||
INLINE void hash_bytes(const pvector<unsigned char> &data);
|
INLINE void hash_bytes(const vector_uchar &data);
|
||||||
void hash_buffer(const char *buffer, int length);
|
void hash_buffer(const char *buffer, int length);
|
||||||
#endif // HAVE_OPENSSL
|
#endif // HAVE_OPENSSL
|
||||||
|
|
||||||
|
@ -1863,7 +1863,7 @@ read_subfile(int index, string &result) {
|
|||||||
// We use a temporary pvector, because dynamic accumulation of a pvector
|
// We use a temporary pvector, because dynamic accumulation of a pvector
|
||||||
// seems to be many times faster than that of a string, at least on the
|
// seems to be many times faster than that of a string, at least on the
|
||||||
// Windows implementation of STL.
|
// Windows implementation of STL.
|
||||||
pvector<unsigned char> pv;
|
vector_uchar pv;
|
||||||
if (!read_subfile(index, pv)) {
|
if (!read_subfile(index, pv)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1879,7 +1879,7 @@ read_subfile(int index, string &result) {
|
|||||||
* Fills a pvector with the entire contents of the indicated subfile.
|
* Fills a pvector with the entire contents of the indicated subfile.
|
||||||
*/
|
*/
|
||||||
bool Multifile::
|
bool Multifile::
|
||||||
read_subfile(int index, pvector<unsigned char> &result) {
|
read_subfile(int index, vector_uchar &result) {
|
||||||
nassertr(is_read_valid(), false);
|
nassertr(is_read_valid(), false);
|
||||||
nassertr(index >= 0 && index < (int)_subfiles.size(), false);
|
nassertr(index >= 0 && index < (int)_subfiles.size(), false);
|
||||||
result.clear();
|
result.clear();
|
||||||
@ -2388,7 +2388,7 @@ check_signatures() {
|
|||||||
size_t num_certs = reader.get_uint32();
|
size_t num_certs = reader.get_uint32();
|
||||||
|
|
||||||
// Read the remaining buffer of certificate data.
|
// Read the remaining buffer of certificate data.
|
||||||
pvector<unsigned char> buffer;
|
vector_uchar buffer;
|
||||||
bool success = VirtualFile::simple_read_file(stream, buffer);
|
bool success = VirtualFile::simple_read_file(stream, buffer);
|
||||||
nassertv(success);
|
nassertv(success);
|
||||||
close_read_subfile(stream);
|
close_read_subfile(stream);
|
||||||
|
@ -159,7 +159,7 @@ public:
|
|||||||
#endif // HAVE_OPENSSL
|
#endif // HAVE_OPENSSL
|
||||||
|
|
||||||
bool read_subfile(int index, std::string &result);
|
bool read_subfile(int index, std::string &result);
|
||||||
bool read_subfile(int index, pvector<unsigned char> &result);
|
bool read_subfile(int index, vector_uchar &result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum SubfileFlags {
|
enum SubfileFlags {
|
||||||
|
@ -351,7 +351,7 @@ bool VirtualFile::
|
|||||||
read_file(string &result, bool auto_unwrap) const {
|
read_file(string &result, bool auto_unwrap) const {
|
||||||
result = string();
|
result = string();
|
||||||
|
|
||||||
pvector<unsigned char> pv;
|
vector_uchar pv;
|
||||||
if (!read_file(pv, auto_unwrap)) {
|
if (!read_file(pv, auto_unwrap)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ read_file(string &result, bool auto_unwrap) const {
|
|||||||
* regular file. Returns true on success, false otherwise.
|
* regular file. Returns true on success, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool VirtualFile::
|
bool VirtualFile::
|
||||||
read_file(pvector<unsigned char> &result, bool auto_unwrap) const {
|
read_file(vector_uchar &result, bool auto_unwrap) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ write_file(const unsigned char *data, size_t data_size, bool auto_wrap) {
|
|||||||
* entry, the data read from the file will be appended onto it.
|
* entry, the data read from the file will be appended onto it.
|
||||||
*/
|
*/
|
||||||
bool VirtualFile::
|
bool VirtualFile::
|
||||||
simple_read_file(istream *in, pvector<unsigned char> &result) {
|
simple_read_file(istream *in, vector_uchar &result) {
|
||||||
static const size_t buffer_size = 4096;
|
static const size_t buffer_size = 4096;
|
||||||
char buffer[buffer_size];
|
char buffer[buffer_size];
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ simple_read_file(istream *in, pvector<unsigned char> &result) {
|
|||||||
* max_bytes bytes from the file.
|
* max_bytes bytes from the file.
|
||||||
*/
|
*/
|
||||||
bool VirtualFile::
|
bool VirtualFile::
|
||||||
simple_read_file(istream *in, pvector<unsigned char> &result, size_t max_bytes) {
|
simple_read_file(istream *in, vector_uchar &result, size_t max_bytes) {
|
||||||
static const size_t buffer_size = 4096;
|
static const size_t buffer_size = 4096;
|
||||||
char buffer[buffer_size];
|
char buffer[buffer_size];
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "pointerTo.h"
|
#include "pointerTo.h"
|
||||||
#include "typedReferenceCount.h"
|
#include "typedReferenceCount.h"
|
||||||
#include "ordered_vector.h"
|
#include "ordered_vector.h"
|
||||||
#include "pvector.h"
|
#include "vector_uchar.h"
|
||||||
|
|
||||||
class VirtualFileMount;
|
class VirtualFileMount;
|
||||||
class VirtualFileList;
|
class VirtualFileList;
|
||||||
@ -85,11 +85,11 @@ public:
|
|||||||
|
|
||||||
INLINE void set_original_filename(const Filename &filename);
|
INLINE void set_original_filename(const Filename &filename);
|
||||||
bool read_file(std::string &result, bool auto_unwrap) const;
|
bool read_file(std::string &result, bool auto_unwrap) const;
|
||||||
virtual bool read_file(pvector<unsigned char> &result, bool auto_unwrap) const;
|
virtual bool read_file(vector_uchar &result, bool auto_unwrap) const;
|
||||||
virtual bool write_file(const unsigned char *data, size_t data_size, bool auto_wrap);
|
virtual bool write_file(const unsigned char *data, size_t data_size, bool auto_wrap);
|
||||||
|
|
||||||
static bool simple_read_file(std::istream *stream, pvector<unsigned char> &result);
|
static bool simple_read_file(std::istream *stream, vector_uchar &result);
|
||||||
static bool simple_read_file(std::istream *stream, pvector<unsigned char> &result, size_t max_bytes);
|
static bool simple_read_file(std::istream *stream, vector_uchar &result, size_t max_bytes);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool scan_local_directory(VirtualFileList *file_list,
|
virtual bool scan_local_directory(VirtualFileList *file_list,
|
||||||
|
@ -124,7 +124,7 @@ is_writable(const Filename &file) const {
|
|||||||
*/
|
*/
|
||||||
bool VirtualFileMount::
|
bool VirtualFileMount::
|
||||||
read_file(const Filename &file, bool do_uncompress,
|
read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const {
|
vector_uchar &result) const {
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
istream *in = open_read_file(file, do_uncompress);
|
istream *in = open_read_file(file, do_uncompress);
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
virtual bool is_writable(const Filename &file) const;
|
virtual bool is_writable(const Filename &file) const;
|
||||||
|
|
||||||
virtual bool read_file(const Filename &file, bool do_uncompress,
|
virtual bool read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const;
|
vector_uchar &result) const;
|
||||||
virtual bool write_file(const Filename &file, bool do_compress,
|
virtual bool write_file(const Filename &file, bool do_compress,
|
||||||
const unsigned char *data, size_t data_size);
|
const unsigned char *data, size_t data_size);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ is_regular_file(const Filename &file) const {
|
|||||||
*/
|
*/
|
||||||
bool VirtualFileMountAndroidAsset::
|
bool VirtualFileMountAndroidAsset::
|
||||||
read_file(const Filename &file, bool do_uncompress,
|
read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const {
|
vector_uchar &result) const {
|
||||||
if (do_uncompress) {
|
if (do_uncompress) {
|
||||||
// If the file is to be decompressed, we'd better just use the higher-
|
// If the file is to be decompressed, we'd better just use the higher-
|
||||||
// level implementation, which includes support for on-the-fly
|
// level implementation, which includes support for on-the-fly
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
virtual bool is_regular_file(const Filename &file) const;
|
virtual bool is_regular_file(const Filename &file) const;
|
||||||
|
|
||||||
virtual bool read_file(const Filename &file, bool do_uncompress,
|
virtual bool read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const;
|
vector_uchar &result) const;
|
||||||
|
|
||||||
virtual std::istream *open_read_file(const Filename &file) const;
|
virtual std::istream *open_read_file(const Filename &file) const;
|
||||||
virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const;
|
virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const;
|
||||||
|
@ -59,7 +59,7 @@ is_regular_file(const Filename &file) const {
|
|||||||
*/
|
*/
|
||||||
bool VirtualFileMountMultifile::
|
bool VirtualFileMountMultifile::
|
||||||
read_file(const Filename &file, bool do_uncompress,
|
read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const {
|
vector_uchar &result) const {
|
||||||
if (do_uncompress) {
|
if (do_uncompress) {
|
||||||
// If the file is to be decompressed, we'd better just use the higher-
|
// If the file is to be decompressed, we'd better just use the higher-
|
||||||
// level implementation, which includes support for on-the-fly
|
// level implementation, which includes support for on-the-fly
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
virtual bool is_regular_file(const Filename &file) const;
|
virtual bool is_regular_file(const Filename &file) const;
|
||||||
|
|
||||||
virtual bool read_file(const Filename &file, bool do_uncompress,
|
virtual bool read_file(const Filename &file, bool do_uncompress,
|
||||||
pvector<unsigned char> &result) const;
|
vector_uchar &result) const;
|
||||||
|
|
||||||
virtual std::istream *open_read_file(const Filename &file) const;
|
virtual std::istream *open_read_file(const Filename &file) const;
|
||||||
virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const;
|
virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const;
|
||||||
|
@ -372,7 +372,7 @@ atomic_read_contents(string &contents) const {
|
|||||||
* regular file. Returns true on success, false otherwise.
|
* regular file. Returns true on success, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool VirtualFileSimple::
|
bool VirtualFileSimple::
|
||||||
read_file(pvector<unsigned char> &result, bool auto_unwrap) const {
|
read_file(vector_uchar &result, bool auto_unwrap) const {
|
||||||
|
|
||||||
// Will we be automatically unwrapping a .pz file?
|
// Will we be automatically unwrapping a .pz file?
|
||||||
bool do_uncompress = (_implicit_pz_file ||
|
bool do_uncompress = (_implicit_pz_file ||
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
virtual bool atomic_compare_and_exchange_contents(std::string &orig_contents, const std::string &old_contents, const std::string &new_contents);
|
virtual bool atomic_compare_and_exchange_contents(std::string &orig_contents, const std::string &old_contents, const std::string &new_contents);
|
||||||
virtual bool atomic_read_contents(std::string &contents) const;
|
virtual bool atomic_read_contents(std::string &contents) const;
|
||||||
|
|
||||||
virtual bool read_file(pvector<unsigned char> &result, bool auto_unwrap) const;
|
virtual bool read_file(vector_uchar &result, bool auto_unwrap) const;
|
||||||
virtual bool write_file(const unsigned char *data, size_t data_size, bool auto_wrap);
|
virtual bool write_file(const unsigned char *data, size_t data_size, bool auto_wrap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -140,7 +140,7 @@ read_file(const Filename &filename, std::string &result, bool auto_unwrap) const
|
|||||||
* extension .pz is *not* given.
|
* extension .pz is *not* given.
|
||||||
*/
|
*/
|
||||||
INLINE bool VirtualFileSystem::
|
INLINE bool VirtualFileSystem::
|
||||||
read_file(const Filename &filename, pvector<unsigned char> &result, bool auto_unwrap) const {
|
read_file(const Filename &filename, vector_uchar &result, bool auto_unwrap) const {
|
||||||
PT(VirtualFile) file = get_file(filename, false);
|
PT(VirtualFile) file = get_file(filename, false);
|
||||||
return (file != nullptr && file->read_file(result, auto_unwrap));
|
return (file != nullptr && file->read_file(result, auto_unwrap));
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
bool atomic_read_contents(const Filename &filename, std::string &contents) const;
|
bool atomic_read_contents(const Filename &filename, std::string &contents) const;
|
||||||
|
|
||||||
INLINE bool read_file(const Filename &filename, std::string &result, bool auto_unwrap) const;
|
INLINE bool read_file(const Filename &filename, std::string &result, bool auto_unwrap) const;
|
||||||
INLINE bool read_file(const Filename &filename, pvector<unsigned char> &result, bool auto_unwrap) const;
|
INLINE bool read_file(const Filename &filename, vector_uchar &result, bool auto_unwrap) const;
|
||||||
INLINE bool write_file(const Filename &filename, const unsigned char *data, size_t data_size, bool auto_wrap);
|
INLINE bool write_file(const Filename &filename, const unsigned char *data, size_t data_size, bool auto_wrap);
|
||||||
|
|
||||||
void scan_mount_points(vector_string &names, const Filename &path) const;
|
void scan_mount_points(vector_string &names, const Filename &path) const;
|
||||||
|
@ -28,7 +28,7 @@ ShaderBuffer(const std::string &name, uint64_t size, UsageHint usage_hint) :
|
|||||||
* parameters cannot be modified, but this may change in the future.
|
* parameters cannot be modified, but this may change in the future.
|
||||||
*/
|
*/
|
||||||
INLINE ShaderBuffer::
|
INLINE ShaderBuffer::
|
||||||
ShaderBuffer(const std::string &name, pvector<unsigned char> initial_data, UsageHint usage_hint) :
|
ShaderBuffer(const std::string &name, vector_uchar initial_data, UsageHint usage_hint) :
|
||||||
Namable(name),
|
Namable(name),
|
||||||
_data_size_bytes(initial_data.size()),
|
_data_size_bytes(initial_data.size()),
|
||||||
_usage_hint(usage_hint),
|
_usage_hint(usage_hint),
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "geomEnums.h"
|
#include "geomEnums.h"
|
||||||
#include "graphicsStateGuardianBase.h"
|
#include "graphicsStateGuardianBase.h"
|
||||||
#include "factoryParams.h"
|
#include "factoryParams.h"
|
||||||
|
#include "vector_uchar.h"
|
||||||
|
|
||||||
class BufferContext;
|
class BufferContext;
|
||||||
class PreparedGraphicsObjects;
|
class PreparedGraphicsObjects;
|
||||||
@ -35,7 +36,7 @@ PUBLISHED:
|
|||||||
~ShaderBuffer();
|
~ShaderBuffer();
|
||||||
|
|
||||||
INLINE explicit ShaderBuffer(const std::string &name, uint64_t size, UsageHint usage_hint);
|
INLINE explicit ShaderBuffer(const std::string &name, uint64_t size, UsageHint usage_hint);
|
||||||
INLINE explicit ShaderBuffer(const std::string &name, pvector<unsigned char> initial_data, UsageHint usage_hint);
|
INLINE explicit ShaderBuffer(const std::string &name, vector_uchar initial_data, UsageHint usage_hint);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INLINE uint64_t get_data_size_bytes() const;
|
INLINE uint64_t get_data_size_bytes() const;
|
||||||
@ -59,7 +60,7 @@ PUBLISHED:
|
|||||||
private:
|
private:
|
||||||
uint64_t _data_size_bytes;
|
uint64_t _data_size_bytes;
|
||||||
UsageHint _usage_hint;
|
UsageHint _usage_hint;
|
||||||
pvector<unsigned char> _initial_data;
|
vector_uchar _initial_data;
|
||||||
|
|
||||||
typedef pmap<PreparedGraphicsObjects *, BufferContext *> Contexts;
|
typedef pmap<PreparedGraphicsObjects *, BufferContext *> Contexts;
|
||||||
Contexts *_contexts;
|
Contexts *_contexts;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user