Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 242916 | Differences between
and this patch

Collapse All | Expand All

(-)./src/XMLtoUtf8.cc.orig (-6 / +6 lines)
Lines 27-39 Link Here
27
namespace enigma
27
namespace enigma
28
{
28
{
29
    XMLtoUtf8::XMLtoUtf8(const XMLCh* const toTranscode) {
29
    XMLtoUtf8::XMLtoUtf8(const XMLCh* const toTranscode) {
30
        unsigned int srcLength = XMLString::stringLen(toTranscode) + 1;
30
        XMLSize_t srcLength = XMLString::stringLen(toTranscode) + 1;
31
        // make safe assumptions on utf-8 size
31
        // make safe assumptions on utf-8 size
32
        unsigned int maxDestLength = 3 * srcLength;
32
        XMLSize_t maxDestLength = 3 * srcLength;
33
        unsigned int charsEaten;
33
        XMLSize_t charsEaten;
34
        unsigned int destLength;
34
        XMLSize_t destLength;
35
        // make a buffer - size does not matter - the object is temporary 
35
        // make a buffer - size does not matter - the object is temporary 
36
        utf8String = new char[maxDestLength];
36
        XMLByte * utf8String = new XMLByte[maxDestLength];
37
        // transcode to utf-8 -- there are no unrepresentable chars
37
        // transcode to utf-8 -- there are no unrepresentable chars
38
        destLength = app.xmlUtf8Transcoder->transcodeTo(toTranscode, srcLength,
38
        destLength = app.xmlUtf8Transcoder->transcodeTo(toTranscode, srcLength,
39
                (XMLByte *)utf8String, maxDestLength,
39
                (XMLByte *)utf8String, maxDestLength,
Lines 48-54 Link Here
48
        delete [] utf8String;
48
        delete [] utf8String;
49
    }
49
    }
50
50
51
    const char* XMLtoUtf8::c_str() const {
51
    const char* XMLtoUtf8::c_str() const {
52
        return utf8String;
52
        return utf8String;
53
    };
53
    };
54
} //namespace enigma
54
} //namespace enigma
(-)src/Utf8ToXML.hh.orig (-2 / +2 lines)
Lines 43-49 Link Here
43
         *
43
         *
44
         * @param toTranscode utf-8 coded string
44
         * @param toTranscode utf-8 coded string
45
         */
45
         */
46
        Utf8ToXML(const char * const toTranscode);
46
        Utf8ToXML(const XMLByte * const toTranscode);
47
        /**
47
        /**
48
         * Makes a transcoding to the local code page.
48
         * Makes a transcoding to the local code page.
49
         *
49
         *
Lines 69-75 Link Here
69
         * A XML copy. We are the owner.
69
         * A XML copy. We are the owner.
70
         */
70
         */
71
        XMLCh * xmlString;
71
        XMLCh * xmlString;
72
        void init(const char * const toTranscode);
72
        void init(const XMLByte * const toTranscode);
73
    };
73
    };
74
} //namespace enigma
74
} //namespace enigma
75
#endif
75
#endif
(-)src/Utf8ToXML.cc.orig (-9 / +9 lines)
Lines 27-51 Link Here
27
27
28
namespace enigma
28
namespace enigma
29
{
29
{
30
    Utf8ToXML::Utf8ToXML(const char * const toTranscode) {
30
    Utf8ToXML::Utf8ToXML(const XMLByte * const toTranscode) {
31
        init(toTranscode);
31
        init(toTranscode);
32
    }
32
    }
33
    
33
    
34
    Utf8ToXML::Utf8ToXML(const std::string * const toTranscode) {
34
    Utf8ToXML::Utf8ToXML(const std::string * const toTranscode) {
35
        init(toTranscode->c_str());
35
        init((XMLByte *)toTranscode->c_str());
36
    }
36
    }
37
    
37
    
38
    Utf8ToXML::Utf8ToXML(const std::string toTranscode) {
38
    Utf8ToXML::Utf8ToXML(const std::string toTranscode) {
39
        init(toTranscode.c_str());
39
        init((XMLByte *)toTranscode.c_str());
40
    }
40
    }
41
41
42
    void Utf8ToXML::init(const char * const toTranscode) {
42
    void Utf8ToXML::init(const XMLByte * const toTranscode) {
43
        unsigned int srcLength = std::strlen(toTranscode) + 1;
43
        XMLSize_t srcLength = (XMLSize_t) std::strlen((const char* )toTranscode) + 1;
44
        // make safe assumptions on utf-16 size
44
        // make safe assumptions on utf-16 size
45
        unsigned int maxDestLength = srcLength;
45
        XMLSize_t maxDestLength = srcLength;
46
        unsigned int charsEaten;
46
        XMLSize_t charsEaten;
47
        unsigned int destLength;
47
        XMLSize_t destLength;
48
        unsigned char *charSizes = new unsigned char[maxDestLength]; // just junk
48
        XMLByte *charSizes = new XMLByte[maxDestLength]; // just junk
49
        // make a buffer - size does not matter - the object is temporary 
49
        // make a buffer - size does not matter - the object is temporary 
50
        xmlString = new XMLCh[maxDestLength];
50
        xmlString = new XMLCh[maxDestLength];
51
        // transcode to utf-8 -- there are no unrepresentable chars
51
        // transcode to utf-8 -- there are no unrepresentable chars

Return to bug 242916