Chromium Code Reviews| Index: ui/base/resource/resource_bundle.cc |
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc |
| index aa0b6f5de93daceedf60dc922d26a07d504ad034..4a85aeeae62ae78c995c838b8a7280cee886b9f9 100644 |
| --- a/ui/base/resource/resource_bundle.cc |
| +++ b/ui/base/resource/resource_bundle.cc |
| @@ -18,7 +18,6 @@ |
| #include "base/synchronization/lock.h" |
| #include "build/build_config.h" |
| #include "grit/app_locale_settings.h" |
| -#include "net/base/big_endian.h" |
| #include "skia/ext/image_operations.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -762,9 +761,14 @@ bool ResourceBundle::ShouldHighlightMissingScaledResources() { |
| switches::kHighlightMissingScaledResources); |
| } |
| +uint32_t ReadBigEndian32(const void* ptr) { |
|
tfarina
2014/02/12 02:08:22
Where I should put this function?
tfarina
2014/02/12 02:08:22
I copied this function from ppapi/tests/test_truet
tfarina
2014/02/12 02:08:22
There is another one in content/browser/speech/chu
tony
2014/02/12 02:23:02
Probably somewhere in base since it's used in so m
|
| + const uint8_t* data = reinterpret_cast<const uint8_t*>(ptr); |
| + return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24); |
| +} |
| + |
| // static |
| bool ResourceBundle::PNGContainsFallbackMarker(const unsigned char* buf, |
| - size_t size) { |
| + size_t size) { |
| if (size < arraysize(kPngMagic) || |
| memcmp(buf, kPngMagic, arraysize(kPngMagic)) != 0) { |
| // Data invalid or a JPEG. |
| @@ -777,8 +781,7 @@ bool ResourceBundle::PNGContainsFallbackMarker(const unsigned char* buf, |
| for (;;) { |
| if (size - pos < kPngChunkMetadataSize) |
| break; |
| - uint32 length = 0; |
| - net::ReadBigEndian(reinterpret_cast<const char*>(buf + pos), &length); |
| + uint32 length = ReadBigEndian32(buf + pos); |
| if (size - pos - kPngChunkMetadataSize < length) |
| break; |
| if (length == 0 && memcmp(buf + pos + sizeof(uint32), kPngScaleChunkType, |