Made FLV memory-based loader functions use const pointers

This commit is contained in:
Thulinma 2022-09-26 12:44:30 +02:00
parent f418fed81c
commit f3c003481d
2 changed files with 6 additions and 6 deletions

View file

@ -49,7 +49,7 @@ bool FLV::check_header(char *header){
/// Checks the first 3 bytes for the string "FLV". Implementing a basic FLV header check,
/// returning true if it is, false if not.
bool FLV::is_header(char *header){
bool FLV::is_header(const char *header){
if (header[0] != 'F') return false;
if (header[1] != 'L') return false;
if (header[2] != 'V') return false;
@ -624,7 +624,7 @@ bool FLV::Tag::ChunkLoader(const RTMPStream::Chunk &O){
/// \param S The size of the data buffer.
/// \param P The current position in the data buffer. Will be updated to reflect new position.
/// \return True if count bytes are read succesfully, false otherwise.
bool FLV::Tag::MemReadUntil(char *buffer, unsigned int count, unsigned int &sofar, char *D,
bool FLV::Tag::MemReadUntil(char *buffer, unsigned int count, unsigned int &sofar, const char *D,
unsigned int S, unsigned int &P){
if (sofar >= count){return true;}
int r = 0;
@ -646,7 +646,7 @@ bool FLV::Tag::MemReadUntil(char *buffer, unsigned int count, unsigned int &sofa
/// location of the data buffer. \param S The size of the data buffer. \param P The current position
/// in the data buffer. Will be updated to reflect new position. \return True if a whole tag is
/// succesfully read, false otherwise.
bool FLV::Tag::MemLoader(char *D, unsigned int S, unsigned int &P){
bool FLV::Tag::MemLoader(const char *D, unsigned int S, unsigned int &P){
if (len < 15){len = 15;}
if (!checkBufferSize()){return false;}
if (done){

View file

@ -22,7 +22,7 @@ namespace FLV{
// functions
bool check_header(char *header); ///< Checks a FLV Header for validness.
bool is_header(char *header); ///< Checks the first 3 bytes for the string "FLV".
bool is_header(const char *header); ///< Checks the first 3 bytes for the string "FLV".
/// Helper function that can quickly skip through a file looking for a particular tag type
bool seekToTagType(FILE *f, uint8_t type);
@ -55,7 +55,7 @@ namespace FLV{
bool DTSCMetaInit(const DTSC::Meta &M, std::set<size_t> &selTracks);
void toMeta(DTSC::Meta &meta, AMF::Object &amf_storage);
void toMeta(DTSC::Meta &meta, AMF::Object &amf_storage, size_t &reTrack, const std::map<std::string, std::string> &targetParams);
bool MemLoader(char *D, unsigned int S, unsigned int &P);
bool MemLoader(const char *D, unsigned int S, unsigned int &P);
bool FileLoader(FILE *f);
unsigned int getTrackID();
char *getData();
@ -68,7 +68,7 @@ namespace FLV{
void setLen();
bool checkBufferSize();
// loader helper functions
bool MemReadUntil(char *buffer, unsigned int count, unsigned int &sofar, char *D,
bool MemReadUntil(char *buffer, unsigned int count, unsigned int &sofar, const char *D,
unsigned int S, unsigned int &P);
bool FileReadUntil(char *buffer, unsigned int count, unsigned int &sofar, FILE *f);
};