Use fully static linkage #364

Closed
bvbfan wants to merge 78 commits from static_link into master
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 6dfe15ed2e - Show all commits

View file

@ -42,7 +42,7 @@ namespace sqlite
auto ptr = sqlite3_column_blob(stmt, inx); auto ptr = sqlite3_column_blob(stmt, inx);
if (!ptr) return ret; if (!ptr) return ret;
int bytes = sqlite3_column_bytes(stmt, inx); int bytes = sqlite3_column_bytes(stmt, inx);
assert(bytes <= ret.size()); assert(bytes > 0 && bytes <= int(ret.size()));
std::memcpy(ret.begin(), ptr, bytes); std::memcpy(ret.begin(), ptr, bytes);
return ret; return ret;
} }
@ -52,7 +52,7 @@ namespace sqlite
auto ptr = sqlite3_column_blob(stmt, inx); auto ptr = sqlite3_column_blob(stmt, inx);
if (!ptr) return ret; if (!ptr) return ret;
int bytes = sqlite3_column_bytes(stmt, inx); int bytes = sqlite3_column_bytes(stmt, inx);
assert(bytes <= ret.size()); assert(bytes > 0 && bytes <= int(ret.size()));
std::memcpy(ret.begin(), ptr, bytes); std::memcpy(ret.begin(), ptr, bytes);
return ret; return ret;
} }

View file

@ -44,6 +44,7 @@ namespace sqlite {
auto ptr = (const unsigned char*)sqlite3_column_blob(stmt, inx); auto ptr = (const unsigned char*)sqlite3_column_blob(stmt, inx);
if (!ptr) return {}; if (!ptr) return {};
int bytes = sqlite3_column_bytes(stmt, inx); int bytes = sqlite3_column_bytes(stmt, inx);
assert(bytes >= 0);
return CScript(ptr, ptr + bytes); return CScript(ptr, ptr + bytes);
} }
@ -62,7 +63,7 @@ namespace sqlite {
uint256 ret; uint256 ret;
if (!ptr) return ret; if (!ptr) return ret;
int bytes = sqlite3_column_bytes(stmt, inx); int bytes = sqlite3_column_bytes(stmt, inx);
assert(bytes <= ret.size()); assert(bytes > 0 && bytes <= int(ret.size()));
std::memcpy(ret.begin(), ptr, bytes); std::memcpy(ret.begin(), ptr, bytes);
return ret; return ret;
} }