1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 23:26:40 +02:00

Update breakpad to make it work with MinGW

This commit is contained in:
Dominik Schmidt
2014-04-14 19:23:44 +02:00
parent c912b76c49
commit b4f05b0831
1049 changed files with 57520 additions and 329083 deletions

View File

@@ -27,19 +27,22 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _WIN32
#include <arpa/inet.h>
#endif
#include <limits.h>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "processor/binarystream.h"
namespace google_breakpad {
using std::string;
using std::vector;
binarystream &binarystream::operator>>(std::string &str) {
u_int16_t length;
binarystream &binarystream::operator>>(string &str) {
uint16_t length;
*this >> length;
if (eof())
return *this;
@@ -54,68 +57,68 @@ binarystream &binarystream::operator>>(std::string &str) {
return *this;
}
binarystream &binarystream::operator>>(u_int8_t &u8) {
binarystream &binarystream::operator>>(uint8_t &u8) {
stream_.read((char *)&u8, 1);
return *this;
}
binarystream &binarystream::operator>>(u_int16_t &u16) {
u_int16_t temp;
binarystream &binarystream::operator>>(uint16_t &u16) {
uint16_t temp;
stream_.read((char *)&temp, 2);
if (!eof())
u16 = ntohs(temp);
return *this;
}
binarystream &binarystream::operator>>(u_int32_t &u32) {
u_int32_t temp;
binarystream &binarystream::operator>>(uint32_t &u32) {
uint32_t temp;
stream_.read((char *)&temp, 4);
if (!eof())
u32 = ntohl(temp);
return *this;
}
binarystream &binarystream::operator>>(u_int64_t &u64) {
u_int32_t lower, upper;
binarystream &binarystream::operator>>(uint64_t &u64) {
uint32_t lower, upper;
*this >> lower >> upper;
if (!eof())
u64 = static_cast<u_int64_t>(lower) | (static_cast<u_int64_t>(upper) << 32);
u64 = static_cast<uint64_t>(lower) | (static_cast<uint64_t>(upper) << 32);
return *this;
}
binarystream &binarystream::operator<<(const std::string &str) {
binarystream &binarystream::operator<<(const string &str) {
if (str.length() > USHRT_MAX) {
// truncate to 16-bit length
*this << static_cast<u_int16_t>(USHRT_MAX);
*this << static_cast<uint16_t>(USHRT_MAX);
stream_.write(str.c_str(), USHRT_MAX);
} else {
*this << (u_int16_t)(str.length() & 0xFFFF);
*this << (uint16_t)(str.length() & 0xFFFF);
stream_.write(str.c_str(), str.length());
}
return *this;
}
binarystream &binarystream::operator<<(u_int8_t u8) {
binarystream &binarystream::operator<<(uint8_t u8) {
stream_.write((const char*)&u8, 1);
return *this;
}
binarystream &binarystream::operator<<(u_int16_t u16) {
binarystream &binarystream::operator<<(uint16_t u16) {
u16 = htons(u16);
stream_.write((const char*)&u16, 2);
return *this;
}
binarystream &binarystream::operator<<(u_int32_t u32) {
binarystream &binarystream::operator<<(uint32_t u32) {
u32 = htonl(u32);
stream_.write((const char*)&u32, 4);
return *this;
}
binarystream &binarystream::operator<<(u_int64_t u64) {
binarystream &binarystream::operator<<(uint64_t u64) {
// write 64-bit ints as two 32-bit ints, so we can byte-swap them easily
u_int32_t lower = static_cast<u_int32_t>(u64 & 0xFFFFFFFF);
u_int32_t upper = static_cast<u_int32_t>(u64 >> 32);
uint32_t lower = static_cast<uint32_t>(u64 & 0xFFFFFFFF);
uint32_t upper = static_cast<uint32_t>(u64 >> 32);
*this << lower << upper;
return *this;
}