From f3c003481d572c140643e9bbfb292942d8e2ed38 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 26 Sep 2022 12:44:30 +0200 Subject: [PATCH] Made FLV memory-based loader functions use const pointers --- lib/flv_tag.cpp | 6 +++--- lib/flv_tag.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/flv_tag.cpp b/lib/flv_tag.cpp index 9ccb6c41..780c6c5a 100644 --- a/lib/flv_tag.cpp +++ b/lib/flv_tag.cpp @@ -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){ diff --git a/lib/flv_tag.h b/lib/flv_tag.h index ca27f472..10f616b9 100644 --- a/lib/flv_tag.h +++ b/lib/flv_tag.h @@ -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 &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 &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); };