mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
BinaryStream - fix static analyzer warnings. NFCI.
- uninitialized variables - documention warnings - shadow variable names
This commit is contained in:
parent
28aab49c05
commit
e3b5671420
@ -133,9 +133,9 @@ public:
|
||||
Extractor &getExtractor() { return E; }
|
||||
|
||||
BinaryStreamRef getUnderlyingStream() const { return Stream; }
|
||||
void setUnderlyingStream(BinaryStreamRef S, uint32_t Skew = 0) {
|
||||
Stream = S;
|
||||
this->Skew = Skew;
|
||||
void setUnderlyingStream(BinaryStreamRef NewStream, uint32_t NewSkew = 0) {
|
||||
Stream = NewStream;
|
||||
Skew = NewSkew;
|
||||
}
|
||||
|
||||
void drop_front() { Skew += begin()->length(); }
|
||||
@ -143,7 +143,7 @@ public:
|
||||
private:
|
||||
BinaryStreamRef Stream;
|
||||
Extractor E;
|
||||
uint32_t Skew;
|
||||
uint32_t Skew = 0;
|
||||
};
|
||||
|
||||
template <typename ValueType, typename Extractor>
|
||||
|
@ -148,14 +148,14 @@ public:
|
||||
/// returns an appropriate error code.
|
||||
Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length);
|
||||
|
||||
/// Read \p Length bytes from the underlying stream into \p Stream. This is
|
||||
/// Read \p Length bytes from the underlying stream into \p Ref. This is
|
||||
/// equivalent to calling getUnderlyingStream().slice(Offset, Length).
|
||||
/// Updates the stream's offset to point after the newly read object. Never
|
||||
/// causes a copy.
|
||||
///
|
||||
/// \returns a success error code if the data was successfully read, otherwise
|
||||
/// returns an appropriate error code.
|
||||
Error readSubstream(BinarySubstreamRef &Stream, uint32_t Size);
|
||||
Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length);
|
||||
|
||||
/// Get a pointer to an object of type T from the underlying stream, as if by
|
||||
/// memcpy, and store the result into \p Dest. It is up to the caller to
|
||||
|
@ -198,7 +198,7 @@ public:
|
||||
};
|
||||
|
||||
struct BinarySubstreamRef {
|
||||
uint32_t Offset; // Offset in the parent stream
|
||||
uint32_t Offset = 0; // Offset in the parent stream
|
||||
BinaryStreamRef StreamData; // Stream Data
|
||||
|
||||
BinarySubstreamRef slice(uint32_t Off, uint32_t Size) const {
|
||||
@ -211,8 +211,8 @@ struct BinarySubstreamRef {
|
||||
BinarySubstreamRef keep_front(uint32_t N) const { return slice(0, N); }
|
||||
|
||||
std::pair<BinarySubstreamRef, BinarySubstreamRef>
|
||||
split(uint32_t Offset) const {
|
||||
return std::make_pair(keep_front(Offset), drop_front(Offset));
|
||||
split(uint32_t Off) const {
|
||||
return std::make_pair(keep_front(Off), drop_front(Off));
|
||||
}
|
||||
|
||||
uint32_t size() const { return StreamData.getLength(); }
|
||||
|
@ -139,10 +139,10 @@ Error BinaryStreamReader::readStreamRef(BinaryStreamRef &Ref, uint32_t Length) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Stream,
|
||||
uint32_t Size) {
|
||||
Stream.Offset = getOffset();
|
||||
return readStreamRef(Stream.StreamData, Size);
|
||||
Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Ref,
|
||||
uint32_t Length) {
|
||||
Ref.Offset = getOffset();
|
||||
return readStreamRef(Ref.StreamData, Length);
|
||||
}
|
||||
|
||||
Error BinaryStreamReader::skip(uint32_t Amount) {
|
||||
|
Loading…
Reference in New Issue
Block a user