diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:09:34 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:09:34 +0000 |
commit | 9b6dc1a5856229a0dfe1fb5838c1a1e2ea02cb6d (patch) | |
tree | 4a112ed17bc16dfc6509ff26b4f0783d386647a4 /src/pugixml.cpp | |
parent | 608d5bbd79b120602a3a5272fa73ca3d5916aeb1 (diff) |
Added workarounds for all instances of DMC overfetch bug
git-svn-id: http://pugixml.googlecode.com/svn/trunk@640 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 857d656..16ff6ab 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -1077,7 +1077,12 @@ namespace // try to guess encoding (based on XML specification, Appendix F.1) const uint8_t* data = static_cast<const uint8_t*>(contents); - return guess_buffer_encoding(data[0], data[1], data[2], data[3]); + #ifdef __DMC__ + volatile // explicitly store to local to work around DMC bug (it loads 4 bytes from data[3] otherwise) + #endif + uint8_t d0 = data[0], d1 = data[1], d2 = data[2], d3 = data[3]; + + return guess_buffer_encoding(d0, d1, d2, d3); } bool get_mutable_buffer(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, bool is_mutable) |