Loading 3party/libelfin/dwarf/cursor.cc +141 −146 Original line number Diff line number Diff line Loading @@ -4,8 +4,8 @@ #include "internal.hh" #include <stdexcept> #include <cstring> #include <stdexcept> using namespace std; Loading @@ -22,8 +22,7 @@ cursor::sleb128() result |= (uint64_t) (byte & 0x7f) << shift; shift += 7; if ((byte & 0x80) == 0) { if (shift < sizeof(result)*8 && (byte & 0x40)) result |= -((uint64_t)1 << shift); if (shift < sizeof(result) * 8 && (byte & 0x40)) result |= -((uint64_t) 1 << shift); return result; } } Loading Loading @@ -91,8 +90,9 @@ cursor::string(std::string &out) { size_t size; const char *p = this->cstr(&size); out.resize(size); memmove(&out.front(), p, size); // out.resize(size); // memmove(&out.front(), p, size); out = std::string(p, p + size); } const char * Loading @@ -100,12 +100,9 @@ cursor::cstr(size_t *size_out) { // Scan string size const char *p = pos; while (pos < sec->end && *pos) pos++; if (pos == sec->end) throw format_error("unterminated string"); if (size_out) *size_out = pos - p; while (pos < sec->end && *pos) pos++; if (pos == sec->end) throw format_error("unterminated string"); if (size_out) *size_out = pos - p; pos++; return p; } Loading Loading @@ -179,13 +176,11 @@ cursor::skip_form(DW_FORM form) case DW_FORM::sdata: case DW_FORM::udata: case DW_FORM::ref_udata: while (pos < sec->end && (*(uint8_t*)pos & 0x80)) pos++; while (pos < sec->end && (*(uint8_t *) pos & 0x80)) pos++; pos++; break; case DW_FORM::string: while (pos < sec->end && *pos) pos++; while (pos < sec->end && *pos) pos++; pos++; break; Loading Loading
3party/libelfin/dwarf/cursor.cc +141 −146 Original line number Diff line number Diff line Loading @@ -4,8 +4,8 @@ #include "internal.hh" #include <stdexcept> #include <cstring> #include <stdexcept> using namespace std; Loading @@ -22,8 +22,7 @@ cursor::sleb128() result |= (uint64_t) (byte & 0x7f) << shift; shift += 7; if ((byte & 0x80) == 0) { if (shift < sizeof(result)*8 && (byte & 0x40)) result |= -((uint64_t)1 << shift); if (shift < sizeof(result) * 8 && (byte & 0x40)) result |= -((uint64_t) 1 << shift); return result; } } Loading Loading @@ -91,8 +90,9 @@ cursor::string(std::string &out) { size_t size; const char *p = this->cstr(&size); out.resize(size); memmove(&out.front(), p, size); // out.resize(size); // memmove(&out.front(), p, size); out = std::string(p, p + size); } const char * Loading @@ -100,12 +100,9 @@ cursor::cstr(size_t *size_out) { // Scan string size const char *p = pos; while (pos < sec->end && *pos) pos++; if (pos == sec->end) throw format_error("unterminated string"); if (size_out) *size_out = pos - p; while (pos < sec->end && *pos) pos++; if (pos == sec->end) throw format_error("unterminated string"); if (size_out) *size_out = pos - p; pos++; return p; } Loading Loading @@ -179,13 +176,11 @@ cursor::skip_form(DW_FORM form) case DW_FORM::sdata: case DW_FORM::udata: case DW_FORM::ref_udata: while (pos < sec->end && (*(uint8_t*)pos & 0x80)) pos++; while (pos < sec->end && (*(uint8_t *) pos & 0x80)) pos++; pos++; break; case DW_FORM::string: while (pos < sec->end && *pos) pos++; while (pos < sec->end && *pos) pos++; pos++; break; Loading