diff --git a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.cpp b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.cpp index b1bd7d1e..1805c2a8 100644 --- a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.cpp +++ b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.cpp @@ -2,7 +2,7 @@ #include -AbstractSalsa20Processor::AbstractSalsa20Processor(const int streamCount, std::string& zoneName, const uint8_t* salsa20Key, size_t keySize) +AbstractSalsa20Processor::AbstractSalsa20Processor(const int streamCount, const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) : m_stream_count(streamCount), m_stream_contexts(std::make_unique(streamCount)), m_stream_block_indices(std::make_unique(streamCount)) @@ -19,9 +19,9 @@ uint8_t* AbstractSalsa20Processor::GetHashBlock(const int streamNumber) const return &m_block_hashes[blockIndexOffset + streamOffset]; } -void AbstractSalsa20Processor::InitStreams(std::string& zoneName, const uint8_t* salsa20Key, size_t keySize) const +void AbstractSalsa20Processor::InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) const { - const int zoneNameLength = zoneName.length(); + const auto zoneNameLength = zoneName.length(); const size_t blockHashBufferSize = BLOCK_HASHES_COUNT * m_stream_count * SHA1_HASH_SIZE; assert(blockHashBufferSize % 4 == 0); diff --git a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h index c769eb19..38ed4aad 100644 --- a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h +++ b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h @@ -28,11 +28,11 @@ protected: std::unique_ptr m_block_hashes; std::unique_ptr m_stream_block_indices; - AbstractSalsa20Processor(int streamCount, std::string& zoneName, const uint8_t* salsa20Key, size_t keySize); + AbstractSalsa20Processor(int streamCount, const std::string& zoneName, const uint8_t* salsa20Key, size_t keySize); _NODISCARD uint8_t* GetHashBlock(int streamNumber) const; - void InitStreams(std::string& zoneName, const uint8_t* salsa20Key, size_t keySize) const; + void InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, size_t keySize) const; public: virtual ~AbstractSalsa20Processor() = default; diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp index 4bca33f8..3f36b12d 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp @@ -3,7 +3,7 @@ #include XChunkProcessorSalsa20Encryption::XChunkProcessorSalsa20Encryption(const int streamCount, - std::string& zoneName, + const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) : AbstractSalsa20Processor(streamCount, zoneName, salsa20Key, keySize) diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h index b1fa7206..89272df3 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h @@ -8,7 +8,7 @@ class XChunkProcessorSalsa20Encryption final : public IXChunkProcessor, public AbstractSalsa20Processor { public: - XChunkProcessorSalsa20Encryption(int streamCount, std::string& zoneName, const uint8_t* salsa20Key, size_t keySize); + XChunkProcessorSalsa20Encryption(int streamCount, const std::string& zoneName, const uint8_t* salsa20Key, size_t keySize); size_t Process(int streamNumber, const uint8_t* input, size_t inputLength, uint8_t* output, size_t outputBufferSize) override; }; diff --git a/src/ZoneWriting/Writing/ZoneWriter.cpp b/src/ZoneWriting/Writing/ZoneWriter.cpp index 0a7e7a83..82e4287b 100644 --- a/src/ZoneWriting/Writing/ZoneWriter.cpp +++ b/src/ZoneWriting/Writing/ZoneWriter.cpp @@ -3,6 +3,7 @@ #include "WritingException.h" #include "WritingFileStream.h" +#include #include #include @@ -42,7 +43,7 @@ void ZoneWriter::AddStreamProcessor(std::unique_ptr strea m_processor_chain_dirty = true; } -void ZoneWriter::RemoveStreamProcessor(OutputStreamProcessor* streamProcessor) +void ZoneWriter::RemoveStreamProcessor(const OutputStreamProcessor* streamProcessor) { for (auto i = m_processors.begin(); i < m_processors.end(); ++i) { @@ -72,12 +73,12 @@ bool ZoneWriter::WriteZone(std::ostream& stream) } catch (WritingException& e) { - std::cout << "Writing fastfile failed: " << e.Message() << "\n"; + std::cout << std::format("Writing fastfile failed: {}\n", e.Message()); return false; } catch (std::runtime_error& e) { - std::cout << "Writing fastfile failed: " << e.what() << "\n"; + std::cout << std::format("Writing fastfile failed: {}\n", e.what()); return false; } diff --git a/src/ZoneWriting/Writing/ZoneWriter.h b/src/ZoneWriting/Writing/ZoneWriter.h index 231bc5ee..739d8565 100644 --- a/src/ZoneWriting/Writing/ZoneWriter.h +++ b/src/ZoneWriting/Writing/ZoneWriter.h @@ -27,7 +27,7 @@ public: void AddWritingStep(std::unique_ptr step); void AddStreamProcessor(std::unique_ptr streamProcessor); - void RemoveStreamProcessor(OutputStreamProcessor* streamProcessor); + void RemoveStreamProcessor(const OutputStreamProcessor* streamProcessor); bool WriteZone(std::ostream& stream); };