Skip to content

Commit

Permalink
Remove asserts
Browse files Browse the repository at this point in the history
For the record, I think this is not a good change, but it was very
strongly requested during code review, so here we are.
  • Loading branch information
Krzmbrzl committed Jan 16, 2024
1 parent be46771 commit 3e21119
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/backends/mysql/blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <ciso646>

#include <cctype>
#include <cassert>

#ifdef _MSC_VER
#pragma warning(push)
Expand Down Expand Up @@ -64,8 +63,6 @@ std::size_t mysql_blob_backend::hex_str_size() const

void mysql_blob_backend::write_hex_str(char *buf, std::size_t size) const
{
assert(size >= hex_str_size());

if (size < hex_str_size())
{
throw soci_error("MySQL BLOB: Provided buffer is too small to hold hex string");
Expand Down Expand Up @@ -114,8 +111,6 @@ void mysql_blob_backend::load_from_hex_str(const char *str, std::size_t length)

if (nBytes > 0)
{
assert(nBytes > 1);

// The first "byte" as detected by above calculation is only the prefix "0x"
nBytes -= 1;
}
Expand Down
8 changes: 0 additions & 8 deletions src/core/blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "soci/soci-platform.h"

#include <cstddef>
#include <cassert>

using namespace soci;

Expand All @@ -24,13 +23,11 @@ blob::~blob() = default;

std::size_t blob::get_len()
{
assert(backEnd_);
return backEnd_->get_len();
}

std::size_t blob::read(std::size_t offset, char *buf, std::size_t toRead)
{
assert(backEnd_);
SOCI_ALLOW_DEPRECATED_BEGIN
return backEnd_->read(offset, buf, toRead);
SOCI_ALLOW_DEPRECATED_END
Expand All @@ -39,14 +36,12 @@ std::size_t blob::read(std::size_t offset, char *buf, std::size_t toRead)
std::size_t blob::read_from_start(char * buf, std::size_t toRead,
std::size_t offset)
{
assert(backEnd_);
return backEnd_->read_from_start(buf, toRead, offset);
}

std::size_t blob::write(
std::size_t offset, char const * buf, std::size_t toWrite)
{
assert(backEnd_);
SOCI_ALLOW_DEPRECATED_BEGIN
return backEnd_->write(offset, buf, toWrite);
SOCI_ALLOW_DEPRECATED_END
Expand All @@ -55,18 +50,15 @@ std::size_t blob::write(
std::size_t blob::write_from_start(const char * buf, std::size_t toWrite,
std::size_t offset)
{
assert(backEnd_);
return backEnd_->write_from_start(buf, toWrite, offset);
}

std::size_t blob::append(char const * buf, std::size_t toWrite)
{
assert(backEnd_);
return backEnd_->append(buf, toWrite);
}

void blob::trim(std::size_t newLen)
{
assert(backEnd_);
backEnd_->trim(newLen);
}

0 comments on commit 3e21119

Please sign in to comment.