1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

XML parser fix. Mac filechooser fix.

This commit is contained in:
jules 2012-01-21 09:10:06 +00:00
parent a90aedce50
commit ffaa06c3d0
7 changed files with 30 additions and 9 deletions

View file

@ -176,16 +176,12 @@ SHA256& SHA256::operator= (const SHA256& other) noexcept
SHA256::SHA256 (const MemoryBlock& data)
{
MemoryInputStream m (data, false);
SHA256Processor processor;
processor.processStream (m, -1, result);
process (data.getData(), data.getSize());
}
SHA256::SHA256 (const void* const data, const size_t numBytes)
{
MemoryInputStream m (data, numBytes, false);
SHA256Processor processor;
processor.processStream (m, -1, result);
process (data, numBytes);
}
SHA256::SHA256 (InputStream& input, const int64 numBytesToRead)
@ -209,6 +205,19 @@ SHA256::SHA256 (const File& file)
}
}
SHA256::SHA256 (const CharPointer_UTF8& utf8) noexcept
{
jassert (utf8.getAddress() != nullptr);
process (utf8.getAddress(), utf8.sizeInBytes() - 1);
}
void SHA256::process (const void* const data, size_t numBytes)
{
MemoryInputStream m (data, numBytes, false);
SHA256Processor processor;
processor.processStream (m, -1, result);
}
MemoryBlock SHA256::getRawData() const
{
return MemoryBlock (result, sizeof (result));

View file

@ -77,6 +77,13 @@ public:
*/
explicit SHA256 (const File& file);
/** Creates a checksum from a UTF-8 buffer.
E.g.
@code SHA256 checksum (myString.toUTF8());
@endcode
*/
explicit SHA256 (const CharPointer_UTF8& utf8Text) noexcept;
//==============================================================================
/** Returns the hash as a 32-byte block of data. */
MemoryBlock getRawData() const;
@ -92,6 +99,7 @@ public:
private:
//==============================================================================
uint8 result [32];
void process (const void*, size_t);
JUCE_LEAK_DETECTOR (SHA256);
};