general: pvector<unsigned char> -> vector_uchar

This commit is contained in:
Sam Edwards 2018-06-10 01:34:54 -06:00
parent f1eb811c0e
commit 3c6ebb56bd
21 changed files with 34 additions and 30 deletions

View File

@ -26,6 +26,7 @@
#include "subfileInfo.h"
#include "reMutexHolder.h"
#include "virtualFileSystem.h"
#include "vector_uchar.h"
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();
string os_filename;
pvector<unsigned char> mem_buffer;
vector_uchar mem_buffer;
SubfileInfo info;
if (preload) {
// Pre-read the file right now, and pass it in as a memory buffer. This

View File

@ -67,7 +67,7 @@ public:
// For software MIDI:
HDLSDEVICE _dls_device;
HDLSFILEID _dls_file;
pvector<unsigned char> _dls_data;
vector_uchar _dls_data;
private:
void open_api();

View File

@ -28,6 +28,7 @@
#include "pmutex.h"
#include "lightReMutex.h"
#include "conditionVar.h"
#include "vector_uchar.h"
class MilesAudioSound;
@ -126,7 +127,7 @@ private:
Filename _basename;
S32 _file_type;
pvector<unsigned char> _raw_data;
vector_uchar _raw_data;
bool _has_length;
PN_stdfloat _length; // in seconds.
};

View File

@ -191,7 +191,7 @@ hash_string(const std::string &data) {
* functionality) available.
*/
INLINE void HashVal::
hash_bytes(const pvector<unsigned char> &data) {
hash_bytes(const vector_uchar &data) {
hash_buffer((const char *)&data[0], data.size());
}
#endif // HAVE_OPENSSL

View File

@ -22,6 +22,7 @@
#include "datagramIterator.h"
#include "streamWriter.h"
#include "streamReader.h"
#include "vector_uchar.h"
/**
* Stores a 128-bit value that represents the hashed contents (typically MD5)
@ -68,7 +69,7 @@ PUBLISHED:
bool hash_stream(std::istream &stream);
INLINE void hash_ramfile(const Ramfile &ramfile);
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);
#endif // HAVE_OPENSSL

View File

@ -1863,7 +1863,7 @@ read_subfile(int index, string &result) {
// 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
// Windows implementation of STL.
pvector<unsigned char> pv;
vector_uchar pv;
if (!read_subfile(index, pv)) {
return false;
}
@ -1879,7 +1879,7 @@ read_subfile(int index, string &result) {
* Fills a pvector with the entire contents of the indicated subfile.
*/
bool Multifile::
read_subfile(int index, pvector<unsigned char> &result) {
read_subfile(int index, vector_uchar &result) {
nassertr(is_read_valid(), false);
nassertr(index >= 0 && index < (int)_subfiles.size(), false);
result.clear();
@ -2388,7 +2388,7 @@ check_signatures() {
size_t num_certs = reader.get_uint32();
// Read the remaining buffer of certificate data.
pvector<unsigned char> buffer;
vector_uchar buffer;
bool success = VirtualFile::simple_read_file(stream, buffer);
nassertv(success);
close_read_subfile(stream);

View File

@ -159,7 +159,7 @@ public:
#endif // HAVE_OPENSSL
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:
enum SubfileFlags {

View File

@ -351,7 +351,7 @@ bool VirtualFile::
read_file(string &result, bool auto_unwrap) const {
result = string();
pvector<unsigned char> pv;
vector_uchar pv;
if (!read_file(pv, auto_unwrap)) {
return false;
}
@ -368,7 +368,7 @@ read_file(string &result, bool auto_unwrap) const {
* regular file. Returns true on success, false otherwise.
*/
bool VirtualFile::
read_file(pvector<unsigned char> &result, bool auto_unwrap) const {
read_file(vector_uchar &result, bool auto_unwrap) const {
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.
*/
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;
char buffer[buffer_size];
@ -408,7 +408,7 @@ simple_read_file(istream *in, pvector<unsigned char> &result) {
* max_bytes bytes from the file.
*/
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;
char buffer[buffer_size];

View File

@ -21,7 +21,7 @@
#include "pointerTo.h"
#include "typedReferenceCount.h"
#include "ordered_vector.h"
#include "pvector.h"
#include "vector_uchar.h"
class VirtualFileMount;
class VirtualFileList;
@ -85,11 +85,11 @@ public:
INLINE void set_original_filename(const Filename &filename);
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);
static bool simple_read_file(std::istream *stream, pvector<unsigned char> &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);
static bool simple_read_file(std::istream *stream, vector_uchar &result, size_t max_bytes);
protected:
virtual bool scan_local_directory(VirtualFileList *file_list,

View File

@ -124,7 +124,7 @@ is_writable(const Filename &file) const {
*/
bool VirtualFileMount::
read_file(const Filename &file, bool do_uncompress,
pvector<unsigned char> &result) const {
vector_uchar &result) const {
result.clear();
istream *in = open_read_file(file, do_uncompress);

View File

@ -54,7 +54,7 @@ public:
virtual bool is_writable(const Filename &file) const;
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,
const unsigned char *data, size_t data_size);

View File

@ -93,7 +93,7 @@ is_regular_file(const Filename &file) const {
*/
bool VirtualFileMountAndroidAsset::
read_file(const Filename &file, bool do_uncompress,
pvector<unsigned char> &result) const {
vector_uchar &result) const {
if (do_uncompress) {
// If the file is to be decompressed, we'd better just use the higher-
// level implementation, which includes support for on-the-fly

View File

@ -40,7 +40,7 @@ public:
virtual bool is_regular_file(const Filename &file) const;
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::streamsize get_file_size(const Filename &file, std::istream *stream) const;

View File

@ -59,7 +59,7 @@ is_regular_file(const Filename &file) const {
*/
bool VirtualFileMountMultifile::
read_file(const Filename &file, bool do_uncompress,
pvector<unsigned char> &result) const {
vector_uchar &result) const {
if (do_uncompress) {
// If the file is to be decompressed, we'd better just use the higher-
// level implementation, which includes support for on-the-fly

View File

@ -36,7 +36,7 @@ public:
virtual bool is_regular_file(const Filename &file) const;
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::streamsize get_file_size(const Filename &file, std::istream *stream) const;

View File

@ -372,7 +372,7 @@ atomic_read_contents(string &contents) const {
* regular file. Returns true on success, false otherwise.
*/
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?
bool do_uncompress = (_implicit_pz_file ||

View 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_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);
protected:

View File

@ -140,7 +140,7 @@ read_file(const Filename &filename, std::string &result, bool auto_unwrap) const
* extension .pz is *not* given.
*/
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);
return (file != nullptr && file->read_file(result, auto_unwrap));
}

View File

@ -118,7 +118,7 @@ public:
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, 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);
void scan_mount_points(vector_string &names, const Filename &path) const;

View File

@ -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.
*/
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),
_data_size_bytes(initial_data.size()),
_usage_hint(usage_hint),

View File

@ -20,6 +20,7 @@
#include "geomEnums.h"
#include "graphicsStateGuardianBase.h"
#include "factoryParams.h"
#include "vector_uchar.h"
class BufferContext;
class PreparedGraphicsObjects;
@ -35,7 +36,7 @@ PUBLISHED:
~ShaderBuffer();
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:
INLINE uint64_t get_data_size_bytes() const;
@ -59,7 +60,7 @@ PUBLISHED:
private:
uint64_t _data_size_bytes;
UsageHint _usage_hint;
pvector<unsigned char> _initial_data;
vector_uchar _initial_data;
typedef pmap<PreparedGraphicsObjects *, BufferContext *> Contexts;
Contexts *_contexts;