/usr/include/soci/sqlite3/common.h is in libsoci-dev 3.2.3-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | //
// Copyright (C) 2004-2006 Maciej Sobczak, Stephen Hutton
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef SOCI_SQLITE3_COMMON_H_INCLUDED
#define SOCI_SQLITE3_COMMON_H_INCLUDED
#include <error.h>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <vector>
#include <limits>
namespace soci { namespace details { namespace sqlite3 {
// helper function for parsing datetime values
void parse_std_tm(char const *buf, std::tm &t);
// helper for vector operations
template <typename T>
std::size_t get_vector_size(void *p)
{
std::vector<T> *v = static_cast<std::vector<T> *>(p);
return v->size();
}
template <typename T>
void resize_vector(void *p, std::size_t sz)
{
std::vector<T> *v = static_cast<std::vector<T> *>(p);
v->resize(sz);
}
// helper function for parsing integers
template <typename T>
T string_to_integer(char const * buf)
{
long long t(0);
int n(0);
int const converted = std::sscanf(buf, "%" LL_FMT_FLAGS "d%n", &t, &n);
if (converted == 1 && static_cast<std::size_t>(n) == std::strlen(buf))
{
// successfully converted to long long
// and no other characters were found in the buffer
const T max = (std::numeric_limits<T>::max)();
const T min = (std::numeric_limits<T>::min)();
if (t <= static_cast<long long>(max) &&
t >= static_cast<long long>(min))
{
return static_cast<T>(t);
}
}
throw soci_error("Cannot convert data.");
}
// helper function for parsing unsigned integers
template <typename T>
T string_to_unsigned_integer(char const * buf)
{
unsigned long long t(0);
int n(0);
int const converted = std::sscanf(buf, "%" LL_FMT_FLAGS "u%n", &t, &n);
if (converted == 1 && static_cast<std::size_t>(n) == std::strlen(buf))
{
// successfully converted to unsigned long long
// and no other characters were found in the buffer
T const max = (std::numeric_limits<T>::max)();
if (t <= static_cast<unsigned long long>(max))
{
return static_cast<T>(t);
}
}
throw soci_error("Cannot convert data.");
}
}}} // namespace soci::details::sqlite3
#endif // SOCI_SQLITE3_COMMON_H_INCLUDED
|