예제 #1
0
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
    const String xmlString (xml.createDocument (String::empty, true, false));
    const size_t stringLength = xmlString.getNumBytesAsUTF8();

    destData.setSize (stringLength + 9);

    uint32* const d = static_cast<uint32*> (destData.getData());
    d[0] = ByteOrder::swapIfBigEndian ((const uint32) magicXmlNumber);
    d[1] = ByteOrder::swapIfBigEndian ((const uint32) stringLength);

    xmlString.copyToUTF8 ((CharPointer_UTF8::CharType*) (d + 2), stringLength + 1);
}
예제 #2
0
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
    const String xmlString (xml.createDocument (String::empty, true, false));
    const int stringLength = xmlString.getNumBytesAsUTF8();

    destData.setSize ((size_t) stringLength + 10);

    char* const d = static_cast<char*> (destData.getData());
    *(uint32*) d = ByteOrder::swapIfBigEndian ((const uint32) magicXmlNumber);
    *(uint32*) (d + 4) = ByteOrder::swapIfBigEndian ((const uint32) stringLength);

    xmlString.copyToUTF8 (d + 8, stringLength + 1);
}
예제 #3
0
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
    {
        MemoryOutputStream out (destData, false);
        out.writeInt (magicXmlNumber);
        out.writeInt (0);
        xml.writeToStream (out, String::empty, true, false);
        out.writeByte (0);
    }

    // go back and write the string length..
    static_cast<uint32*> (destData.getData())[1]
        = ByteOrder::swapIfBigEndian ((uint32) destData.getSize() - 9);
}
예제 #4
0
파일: jojoRSA.cpp 프로젝트: frantic0/Jojo
void jojo_bang (t_jojo *x)
{
    const ScopedLock myLock (x->lock_); 
    
    post ("Public / %s", x->public_.toString().toRawUTF8());
    post ("Private / %s", x->private_.toString().toRawUTF8());
    
    String myText (CharPointer_UTF8 ("P\xc3\xa9p\xc3\xa9 p\xc3\xa8te en ao\xc3\xbbt!"));
    
    post ("%s", myText.toRawUTF8());
    
    const juce::MemoryBlock blockBegin (myText.toRawUTF8(), myText.getNumBytesAsUTF8() + 1);

    BigInteger bitArray;
    bitArray.loadFromMemoryBlock (blockBegin);
    x->public_.applyToValue (bitArray);             /* Encrypt with the public key. */

    post ("%s", bitArray.toString (16).toRawUTF8());
    
    x->private_.applyToValue (bitArray);            /* Then decrypt with the private key. */
    
    const juce::MemoryBlock blockEnd (bitArray.toMemoryBlock());
    post ("%s", blockEnd.toString().toRawUTF8());
}