mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-08 12:19:21 +01:00
* chore(CppParser): 0, NULL --> nullptr * chore(Crypto): 0, NULL --> nullptr * chore(DNSSD): 0, NULL --> nullptr * chore(Encodings): 0, NULL --> nullptr * chore(CppUnit): Correct indentation. * chore(Foundation): 0, NULL --> nullptr * chore(CMake): Always warn about wrong nullptr usage when compiling with GCC or CLang * chore(Net): 0, NULL --> nullptr * chore(Foundation): 0, NULL --> nullptr * chore(Data): 0, NULL --> nullptr * chore(macOS): 0, NULL --> nullptr * chore(XML): 0, NULL --> nullptr * chore(Zip): 0, NULL --> nullptr * chore(Util): 0, NULL --> nullptr * chore(Net/NetSSL): 0, NULL --> nullptr * chore(Bonjour): 0, NULL --> nullptr * chore(MongoDB, Redis): 0, NULL --> nullptr * chore(Poco): 0, NULL --> nullptr * chore(Win32): 0, NULL --> nullptr * chore(CMake): Only warn about nullptr when verbose warnings are enabled. * Potential fix for code scanning alert no. 1634: Guarded Free Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore(Net): Fix warning reported by gitlab. * chore(gitlab CI): attempt to clean to gain disk space on the runner. * chore(gitlab CI): Run build with --parallel 4, correct docker cleanup. --------- Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
export CXX=clang++-20
|
||||
cmake -S . -B build -G Ninja -DPOCO_BUILD_MODULES=ON
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
run: cmake --build build --parallel 4
|
||||
|
||||
android-arm64-v8a-ndk-latest-cmake:
|
||||
runs-on: ubuntu-22.04
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DENABLE_TESTS=ON -DPOCO_MINIMAL_BUILD=TRUE
|
||||
-DENABLE_NET=ON -DENABLE_JSON=ON -DENABLE_XML=ON -DENABLE_ZIP=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
|
||||
linux-gcc-cmake-cross-armhf:
|
||||
# Converted from a make job, what is essentially different from the above?
|
||||
@@ -100,14 +100,14 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DENABLE_TESTS=ON -DPOCO_MINIMAL_BUILD=TRUE
|
||||
-DENABLE_NET=ON -DENABLE_JSON=ON -DENABLE_XML=ON -DENABLE_ZIP=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
|
||||
linux-gcc-cmake:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: sudo apt -y update && sudo apt -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server
|
||||
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
|
||||
- run: cmake -S. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DCMAKE_CXX_VISIBILITY_PRESET=hidden
|
||||
-DENABLE_PDF=ON -DENABLE_TESTS=ON -DENABLE_DATA_MYSQL=ON -DENABLE_DATA_ODBC=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -147,7 +147,7 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON
|
||||
-DENABLE_DATA_MYSQL=ON -DENABLE_PDF=ON -DENABLE_XML=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -168,7 +168,7 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DENABLE_TESTS=ON -DPOCO_UNBUNDLED=ON -DBUILD_SHARED_LIBS=OFF
|
||||
-DENABLE_DATA_MYSQL=ON -DENABLE_PDF=ON -DENABLE_XML=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -186,7 +186,7 @@ jobs:
|
||||
- run: sudo apt -y update && sudo apt -y install libssl-dev
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_TRACE=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -219,7 +219,7 @@ jobs:
|
||||
-DENABLE_PAGECOMPILER=ON -DENABLE_POCODOC=ON -DENABLE_PAGECOMPILER_FILE2PAGE=ON
|
||||
-DENABLE_REDIS=OFF -DENABLE_MONGODB=OFF
|
||||
-DENABLE_DATA=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_DATA_MYSQL=OFF
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -252,7 +252,7 @@ jobs:
|
||||
-DENABLE_PAGECOMPILER=ON -DENABLE_POCODOC=ON -DENABLE_PAGECOMPILER_FILE2PAGE=ON
|
||||
-DENABLE_REDIS=OFF -DENABLE_MONGODB=OFF
|
||||
-DENABLE_DATA=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_DATA_MYSQL=OFF
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -279,7 +279,7 @@ jobs:
|
||||
-DENABLE_PAGECOMPILER=ON -DENABLE_POCODOC=ON -DENABLE_PAGECOMPILER_FILE2PAGE=ON
|
||||
-DENABLE_REDIS=OFF -DENABLE_MONGODB=OFF
|
||||
-DENABLE_DATA=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_DATA_MYSQL=OFF
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -314,7 +314,7 @@ jobs:
|
||||
-DENABLE_PAGECOMPILER=ON -DENABLE_POCODOC=ON -DENABLE_PAGECOMPILER_FILE2PAGE=ON
|
||||
-DENABLE_REDIS=OFF -DENABLE_MONGODB=OFF
|
||||
-DENABLE_DATA=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_DATA_MYSQL=OFF
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -346,7 +346,7 @@ jobs:
|
||||
- run: >-
|
||||
emcmake cmake -H. -B cmake-build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DENABLE_ACTIVERECORD_COMPILER=OFF
|
||||
-DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=off
|
||||
- run: emmake cmake --build cmake-build --target all -j6
|
||||
- run: emmake cmake --build cmake-build --target all --parallel 4
|
||||
# TODO: How to run unit tests in emscripten?
|
||||
# - uses: ./.github/actions/retry-action
|
||||
# with:
|
||||
@@ -696,7 +696,7 @@ jobs:
|
||||
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev mysql-client
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_DATA_MYSQL=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -723,7 +723,7 @@ jobs:
|
||||
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev libmysqlclient-dev odbc-postgresql
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_DATA_POSTGRESQL=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -746,7 +746,7 @@ jobs:
|
||||
sudo apt-get -y install redis
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_REDIS=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -765,7 +765,7 @@ jobs:
|
||||
- run: sudo apt -y update && sudo apt -y install libssl-dev
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_MONGODB=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
@@ -817,6 +817,17 @@ jobs:
|
||||
# wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.2/mysql-connector-odbc_8.2.0-1ubuntu22.04_amd64.deb
|
||||
# wget https://dev.mysql.com/get/Downloads/MySQL-8.2/mysql-community-client-plugins_8.2.0-1ubuntu22.04_amd64.deb
|
||||
# sudo dpkg -i mysql-community-client-plugins_8.2.0-1ubuntu22.04_amd64.deb mysql-connector-odbc_8.2.0-1ubuntu22.04_amd64.deb
|
||||
|
||||
- name: Free disk space
|
||||
run: |
|
||||
sudo df
|
||||
sudo apt autopurge
|
||||
sudo apt clean
|
||||
sudo du -s /usr/local/lib/*
|
||||
sudo du -s /opt/*
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo docker system prune -a --force
|
||||
sudo df
|
||||
- name: Setup Oracle ODBC connector
|
||||
run: |
|
||||
wget https://www.devart.com/odbc/oracle/devartodbcoracle_amd64.deb
|
||||
@@ -833,7 +844,7 @@ jobs:
|
||||
- run: ls -l /etc/apt/sources.list.d/
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_DATA_ODBC=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
timeout_minutes: 90
|
||||
@@ -853,7 +864,7 @@ jobs:
|
||||
- run: >-
|
||||
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_DATA_SQLITE=ON
|
||||
-DPOCO_DATA_NO_SQL_PARSER=ON -DENABLE_TESTS=ON
|
||||
- run: cmake --build cmake-build --target all
|
||||
- run: cmake --build cmake-build --target all --parallel 4
|
||||
|
||||
- uses: ./.github/actions/retry-action
|
||||
with:
|
||||
|
||||
@@ -164,7 +164,7 @@ void ApacheConnector::log(const char* file, int line, int level, int status, con
|
||||
// ap_log_error() has undergone significant changes in Apache 2.4.
|
||||
// Validate Apache version for using a proper ap_log_error() version.
|
||||
#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER < 4
|
||||
ap_log_error(file, line, level, 0, NULL, "%s", text);
|
||||
ap_log_error(file, line, level, 0, nullptr, "%s", text);
|
||||
#else
|
||||
ap_log_error(file, line, level, 0, 0, 0, text);
|
||||
#endif
|
||||
@@ -245,7 +245,7 @@ extern "C" int ApacheConnector_handler(request_rec *r)
|
||||
|
||||
extern "C" void ApacheConnector_register_hooks(apr_pool_t *p)
|
||||
{
|
||||
ap_hook_handler(ApacheConnector_handler, NULL, NULL, APR_HOOK_MIDDLE);
|
||||
ap_hook_handler(ApacheConnector_handler, nullptr, nullptr, APR_HOOK_MIDDLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,26 +290,26 @@ extern "C" const command_rec ApacheConnector_cmds[] =
|
||||
AP_INIT_RAW_ARGS(
|
||||
"AddPocoRequestHandler",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_uris),
|
||||
NULL,
|
||||
nullptr,
|
||||
RSRC_CONF,
|
||||
"POCO RequestHandlerFactory class name followed by shared library path followed by a list of ' ' separated URIs that must be handled by this module."),
|
||||
AP_INIT_RAW_ARGS(
|
||||
"AddPocoConfig",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_config),
|
||||
NULL,
|
||||
nullptr,
|
||||
RSRC_CONF,
|
||||
"Path of the POCO configuration file."),
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
||||
module AP_MODULE_DECLARE_DATA poco_module =
|
||||
{
|
||||
STANDARD20_MODULE_STUFF,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ApacheConnector_cmds,
|
||||
ApacheConnector_register_hooks
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
NameSpace();
|
||||
/// Creates the NameSpace.
|
||||
|
||||
NameSpace(const std::string& name, NameSpace* pNameSpace = 0);
|
||||
NameSpace(const std::string& name, NameSpace* pNameSpace = nullptr);
|
||||
/// Creates the NameSpace.
|
||||
|
||||
~NameSpace();
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
/// Creates the Symbol and assigns the symbol
|
||||
/// a unique ID.
|
||||
|
||||
Symbol(const std::string& name, NameSpace* pNameSpace = 0);
|
||||
Symbol(const std::string& name, NameSpace* pNameSpace = nullptr);
|
||||
/// Creates the Symbol and assigns the symbol
|
||||
/// a unique ID.
|
||||
|
||||
|
||||
@@ -670,13 +670,13 @@ void NumberLiteralToken::finishSuffix(std::istream& istr, int next)
|
||||
|
||||
int NumberLiteralToken::asInteger() const
|
||||
{
|
||||
return static_cast<int>(std::strtol(_value.c_str(), 0, 0));
|
||||
return static_cast<int>(std::strtol(_value.c_str(), nullptr, 0));
|
||||
}
|
||||
|
||||
|
||||
double NumberLiteralToken::asFloat() const
|
||||
{
|
||||
return std::strtod(_value.c_str(), 0);
|
||||
return std::strtod(_value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ bool Function::isVirtual() const
|
||||
Struct* pClass = dynamic_cast<Struct*>(nameSpace());
|
||||
return pClass && pClass->hasVirtualDestructor();
|
||||
}
|
||||
else return getOverridden() != 0;
|
||||
else return getOverridden() != nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ Function* Function::getOverridden() const
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ Symbol* NameSpace::lookup(const std::string& name) const
|
||||
|
||||
Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& alreadyVisited) const
|
||||
{
|
||||
Symbol* pSymbol = 0;
|
||||
Symbol* pSymbol = nullptr;
|
||||
|
||||
if (name.empty())
|
||||
return pSymbol;
|
||||
@@ -125,7 +125,7 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
|
||||
if (pNS)
|
||||
pSymbol = static_cast<NameSpace*>(pSymbol)->lookup(tail, alreadyVisited);
|
||||
else
|
||||
pSymbol = 0;
|
||||
pSymbol = nullptr;
|
||||
}
|
||||
}
|
||||
else if (tail.empty())
|
||||
|
||||
@@ -29,7 +29,7 @@ int Parameter::_count(0);
|
||||
|
||||
|
||||
Parameter::Parameter(const std::string& decl, Function* /*pFunction*/):
|
||||
Decl(handleDecl(decl), 0), // handle init values
|
||||
Decl(handleDecl(decl), nullptr), // handle init values
|
||||
_type(),
|
||||
_isRef(false),
|
||||
_isPointer(false),
|
||||
|
||||
@@ -52,7 +52,7 @@ Parser::Parser(NameSpace::SymbolTable& gst, const std::string& file, std::istrea
|
||||
_tokenizer(_istr),
|
||||
_file(file),
|
||||
_inFile(false),
|
||||
_pCurrentSymbol(0),
|
||||
_pCurrentSymbol(nullptr),
|
||||
_access(Symbol::ACC_PUBLIC)
|
||||
{
|
||||
Path p(file);
|
||||
@@ -235,7 +235,7 @@ const Token* Parser::parseNameSpace(const Token* pNext)
|
||||
fullName += name;
|
||||
|
||||
NameSpace* pNS = dynamic_cast<NameSpace*>(currentNameSpace()->lookup(fullName));
|
||||
bool undefined = (pNS == 0);
|
||||
bool undefined = (pNS == nullptr);
|
||||
if (undefined) pNS = new NameSpace(name, currentNameSpace());
|
||||
pushNameSpace(pNS, -1, undefined);
|
||||
pNext = next();
|
||||
@@ -287,7 +287,7 @@ const Token* Parser::parseClass(const Token* pNext, std::string& decl)
|
||||
{
|
||||
poco_assert (isKeyword(pNext, IdentifierToken::KW_CLASS) || isKeyword(pNext, IdentifierToken::KW_STRUCT) || isKeyword(pNext, IdentifierToken::KW_UNION));
|
||||
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
bool isClass = isKeyword(pNext, IdentifierToken::KW_CLASS);
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
Symbol::Access prevAccess = _access;
|
||||
@@ -324,7 +324,7 @@ const Token* Parser::parseClass(const Token* pNext, std::string& decl)
|
||||
expectOperator(pNext, OperatorToken::OP_SEMICOLON, ";");
|
||||
pNext = next();
|
||||
_access = prevAccess;
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
if (isOperator(pNext, OperatorToken::OP_COLON) || isOperator(pNext, OperatorToken::OP_OPENBRACE))
|
||||
@@ -346,7 +346,7 @@ const Token* Parser::parseClass(const Token* pNext, std::string& decl)
|
||||
}
|
||||
pNext = next();
|
||||
_access = prevAccess;
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ const Token* Parser::parseTypeDef(const Token* pNext)
|
||||
{
|
||||
poco_assert (isKeyword(pNext, IdentifierToken::KW_TYPEDEF));
|
||||
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
std::string decl;
|
||||
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !isEOF(pNext))
|
||||
@@ -507,7 +507,7 @@ const Token* Parser::parseTypeDef(const Token* pNext)
|
||||
addSymbol(pTypeDef, line);
|
||||
|
||||
pNext = next();
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ const Token* Parser::parseUsing(const Token* pNext)
|
||||
{
|
||||
poco_assert (isKeyword(pNext, IdentifierToken::KW_USING));
|
||||
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
pNext = next();
|
||||
if (isKeyword(pNext, IdentifierToken::KW_NAMESPACE))
|
||||
@@ -560,7 +560,7 @@ const Token* Parser::parseUsing(const Token* pNext)
|
||||
if (!isOperator(pNext, OperatorToken::OP_SEMICOLON))
|
||||
syntaxError("semicolon");
|
||||
pNext = next();
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ const Token* Parser::parseVarFunc(const Token* pNext)
|
||||
|
||||
const Token* Parser::parseVarFunc(const Token* pNext, std::string& decl)
|
||||
{
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
std::string attrs;
|
||||
if (isOperator(pNext, OperatorToken::OP_DBL_OPENBRACKET))
|
||||
{
|
||||
@@ -642,7 +642,7 @@ const Token* Parser::parseVarFunc(const Token* pNext, std::string& decl)
|
||||
pNext = parseFunc(pNext, attrs, decl);
|
||||
}
|
||||
}
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
|
||||
@@ -674,7 +674,7 @@ const Token* Parser::parseFunc(const Token* pNext, const std::string& attrs, std
|
||||
poco_assert (isOperator(pNext, OperatorToken::OP_OPENPARENT));
|
||||
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
Function* pFunc = 0;
|
||||
Function* pFunc = nullptr;
|
||||
std::string name = Symbol::extractName(decl);
|
||||
if (name.find(':') == std::string::npos)
|
||||
{
|
||||
@@ -836,7 +836,7 @@ const Token* Parser::parseEnum(const Token* pNext)
|
||||
|
||||
std::string baseType;
|
||||
int flags = 0;
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
pNext = next();
|
||||
|
||||
@@ -883,14 +883,14 @@ const Token* Parser::parseEnum(const Token* pNext)
|
||||
pNext = next();
|
||||
expectOperator(pNext, OperatorToken::OP_SEMICOLON, ";");
|
||||
pNext = next();
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
return pNext;
|
||||
}
|
||||
|
||||
|
||||
const Token* Parser::parseEnumValue(const Token* pNext, Enum* pEnum)
|
||||
{
|
||||
_pCurrentSymbol = 0;
|
||||
_pCurrentSymbol = nullptr;
|
||||
_doc.clear();
|
||||
int line = static_cast<int>(_istr.getCurrentLineNumber());
|
||||
std::string name = pNext->tokenString();
|
||||
|
||||
@@ -58,7 +58,7 @@ void Struct::addBase(const std::string& name, Symbol::Access access, bool isVirt
|
||||
base.name = name;
|
||||
base.access = access;
|
||||
base.isVirtual = isVirtual;
|
||||
base.pClass = 0;
|
||||
base.pClass = nullptr;
|
||||
_bases.push_back(base);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ Function* Struct::destructor() const
|
||||
if (pFunc && pFunc->isDestructor())
|
||||
return pFunc;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ Function* Struct::findFunction(const std::string& signature) const
|
||||
if (pFunc) return pFunc;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ int Symbol::_nextId = 0;
|
||||
|
||||
Symbol::Symbol():
|
||||
_id(_nextId++),
|
||||
_pNameSpace(0),
|
||||
_pNameSpace(nullptr),
|
||||
_access(ACC_PUBLIC),
|
||||
_line(-1),
|
||||
_order(0)
|
||||
|
||||
@@ -119,7 +119,7 @@ inline std::string& getError(std::string& msg)
|
||||
while ((err = ERR_get_error()))
|
||||
{
|
||||
if (!msg.empty()) msg.append(1, '\n');
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
/// If a private key is specified, you don't need to specify a public key file.
|
||||
/// OpenSSL will auto-create the public key from the private key.
|
||||
|
||||
ECKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream = 0, const std::string& privateKeyPassphrase = "");
|
||||
ECKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream = nullptr, const std::string& privateKeyPassphrase = "");
|
||||
/// Creates the ECKey, by reading public and private key from the given streams and
|
||||
/// using the given passphrase for the private key.
|
||||
///
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
std::ostream* pPrivateKeyStream = nullptr,
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyStream = 0, const std::string& privateKeyPassphrase = "") const;
|
||||
void save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyStream = nullptr, const std::string& privateKeyPassphrase = "") const;
|
||||
/// Exports the public and/or private key to the given streams.
|
||||
///
|
||||
/// If a null pointer is passed for a stream, the corresponding
|
||||
@@ -218,7 +218,7 @@ private:
|
||||
poco_check_ptr (ppKey);
|
||||
poco_assert_dbg (!*ppKey);
|
||||
|
||||
FILE* pFile = 0;
|
||||
FILE* pFile = nullptr;
|
||||
if (!keyFile.empty())
|
||||
{
|
||||
if (!getFunc) *ppKey = (K*)EVP_PKEY_new();
|
||||
@@ -236,11 +236,11 @@ private:
|
||||
|
||||
if (pFile)
|
||||
{
|
||||
pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)0 : &passCB;
|
||||
void* pPassword = pass.empty() ? (void*)0 : (void*)pass.c_str();
|
||||
pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)nullptr : &passCB;
|
||||
void* pPassword = pass.empty() ? (void*)nullptr : (void*)pass.c_str();
|
||||
if (readFunc(pFile, &pKey, pCB, pPassword))
|
||||
{
|
||||
fclose(pFile); pFile = 0;
|
||||
fclose(pFile); pFile = nullptr;
|
||||
if(getFunc)
|
||||
{
|
||||
*ppKey = (K*)getFunc(pKey);
|
||||
@@ -288,7 +288,7 @@ private:
|
||||
poco_check_ptr(ppKey);
|
||||
poco_assert_dbg(!*ppKey);
|
||||
|
||||
BIO* pBIO = 0;
|
||||
BIO* pBIO = nullptr;
|
||||
if (pIstr)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
@@ -301,11 +301,11 @@ private:
|
||||
EVP_PKEY* pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY*)*ppKey;
|
||||
if (pKey)
|
||||
{
|
||||
pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)0 : &passCB;
|
||||
void* pPassword = pass.empty() ? (void*)0 : (void*)pass.c_str();
|
||||
pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)nullptr : &passCB;
|
||||
void* pPassword = pass.empty() ? (void*)nullptr : (void*)pass.c_str();
|
||||
if (readFunc(pBIO, &pKey, pCB, pPassword))
|
||||
{
|
||||
BIO_free(pBIO); pBIO = 0;
|
||||
BIO_free(pBIO); pBIO = nullptr;
|
||||
if (getFunc)
|
||||
{
|
||||
*ppKey = (K*)getFunc(pKey);
|
||||
@@ -335,7 +335,7 @@ private:
|
||||
throw OpenSSLException(msg);
|
||||
}
|
||||
|
||||
EVP_PKEY* _pEVPPKey = 0;
|
||||
EVP_PKEY* _pEVPPKey = nullptr;
|
||||
static const std::map<int, std::string> KNOWN_TYPES;
|
||||
|
||||
friend class ECKeyImpl;
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
KT_EC = KeyPairImpl::KT_EC_IMPL
|
||||
};
|
||||
|
||||
explicit KeyPair(KeyPairImpl::Ptr pKeyPairImpl = 0);
|
||||
explicit KeyPair(KeyPairImpl::Ptr pKeyPairImpl = nullptr);
|
||||
/// Extracts the RSA public key from the given certificate.
|
||||
|
||||
KeyPair(const KeyPair& other);
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
/// is not exported.
|
||||
|
||||
virtual void save(std::ostream* pPublicKeyPairStream,
|
||||
std::ostream* pPrivateKeyPairStream = 0,
|
||||
std::ostream* pPrivateKeyPairStream = nullptr,
|
||||
const std::string& privateKeyPairPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
/// is not exported.
|
||||
|
||||
virtual void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
std::ostream* pPrivateKeyStream = nullptr,
|
||||
const std::string& privateKeyPassphrase = "") const = 0;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
|
||||
inline bool PKCS12Container::hasX509Certificate() const
|
||||
{
|
||||
return _pX509Cert.get() != 0;
|
||||
return _pX509Cert.get() != nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ inline const PKCS12Container::CANameList& PKCS12Container::getFriendlyNamesCA()
|
||||
|
||||
inline bool PKCS12Container::hasKey() const
|
||||
{
|
||||
return _pKey != 0;
|
||||
return _pKey != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
std::ostream* pPrivateKeyStream = nullptr,
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace Crypto {
|
||||
CipherFactory::CipherFactory()
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER_load(NULL, "default");
|
||||
OSSL_PROVIDER_load(NULL, "legacy");
|
||||
OSSL_PROVIDER_load(nullptr, "default");
|
||||
OSSL_PROVIDER_load(nullptr, "legacy");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace
|
||||
{
|
||||
if (!msg.empty())
|
||||
msg.append("; ");
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
|
||||
throw Poco::IOException(msg);
|
||||
@@ -103,7 +103,7 @@ namespace
|
||||
_pContext,
|
||||
_pCipher,
|
||||
&_key[0],
|
||||
_iv.empty() ? 0 : &_iv[0],
|
||||
_iv.empty() ? nullptr : &_iv[0],
|
||||
(dir == DIR_ENCRYPT) ? 1 : 0);
|
||||
#else
|
||||
int rc = EVP_CipherInit(
|
||||
@@ -119,9 +119,9 @@ namespace
|
||||
if (_iv.size() != EVP_CIPHER_iv_length(_pCipher) && EVP_CIPHER_mode(_pCipher) == EVP_CIPH_GCM_MODE)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), NULL);
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), nullptr);
|
||||
#else
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), NULL);
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), nullptr);
|
||||
#endif
|
||||
if (rc == 0) throwError();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace
|
||||
{
|
||||
if (!msg.empty())
|
||||
msg.append("; ");
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
|
||||
throw Poco::IOException(msg);
|
||||
@@ -49,8 +49,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
const std::string& salt,
|
||||
int iterationCount,
|
||||
const std::string& digest):
|
||||
_pCipher(0),
|
||||
_pDigest(0),
|
||||
_pCipher(nullptr),
|
||||
_pDigest(nullptr),
|
||||
_name(name),
|
||||
_key(),
|
||||
_iv()
|
||||
@@ -76,8 +76,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv):
|
||||
_pCipher(0),
|
||||
_pDigest(0),
|
||||
_pCipher(nullptr),
|
||||
_pDigest(nullptr),
|
||||
_name(name),
|
||||
_key(key),
|
||||
_iv(iv)
|
||||
@@ -92,8 +92,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name):
|
||||
_pCipher(0),
|
||||
_pDigest(0),
|
||||
_pCipher(nullptr),
|
||||
_pDigest(nullptr),
|
||||
_name(name),
|
||||
_key(),
|
||||
_iv()
|
||||
@@ -198,7 +198,7 @@ void CipherKeyImpl::generateKey(
|
||||
int keySize = EVP_BytesToKey(
|
||||
_pCipher,
|
||||
_pDigest ? _pDigest : EVP_md5(),
|
||||
(salt.empty() ? 0 : saltBytes),
|
||||
(salt.empty() ? nullptr : saltBytes),
|
||||
reinterpret_cast<const unsigned char*>(password.data()),
|
||||
static_cast<int>(password.size()),
|
||||
iterationCount,
|
||||
|
||||
@@ -36,7 +36,7 @@ CryptoStreamBuf::CryptoStreamBuf(std::istream& istr, CryptoTransform::Ptr pTrans
|
||||
Poco::BufferedStreamBuf(bufferSize, std::ios::in),
|
||||
_pTransform(pTransform),
|
||||
_pIstr(&istr),
|
||||
_pOstr(0),
|
||||
_pOstr(nullptr),
|
||||
_eof(false),
|
||||
_buffer(static_cast<std::size_t>(bufferSize))
|
||||
{
|
||||
@@ -48,7 +48,7 @@ CryptoStreamBuf::CryptoStreamBuf(std::istream& istr, CryptoTransform::Ptr pTrans
|
||||
CryptoStreamBuf::CryptoStreamBuf(std::ostream& ostr, CryptoTransform::Ptr pTransform, std::streamsize bufferSize):
|
||||
Poco::BufferedStreamBuf(bufferSize, std::ios::out),
|
||||
_pTransform(pTransform),
|
||||
_pIstr(0),
|
||||
_pIstr(nullptr),
|
||||
_pOstr(&ostr),
|
||||
_eof(false),
|
||||
_buffer(static_cast<std::size_t>(bufferSize))
|
||||
@@ -76,7 +76,7 @@ void CryptoStreamBuf::close()
|
||||
|
||||
if (_pIstr)
|
||||
{
|
||||
_pIstr = 0;
|
||||
_pIstr = nullptr;
|
||||
}
|
||||
else if (_pOstr)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ void CryptoStreamBuf::close()
|
||||
// sure that we call finalize() only once, even if an exception is
|
||||
// thrown.
|
||||
std::ostream* pOstr = _pOstr;
|
||||
_pOstr = 0;
|
||||
_pOstr = nullptr;
|
||||
|
||||
// Finalize transformation.
|
||||
std::streamsize n = _pTransform->finalize(_buffer.begin(), static_cast<std::streamsize>(_buffer.size()));
|
||||
|
||||
@@ -26,7 +26,7 @@ DigestEngine::DigestEngine(const std::string& name):
|
||||
{
|
||||
const EVP_MD* md = EVP_get_digestbyname(_name.c_str());
|
||||
if (!md) throw Poco::NotFoundException(_name);
|
||||
EVP_DigestInit_ex(_pContext, md, NULL);
|
||||
EVP_DigestInit_ex(_pContext, md, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void DigestEngine::reset()
|
||||
#endif
|
||||
const EVP_MD* md = EVP_get_digestbyname(_name.c_str());
|
||||
if (!md) throw Poco::NotFoundException(_name);
|
||||
EVP_DigestInit_ex(_pContext, md, NULL);
|
||||
EVP_DigestInit_ex(_pContext, md, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ ECDSASignature::ECDSASignature(const ByteVec& derSignature)
|
||||
poco_assert (!derSignature.empty());
|
||||
|
||||
const unsigned char* p = &derSignature[0];
|
||||
_pSig = d2i_ECDSA_SIG(0, &p, static_cast<long>(derSignature.size()));
|
||||
_pSig = d2i_ECDSA_SIG(nullptr, &p, static_cast<long>(derSignature.size()));
|
||||
if (!_pSig)
|
||||
throw OpenSSLException();
|
||||
}
|
||||
@@ -131,12 +131,12 @@ ECDSASignature::ECDSASignature(const ByteVec& rawR, const ByteVec& rawS):
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
ECDSA_SIG_set0(_pSig,
|
||||
BN_bin2bn(&rawR[0], static_cast<long>(rawR.size()), 0),
|
||||
BN_bin2bn(&rawS[0], static_cast<long>(rawS.size()), 0));
|
||||
const BIGNUM* pR = 0;
|
||||
const BIGNUM* pS = 0;
|
||||
BN_bin2bn(&rawR[0], static_cast<long>(rawR.size()), nullptr),
|
||||
BN_bin2bn(&rawS[0], static_cast<long>(rawS.size()), nullptr));
|
||||
const BIGNUM* pR = nullptr;
|
||||
const BIGNUM* pS = nullptr;
|
||||
ECDSA_SIG_get0(_pSig, &pR, &pS);
|
||||
if (pR == 0 || pS == 0)
|
||||
if (pR == nullptr || pS == nullptr)
|
||||
throw Poco::Crypto::CryptoException("failed to decode R and S values");
|
||||
#else
|
||||
if (!BN_bin2bn(&rawR[0], rawR.size(), _pSig->r))
|
||||
@@ -161,7 +161,7 @@ ECDSASignature::~ECDSASignature()
|
||||
|
||||
ECDSASignature::ByteVec ECDSASignature::toDER() const
|
||||
{
|
||||
int size = i2d_ECDSA_SIG(_pSig, 0);
|
||||
int size = i2d_ECDSA_SIG(_pSig, nullptr);
|
||||
if (size > 0)
|
||||
{
|
||||
ByteVec buffer(size);
|
||||
|
||||
@@ -38,7 +38,7 @@ ECKeyImpl::ECKeyImpl(const EVPPKey& key):
|
||||
|
||||
ECKeyImpl::ECKeyImpl(const X509Certificate& cert):
|
||||
KeyPairImpl("ec", KT_EC_IMPL),
|
||||
_pEC(0)
|
||||
_pEC(nullptr)
|
||||
{
|
||||
const X509* pCert = cert.certificate();
|
||||
if (pCert)
|
||||
@@ -78,7 +78,7 @@ ECKeyImpl::ECKeyImpl(int curve):
|
||||
|
||||
ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(0)
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(nullptr)
|
||||
{
|
||||
if (EVPPKey::loadKey(&_pEC, PEM_read_PrivateKey, EVP_PKEY_get1_EC_KEY, privateKeyFile, privateKeyPassphrase))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
|
||||
|
||||
ECKeyImpl::ECKeyImpl(std::istream* pPublicKeyStream,
|
||||
std::istream* pPrivateKeyStream,
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(0)
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(nullptr)
|
||||
{
|
||||
if (EVPPKey::loadKey(&_pEC, PEM_read_bio_PrivateKey, EVP_PKEY_get1_EC_KEY, pPrivateKeyStream, privateKeyPassphrase))
|
||||
{
|
||||
@@ -141,7 +141,7 @@ void ECKeyImpl::freeEC()
|
||||
if (_pEC)
|
||||
{
|
||||
EC_KEY_free(_pEC);
|
||||
_pEC = 0;
|
||||
_pEC = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ int ECKeyImpl::groupId() const
|
||||
std::string ECKeyImpl::getCurveName(int nid)
|
||||
{
|
||||
std::string curveName;
|
||||
size_t len = EC_get_builtin_curves(NULL, 0);
|
||||
size_t len = EC_get_builtin_curves(nullptr, 0);
|
||||
EC_builtin_curve* pCurves =
|
||||
(EC_builtin_curve*) OPENSSL_malloc(sizeof(EC_builtin_curve) * len);
|
||||
if (!pCurves) return curveName;
|
||||
@@ -206,7 +206,7 @@ std::string ECKeyImpl::getCurveName(int nid)
|
||||
int ECKeyImpl::getCurveNID(std::string& name)
|
||||
{
|
||||
std::string curveName;
|
||||
size_t len = EC_get_builtin_curves(NULL, 0);
|
||||
size_t len = EC_get_builtin_curves(nullptr, 0);
|
||||
EC_builtin_curve* pCurves =
|
||||
(EC_builtin_curve*)OPENSSL_malloc(static_cast<int>(sizeof(EC_builtin_curve) * len));
|
||||
if (!pCurves) return -1;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace
|
||||
while ((err = ERR_get_error()))
|
||||
{
|
||||
if (!msg.empty()) msg.append("; ");
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
|
||||
throw Poco::IOException(msg);
|
||||
@@ -43,7 +43,7 @@ namespace
|
||||
{
|
||||
public:
|
||||
EVPPKeyContext() = delete;
|
||||
EVPPKeyContext(const EVP_PKEY* pEVP) : _pCtx(EVP_PKEY_CTX_new(const_cast<EVP_PKEY*>(pEVP), NULL))
|
||||
EVPPKeyContext(const EVP_PKEY* pEVP) : _pCtx(EVP_PKEY_CTX_new(const_cast<EVP_PKEY*>(pEVP), nullptr))
|
||||
{
|
||||
if (!_pCtx)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace
|
||||
_pEVP(pEVP),
|
||||
_pCtx(_pEVP),
|
||||
_pos(0),
|
||||
_pBuf(0)
|
||||
_pBuf(nullptr)
|
||||
{
|
||||
std::string fmt = "EVPEncryptImpl():%s()";
|
||||
poco_check_ptr(_pEVP);
|
||||
@@ -126,7 +126,7 @@ namespace
|
||||
{
|
||||
poco_assert (outputLength >= evpSize);
|
||||
std::size_t outLen;
|
||||
if (EVP_PKEY_encrypt(_pCtx, NULL, &outLen, _pBuf, static_cast<std::size_t>(maxSize)) <= 0)
|
||||
if (EVP_PKEY_encrypt(_pCtx, nullptr, &outLen, _pBuf, static_cast<std::size_t>(maxSize)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_encrypt(NULL)")));
|
||||
if (EVP_PKEY_encrypt(_pCtx, output, &outLen, _pBuf, static_cast<std::size_t>(maxSize)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_encrypt")));
|
||||
@@ -156,7 +156,7 @@ namespace
|
||||
std::size_t outLen = 0;
|
||||
if (_pos > 0)
|
||||
{
|
||||
if (EVP_PKEY_encrypt(_pCtx, NULL, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
if (EVP_PKEY_encrypt(_pCtx, nullptr, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_encrypt")));
|
||||
if (EVP_PKEY_encrypt(_pCtx, output, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_encrypt")));
|
||||
@@ -169,7 +169,7 @@ namespace
|
||||
{
|
||||
std::string fmt = "EVPEncryptImpl::maxDataSize():%s()";
|
||||
std::size_t outLength = 0;
|
||||
if (EVP_PKEY_encrypt(_pCtx, NULL, &outLength, pIO, length) <= 0)
|
||||
if (EVP_PKEY_encrypt(_pCtx, nullptr, &outLength, pIO, length) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_encrypt")));
|
||||
return outLength;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace
|
||||
_pEVP(pEVP),
|
||||
_pCtx(_pEVP),
|
||||
_pos(0),
|
||||
_pBuf(0)
|
||||
_pBuf(nullptr)
|
||||
{
|
||||
std::string fmt = "EVPDecryptImpl():%s()";
|
||||
poco_check_ptr(_pEVP);
|
||||
@@ -237,7 +237,7 @@ namespace
|
||||
if (missing == 0)
|
||||
{
|
||||
std::size_t outLen = 0;
|
||||
if (EVP_PKEY_decrypt(_pCtx, NULL, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
if (EVP_PKEY_decrypt(_pCtx, nullptr, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_decrypt(NULL)")));
|
||||
if (EVP_PKEY_decrypt(_pCtx, output, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_decrypt")));
|
||||
@@ -263,7 +263,7 @@ namespace
|
||||
poco_assert (length >= _blockSize);
|
||||
std::string fmt = "EVPDecryptImpl::finalize():%s()";
|
||||
std::size_t outLen = 0;
|
||||
if (EVP_PKEY_decrypt(_pCtx, NULL, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
if (EVP_PKEY_decrypt(_pCtx, nullptr, &outLen, _pBuf, static_cast<std::size_t>(_pos)) <= 0)
|
||||
throwError(Poco::format(fmt, std::string("EVP_PKEY_decrypt(NULL)")));
|
||||
poco_assert (length >= outLen);
|
||||
if (_pos > 0)
|
||||
|
||||
@@ -39,7 +39,7 @@ const std::map<int, std::string> EVPPKey::KNOWN_TYPES =
|
||||
};
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(const std::string& ecCurveName): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(const std::string& ecCurveName) : _pEVPPKey(nullptr)
|
||||
{
|
||||
newECKey(ecCurveName.c_str());
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
@@ -47,7 +47,7 @@ EVPPKey::EVPPKey(const std::string& ecCurveName): _pEVPPKey(0)
|
||||
}
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(const char* ecCurveName): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(const char* ecCurveName) : _pEVPPKey(nullptr)
|
||||
{
|
||||
newECKey(ecCurveName);
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
@@ -55,8 +55,7 @@ EVPPKey::EVPPKey(const char* ecCurveName): _pEVPPKey(0)
|
||||
}
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(const X509Certificate& cert):
|
||||
_pEVPPKey(X509_get_pubkey(const_cast<X509*>(cert.certificate())))
|
||||
EVPPKey::EVPPKey(const X509Certificate& cert): _pEVPPKey(X509_get_pubkey(const_cast<X509*>(cert.certificate())))
|
||||
{
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
checkType();
|
||||
@@ -138,7 +137,7 @@ void EVPPKey::setKeyFromParameters(OSSL_PARAM* parameters)
|
||||
throw OpenSSLException("EVPPKey cannot init create key");
|
||||
}
|
||||
|
||||
if (_pEVPPKey != 0) EVP_PKEY_free(_pEVPPKey);
|
||||
if (_pEVPPKey != nullptr) EVP_PKEY_free(_pEVPPKey);
|
||||
if (EVP_PKEY_fromdata(ctx, &_pEVPPKey, EVP_PKEY_KEYPAIR, parameters) <= 0)
|
||||
{
|
||||
OSSL_PARAM_free(parameters);
|
||||
@@ -150,7 +149,7 @@ void EVPPKey::setKeyFromParameters(OSSL_PARAM* parameters)
|
||||
}
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(const std::vector<unsigned char>* public_key, const std::vector<unsigned char>* private_key, unsigned long exponent, int type) : _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(const std::vector<unsigned char>* public_key, const std::vector<unsigned char>* private_key, unsigned long exponent, int type) : _pEVPPKey(nullptr)
|
||||
{
|
||||
if ((EVP_PKEY_RSA != type) || (RSA_F4 != exponent))
|
||||
{
|
||||
@@ -175,10 +174,10 @@ EVPPKey::EVPPKey(const std::vector<unsigned char>* public_key, const std::vector
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||
|
||||
EVPPKey::EVPPKey(int type, int param): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(int type, int param) : _pEVPPKey(nullptr)
|
||||
{
|
||||
EVP_PKEY_CTX *pCtx = EVP_PKEY_CTX_new_id(type, NULL);
|
||||
if (NULL == pCtx)
|
||||
EVP_PKEY_CTX* pCtx = EVP_PKEY_CTX_new_id(type, nullptr);
|
||||
if (nullptr == pCtx)
|
||||
{
|
||||
std::string msg = Poco::format(
|
||||
"EVPPKey(%d, %d):EVP_PKEY_CTX_new_id()\n", type, param);
|
||||
@@ -236,7 +235,7 @@ EVPPKey::EVPPKey(int type, int param): _pEVPPKey(0)
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(EVP_PKEY* pEVPPKey): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(EVP_PKEY* pEVPPKey) : _pEVPPKey(nullptr)
|
||||
{
|
||||
duplicate(pEVPPKey, &_pEVPPKey);
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
@@ -244,19 +243,16 @@ EVPPKey::EVPPKey(EVP_PKEY* pEVPPKey): _pEVPPKey(0)
|
||||
}
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase) : _pEVPPKey(nullptr)
|
||||
{
|
||||
if (loadKey(&_pEVPPKey, PEM_read_PrivateKey, (EVP_PKEY_get_Key_fn)0, privateKeyFile, privateKeyPassphrase))
|
||||
if (loadKey(&_pEVPPKey, PEM_read_PrivateKey, (EVP_PKEY_get_Key_fn) nullptr, privateKeyFile, privateKeyPassphrase))
|
||||
{
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
return; // private key is enough
|
||||
}
|
||||
|
||||
// no private key, this must be public key only, otherwise throw
|
||||
if (!loadKey(&_pEVPPKey, PEM_read_PUBKEY, (EVP_PKEY_get_Key_fn)0, publicKeyFile))
|
||||
{
|
||||
if (!loadKey(&_pEVPPKey, PEM_read_PUBKEY, (EVP_PKEY_get_Key_fn) nullptr, publicKeyFile)) {
|
||||
std::string msg = "EVPPKey(const string&, const string&, const string&)\n";
|
||||
throw OpenSSLException(getError(msg));
|
||||
}
|
||||
@@ -265,19 +261,16 @@ EVPPKey::EVPPKey(const std::string& publicKeyFile,
|
||||
}
|
||||
|
||||
|
||||
EVPPKey::EVPPKey(std::istream* pPublicKeyStream,
|
||||
std::istream* pPrivateKeyStream,
|
||||
const std::string& privateKeyPassphrase): _pEVPPKey(0)
|
||||
EVPPKey::EVPPKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase) : _pEVPPKey(nullptr)
|
||||
{
|
||||
if (loadKey(&_pEVPPKey, PEM_read_bio_PrivateKey, (EVP_PKEY_get_Key_fn)0, pPrivateKeyStream, privateKeyPassphrase))
|
||||
if (loadKey(&_pEVPPKey, PEM_read_bio_PrivateKey, (EVP_PKEY_get_Key_fn) nullptr, pPrivateKeyStream, privateKeyPassphrase))
|
||||
{
|
||||
poco_check_ptr(_pEVPPKey);
|
||||
return; // private key is enough
|
||||
}
|
||||
|
||||
// no private key, this must be public key only, otherwise throw
|
||||
if (!loadKey(&_pEVPPKey, PEM_read_bio_PUBKEY, (EVP_PKEY_get_Key_fn)0, pPublicKeyStream))
|
||||
{
|
||||
if (!loadKey(&_pEVPPKey, PEM_read_bio_PUBKEY, (EVP_PKEY_get_Key_fn) nullptr, pPublicKeyStream)) {
|
||||
std::string msg = "EVPPKey(istream* ,istream* const string&)\n";
|
||||
throw OpenSSLException(getError(msg));
|
||||
}
|
||||
@@ -416,13 +409,13 @@ void EVPPKey::save(const std::string& publicKeyFile, const std::string& privateK
|
||||
int rc = 0;
|
||||
if (privateKeyPassphrase.empty())
|
||||
{
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, 0, 0, 0, 0, 0);
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, nullptr, nullptr, 0, nullptr, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
reinterpret_cast<unsigned char *>( const_cast<char *>( privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), nullptr, nullptr);
|
||||
}
|
||||
if (!rc)
|
||||
{
|
||||
@@ -483,11 +476,11 @@ void EVPPKey::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyStre
|
||||
}
|
||||
int rc = 0;
|
||||
if (privateKeyPassphrase.empty())
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, 0, 0, 0, 0, 0);
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, nullptr, nullptr, 0, nullptr, nullptr);
|
||||
else
|
||||
rc = PEM_write_bio_PrivateKey(bio, _pEVPPKey, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
reinterpret_cast<unsigned char *>( const_cast<char *>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), nullptr, nullptr);
|
||||
if (!rc)
|
||||
{
|
||||
std::string msg = "EVPPKey::save(ostream*, ostream*, const string&)\n";
|
||||
|
||||
@@ -65,7 +65,7 @@ void Envelope::addKey(const EVPPKey& key)
|
||||
|
||||
const Envelope::ByteVec& Envelope::seal(const ByteVec& plainData)
|
||||
{
|
||||
std::vector<Byte*> pEncKeys(_encKeys.size(), 0);
|
||||
std::vector<Byte *> pEncKeys(_encKeys.size(), nullptr);
|
||||
std::vector<int> encKeysSizes(_encKeys.size(), 0);
|
||||
int i = 0;
|
||||
for (const auto& k : _encKeys)
|
||||
@@ -153,7 +153,7 @@ void Envelope::handleErrors(std::string&& msg)
|
||||
while ((err = ERR_get_error()))
|
||||
{
|
||||
if (!msg.empty()) msg.append("\n");
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
throw CryptoException(msg);
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ Poco::FastMutex* OpenSSLInitializer::_mutexes(0);
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER* OpenSSLInitializer::_defaultProvider(0);
|
||||
OSSL_PROVIDER* OpenSSLInitializer::_legacyProvider(0);
|
||||
OSSL_PROVIDER* OpenSSLInitializer::_defaultProvider(nullptr);
|
||||
OSSL_PROVIDER* OpenSSLInitializer::_legacyProvider(nullptr);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ void OpenSSLInitializer::initialize()
|
||||
if (++_rc == 1)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
CONF_modules_load(NULL, NULL, 0);
|
||||
CONF_modules_load(nullptr, nullptr, 0);
|
||||
#else
|
||||
OPENSSL_config(NULL);
|
||||
OPENSSL_config(nullptr);
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
@@ -131,12 +131,12 @@ void OpenSSLInitializer::initialize()
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (!_defaultProvider)
|
||||
{
|
||||
_defaultProvider = OSSL_PROVIDER_load(NULL, "default");
|
||||
_defaultProvider = OSSL_PROVIDER_load(nullptr, "default");
|
||||
if (!_defaultProvider) throw CryptoException("Failed to load OpenSSL default provider");
|
||||
}
|
||||
if (!_legacyProvider)
|
||||
{
|
||||
_legacyProvider = OSSL_PROVIDER_load(NULL, "legacy");
|
||||
_legacyProvider = OSSL_PROVIDER_load(nullptr, "legacy");
|
||||
// Note: use haveLegacyProvider() to check if legacy provider has been loaded
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
|
||||
#include "Poco/Crypto/PKCS12Container.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
#include <openssl/err.h>
|
||||
@@ -29,7 +28,7 @@ namespace Poco {
|
||||
namespace Crypto {
|
||||
|
||||
|
||||
PKCS12Container::PKCS12Container(std::istream& istr, const std::string& password): _pKey(0)
|
||||
PKCS12Container::PKCS12Container(std::istream& istr, const std::string& password) : _pKey(nullptr)
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
Poco::StreamCopier::copyStream(istr, ostr);
|
||||
@@ -38,7 +37,7 @@ PKCS12Container::PKCS12Container(std::istream& istr, const std::string& password
|
||||
BIO *pBIO = BIO_new_mem_buf(const_cast<char*>(cont.data()), static_cast<int>(cont.size()));
|
||||
if (pBIO)
|
||||
{
|
||||
PKCS12* pPKCS12 = 0;
|
||||
PKCS12* pPKCS12 = nullptr;
|
||||
d2i_PKCS12_bio(pBIO, &pPKCS12);
|
||||
BIO_free(pBIO);
|
||||
if (!pPKCS12) throw OpenSSLException("PKCS12Container(istream&, const string&)");
|
||||
@@ -51,12 +50,12 @@ PKCS12Container::PKCS12Container(std::istream& istr, const std::string& password
|
||||
}
|
||||
|
||||
|
||||
PKCS12Container::PKCS12Container(const std::string& path, const std::string& password): _pKey(0)
|
||||
PKCS12Container::PKCS12Container(const std::string& path, const std::string& password) : _pKey(nullptr)
|
||||
{
|
||||
FILE* pFile = fopen(path.c_str(), "rb");
|
||||
if (pFile)
|
||||
{
|
||||
PKCS12* pPKCS12 = d2i_PKCS12_fp(pFile, NULL);
|
||||
PKCS12* pPKCS12 = d2i_PKCS12_fp(pFile, nullptr);
|
||||
fclose (pFile);
|
||||
if (!pPKCS12) throw OpenSSLException("PKCS12Container(const string&, const string&)");
|
||||
load(pPKCS12, password);
|
||||
@@ -145,8 +144,8 @@ void PKCS12Container::load(PKCS12* pPKCS12, const std::string& password)
|
||||
{
|
||||
if (pPKCS12)
|
||||
{
|
||||
X509* pCert = 0;
|
||||
STACK_OF(X509)* pCA = 0;
|
||||
X509* pCert = nullptr;
|
||||
STACK_OF(X509)* pCA = nullptr;
|
||||
if (PKCS12_parse(pPKCS12, password.c_str(), &_pKey, &pCert, &pCA))
|
||||
{
|
||||
if (pCert)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace
|
||||
{
|
||||
if (!msg.empty())
|
||||
msg.append("; ");
|
||||
msg.append(ERR_error_string(err, 0));
|
||||
msg.append(ERR_error_string(err, nullptr));
|
||||
}
|
||||
|
||||
throw Poco::IOException(msg);
|
||||
@@ -90,7 +90,7 @@ namespace
|
||||
_pRSA(pRSA),
|
||||
_paddingMode(paddingMode),
|
||||
_pos(0),
|
||||
_pBuf(0)
|
||||
_pBuf(nullptr)
|
||||
{
|
||||
_pBuf = new unsigned char[blockSize()];
|
||||
}
|
||||
@@ -223,11 +223,11 @@ namespace
|
||||
};
|
||||
|
||||
|
||||
RSADecryptImpl::RSADecryptImpl(const RSA* pRSA, RSAPaddingMode paddingMode):
|
||||
RSADecryptImpl::RSADecryptImpl(const RSA *pRSA, RSAPaddingMode paddingMode) :
|
||||
_pRSA(pRSA),
|
||||
_paddingMode(paddingMode),
|
||||
_pos(0),
|
||||
_pBuf(0)
|
||||
_pBuf(nullptr)
|
||||
{
|
||||
_pBuf = new unsigned char[blockSize()];
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
#include "Poco/Crypto/RSAKeyImpl.h"
|
||||
#include "Poco/Crypto/X509Certificate.h"
|
||||
#include "Poco/Crypto/PKCS12Container.h"
|
||||
#include "Poco/FileStream.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
@@ -38,7 +36,7 @@ RSAKeyImpl::RSAKeyImpl(const EVPPKey& key):
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(const X509Certificate& cert):
|
||||
KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
_pRSA(nullptr)
|
||||
{
|
||||
const X509* pCert = cert.certificate();
|
||||
EVP_PKEY* pKey = X509_get_pubkey(const_cast<X509*>(pCert));
|
||||
@@ -54,24 +52,24 @@ RSAKeyImpl::RSAKeyImpl(const X509Certificate& cert):
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(const PKCS12Container& cont):
|
||||
KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
_pRSA(nullptr)
|
||||
{
|
||||
EVPPKey key = cont.getKey();
|
||||
_pRSA = EVP_PKEY_get1_RSA(key);
|
||||
}
|
||||
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(int keyLength, unsigned long exponent): KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
RSAKeyImpl::RSAKeyImpl(int keyLength, unsigned long exponent) : KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(nullptr)
|
||||
{
|
||||
_pRSA = RSA_new();
|
||||
int ret = 0;
|
||||
BIGNUM* bn = 0;
|
||||
BIGNUM* bn = nullptr;
|
||||
try
|
||||
{
|
||||
bn = BN_new();
|
||||
BN_set_word(bn, exponent);
|
||||
ret = RSA_generate_key_ex(_pRSA, keyLength, bn, 0);
|
||||
ret = RSA_generate_key_ex(_pRSA, keyLength, bn, nullptr);
|
||||
BN_free(bn);
|
||||
}
|
||||
catch (...)
|
||||
@@ -83,12 +81,11 @@ RSAKeyImpl::RSAKeyImpl(int keyLength, unsigned long exponent): KeyPairImpl("rsa"
|
||||
}
|
||||
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase):
|
||||
KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(nullptr)
|
||||
{
|
||||
poco_assert_dbg(_pRSA == 0);
|
||||
poco_assert_dbg(_pRSA == nullptr);
|
||||
|
||||
_pRSA = RSA_new();
|
||||
if (!publicKeyFile.empty())
|
||||
@@ -98,14 +95,14 @@ RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
int rc = BIO_read_filename(bio, publicKeyFile.c_str());
|
||||
if (rc)
|
||||
{
|
||||
RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0);
|
||||
RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, nullptr, nullptr);
|
||||
if (!pubKey)
|
||||
{
|
||||
int rc = BIO_reset(bio);
|
||||
// BIO_reset() normally returns 1 for success and 0 or -1 for failure.
|
||||
// File BIOs are an exception, they return 0 for success and -1 for failure.
|
||||
if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
|
||||
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
|
||||
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, nullptr, nullptr);
|
||||
}
|
||||
BIO_free(bio);
|
||||
if (!pubKey)
|
||||
@@ -128,11 +125,11 @@ RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
int rc = BIO_read_filename(bio, privateKeyFile.c_str());
|
||||
if (rc)
|
||||
{
|
||||
RSA* privKey = 0;
|
||||
RSA* privKey = nullptr;
|
||||
if (privateKeyPassphrase.empty())
|
||||
privKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, 0, 0);
|
||||
privKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, nullptr, nullptr);
|
||||
else
|
||||
privKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, 0, const_cast<char*>(privateKeyPassphrase.c_str()));
|
||||
privKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, nullptr, const_cast<char *>( privateKeyPassphrase.c_str()));
|
||||
BIO_free(bio);
|
||||
if (!privKey)
|
||||
{
|
||||
@@ -149,12 +146,11 @@ RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
}
|
||||
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream,
|
||||
std::istream* pPrivateKeyStream,
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase):
|
||||
KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(nullptr)
|
||||
{
|
||||
poco_assert_dbg(_pRSA == 0);
|
||||
poco_assert_dbg(_pRSA == nullptr);
|
||||
|
||||
_pRSA = RSA_new();
|
||||
if (pPublicKeyStream)
|
||||
@@ -163,14 +159,14 @@ RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream,
|
||||
Poco::StreamCopier::copyToString(*pPublicKeyStream, publicKeyData);
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(publicKeyData.data()), static_cast<int>(publicKeyData.size()));
|
||||
if (!bio) throw Poco::IOException("Cannot create BIO for reading public key");
|
||||
RSA* publicKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0);
|
||||
RSA* publicKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, nullptr, nullptr);
|
||||
if (!publicKey)
|
||||
{
|
||||
int rc = BIO_reset(bio);
|
||||
// BIO_reset() normally returns 1 for success and 0 or -1 for failure.
|
||||
// File BIOs are an exception, they return 0 for success and -1 for failure.
|
||||
if (rc != 1) throw Poco::FileException("Failed to load public key");
|
||||
publicKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
|
||||
publicKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, nullptr, nullptr);
|
||||
}
|
||||
BIO_free(bio);
|
||||
if (!publicKey)
|
||||
@@ -186,11 +182,11 @@ RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream,
|
||||
Poco::StreamCopier::copyToString(*pPrivateKeyStream, privateKeyData);
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(privateKeyData.data()), static_cast<int>(privateKeyData.size()));
|
||||
if (!bio) throw Poco::IOException("Cannot create BIO for reading private key");
|
||||
RSA* privateKey = 0;
|
||||
RSA* privateKey = nullptr;
|
||||
if (privateKeyPassphrase.empty())
|
||||
privateKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, 0, 0);
|
||||
privateKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, nullptr, nullptr);
|
||||
else
|
||||
privateKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, 0, const_cast<char*>(privateKeyPassphrase.c_str()));
|
||||
privateKey = PEM_read_bio_RSAPrivateKey(bio, &_pRSA, nullptr, const_cast<char *>(privateKeyPassphrase.c_str()));
|
||||
BIO_free(bio);
|
||||
if (!privateKey)
|
||||
{
|
||||
@@ -210,7 +206,7 @@ RSAKeyImpl::~RSAKeyImpl()
|
||||
void RSAKeyImpl::freeRSA()
|
||||
{
|
||||
if (_pRSA) RSA_free(_pRSA);
|
||||
_pRSA = 0;
|
||||
_pRSA = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,9 +219,9 @@ int RSAKeyImpl::size() const
|
||||
RSAKeyImpl::ByteVec RSAKeyImpl::modulus() const
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
const BIGNUM* n = 0;
|
||||
const BIGNUM* e = 0;
|
||||
const BIGNUM* d = 0;
|
||||
const BIGNUM* n = nullptr;
|
||||
const BIGNUM* e = nullptr;
|
||||
const BIGNUM* d = nullptr;
|
||||
RSA_get0_key(_pRSA, &n, &e, &d);
|
||||
return convertToByteVec(n);
|
||||
#else
|
||||
@@ -237,9 +233,9 @@ RSAKeyImpl::ByteVec RSAKeyImpl::modulus() const
|
||||
RSAKeyImpl::ByteVec RSAKeyImpl::encryptionExponent() const
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
const BIGNUM* n = 0;
|
||||
const BIGNUM* e = 0;
|
||||
const BIGNUM* d = 0;
|
||||
const BIGNUM* n = nullptr;
|
||||
const BIGNUM* e = nullptr;
|
||||
const BIGNUM* d = nullptr;
|
||||
RSA_get0_key(_pRSA, &n, &e, &d);
|
||||
return convertToByteVec(e);
|
||||
#else
|
||||
@@ -251,9 +247,9 @@ RSAKeyImpl::ByteVec RSAKeyImpl::encryptionExponent() const
|
||||
RSAKeyImpl::ByteVec RSAKeyImpl::decryptionExponent() const
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
const BIGNUM* n = 0;
|
||||
const BIGNUM* e = 0;
|
||||
const BIGNUM* d = 0;
|
||||
const BIGNUM* n = nullptr;
|
||||
const BIGNUM* e = nullptr;
|
||||
const BIGNUM* d = nullptr;
|
||||
RSA_get0_key(_pRSA, &n, &e, &d);
|
||||
return convertToByteVec(d);
|
||||
#else
|
||||
@@ -297,11 +293,11 @@ void RSAKeyImpl::save(const std::string& publicKeyFile,
|
||||
{
|
||||
int rc = 0;
|
||||
if (privateKeyPassphrase.empty())
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, nullptr, nullptr, 0, nullptr, nullptr);
|
||||
else
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
reinterpret_cast<unsigned char *>( const_cast<char *>( privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), nullptr, nullptr);
|
||||
if (!rc) throw Poco::FileException("Failed to write private key to file", privateKeyFile);
|
||||
}
|
||||
else throw Poco::CreateFileException("Cannot create private key file", privateKeyFile);
|
||||
@@ -341,11 +337,12 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream,
|
||||
if (!bio) throw Poco::IOException("Cannot create BIO for writing public key");
|
||||
int rc = 0;
|
||||
if (privateKeyPassphrase.empty())
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, nullptr, nullptr, 0, nullptr, nullptr);
|
||||
else
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio,
|
||||
_pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char *>( const_cast<char *>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), nullptr, nullptr);
|
||||
if (!rc)
|
||||
{
|
||||
BIO_free(bio);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "Poco/Crypto/X509Certificate.h"
|
||||
#include "Poco/Crypto/CryptoException.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/DateTimeParser.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <sstream>
|
||||
@@ -41,15 +40,13 @@ namespace Poco {
|
||||
namespace Crypto {
|
||||
|
||||
|
||||
X509Certificate::X509Certificate(std::istream& istr):
|
||||
_pCert(0)
|
||||
X509Certificate::X509Certificate(std::istream& istr) : _pCert(nullptr)
|
||||
{
|
||||
load(istr);
|
||||
}
|
||||
|
||||
|
||||
X509Certificate::X509Certificate(const std::string& path):
|
||||
_pCert(0)
|
||||
X509Certificate::X509Certificate(const std::string& path) : _pCert(nullptr)
|
||||
{
|
||||
load(path);
|
||||
}
|
||||
@@ -147,7 +144,7 @@ void X509Certificate::load(std::istream& istr)
|
||||
|
||||
BIO *pBIO = BIO_new_mem_buf(const_cast<char*>(cert.data()), static_cast<int>(cert.size()));
|
||||
if (!pBIO) throw Poco::IOException("Cannot create BIO for reading certificate");
|
||||
_pCert = PEM_read_bio_X509(pBIO, 0, 0, 0);
|
||||
_pCert = PEM_read_bio_X509(pBIO, nullptr, nullptr, nullptr);
|
||||
BIO_free(pBIO);
|
||||
|
||||
if (!_pCert) throw Poco::IOException("Failed to load certificate from stream");
|
||||
@@ -168,7 +165,7 @@ void X509Certificate::load(const std::string& path)
|
||||
throw Poco::OpenFileException("Cannot open certificate file for reading", path);
|
||||
}
|
||||
|
||||
_pCert = PEM_read_bio_X509(pBIO, 0, 0, 0);
|
||||
_pCert = PEM_read_bio_X509(pBIO, nullptr, nullptr, nullptr);
|
||||
BIO_free(pBIO);
|
||||
|
||||
if (!_pCert) throw Poco::ReadFileException("Faild to load certificate from", path);
|
||||
@@ -239,7 +236,7 @@ void X509Certificate::init()
|
||||
{
|
||||
_issuerName = _X509_NAME_oneline_utf8(X509_get_issuer_name(_pCert));
|
||||
_subjectName = _X509_NAME_oneline_utf8(X509_get_subject_name(_pCert));
|
||||
BIGNUM* pBN = ASN1_INTEGER_to_BN(X509_get_serialNumber(const_cast<X509*>(_pCert)), 0);
|
||||
BIGNUM* pBN = ASN1_INTEGER_to_BN(X509_get_serialNumber(const_cast<X509 *>(_pCert)), nullptr);
|
||||
if (pBN)
|
||||
{
|
||||
char* pSN = BN_bn2hex(pBN);
|
||||
@@ -286,8 +283,7 @@ std::string X509Certificate::subjectName(NID nid) const
|
||||
void X509Certificate::extractNames(std::string& cmnName, std::set<std::string>& domainNames) const
|
||||
{
|
||||
domainNames.clear();
|
||||
if (STACK_OF(GENERAL_NAME)* names = static_cast<STACK_OF(GENERAL_NAME)*>(X509_get_ext_d2i(_pCert, NID_subject_alt_name, 0, 0)))
|
||||
{
|
||||
if (STACK_OF(GENERAL_NAME) *names = static_cast<STACK_OF(GENERAL_NAME) *>( X509_get_ext_d2i(_pCert, NID_subject_alt_name, nullptr, nullptr))) {
|
||||
for (int i = 0; i < sk_GENERAL_NAME_num(names); ++i)
|
||||
{
|
||||
const GENERAL_NAME* name = sk_GENERAL_NAME_value(names, i);
|
||||
@@ -416,8 +412,9 @@ X509Certificate::List X509Certificate::readPEM(const std::string& pemFileName)
|
||||
{
|
||||
List caCertList;
|
||||
BIO* pBIO = BIO_new_file(pemFileName.c_str(), "r");
|
||||
if (pBIO == NULL) throw OpenFileException(Poco::format("X509Certificate::readPEM(%s)", pemFileName));
|
||||
X509* x = PEM_read_bio_X509(pBIO, NULL, 0, NULL);
|
||||
if (pBIO == nullptr)
|
||||
throw OpenFileException(Poco::format("X509Certificate::readPEM(%s)", pemFileName));
|
||||
X509* x = PEM_read_bio_X509(pBIO, nullptr, nullptr, nullptr);
|
||||
if (!x)
|
||||
{
|
||||
BIO_free(pBIO);
|
||||
@@ -426,7 +423,7 @@ X509Certificate::List X509Certificate::readPEM(const std::string& pemFileName)
|
||||
while (x)
|
||||
{
|
||||
caCertList.push_back(X509Certificate(x));
|
||||
x = PEM_read_bio_X509(pBIO, NULL, 0, NULL);
|
||||
x = PEM_read_bio_X509(pBIO, nullptr, nullptr, nullptr);
|
||||
}
|
||||
BIO_free(pBIO);
|
||||
return caCertList;
|
||||
@@ -436,7 +433,7 @@ X509Certificate::List X509Certificate::readPEM(const std::string& pemFileName)
|
||||
void X509Certificate::writePEM(const std::string& pemFileName, const List& list)
|
||||
{
|
||||
BIO* pBIO = BIO_new_file(pemFileName.c_str(), "a");
|
||||
if (pBIO == NULL) throw OpenFileException(Poco::format("X509Certificate::writePEM(%s)", pemFileName));
|
||||
if (pBIO == nullptr) throw OpenFileException(Poco::format("X509Certificate::writePEM(%s)", pemFileName));
|
||||
List::const_iterator it = list.begin();
|
||||
List::const_iterator end = list.end();
|
||||
for (; it != end; ++it)
|
||||
|
||||
@@ -123,7 +123,7 @@ void EVPTest::testRSAEVPPKey()
|
||||
|
||||
BIO* bioPriv1 = BIO_new(BIO_s_mem());
|
||||
BIO* bioPub1 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey));
|
||||
char* pPrivData1;
|
||||
long sizePriv1 = BIO_get_mem_data(bioPriv1, &pPrivData1);
|
||||
@@ -138,7 +138,7 @@ void EVPTest::testRSAEVPPKey()
|
||||
|
||||
BIO* bioPriv2 = BIO_new(BIO_s_mem());
|
||||
BIO* bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue ( 0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey));
|
||||
char* pPrivData2;
|
||||
long sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
@@ -158,7 +158,7 @@ void EVPTest::testRSAEVPPKey()
|
||||
assertTrue (evpPKey2.type() == EVP_PKEY_RSA);
|
||||
bioPriv2 = BIO_new(BIO_s_mem());
|
||||
bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2));
|
||||
sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2);
|
||||
@@ -176,7 +176,7 @@ void EVPTest::testRSAEVPPKey()
|
||||
assertTrue (evpPKey3.type() == EVP_PKEY_RSA);
|
||||
bioPriv2 = BIO_new(BIO_s_mem());
|
||||
bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3));
|
||||
sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2);
|
||||
@@ -229,7 +229,7 @@ void EVPTest::testRSAEVPSaveLoadStream()
|
||||
assertTrue (strPub2.str() == pubKey);
|
||||
|
||||
std::istringstream iPriv2(strPriv2.str());
|
||||
EVPPKey key3(0, &iPriv2, "testpwd");
|
||||
EVPPKey key3(nullptr, &iPriv2, "testpwd");
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
assertTrue (strPub3.str() == pubKey);
|
||||
@@ -261,7 +261,7 @@ void EVPTest::testRSAEVPSaveLoadStreamNoPass()
|
||||
assertTrue (!(key2 == keyNE));
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
EVPPKey key3(0, &iPriv2);
|
||||
EVPPKey key3(nullptr, &iPriv2);
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -277,7 +277,7 @@ void EVPTest::testECEVPPKey()
|
||||
if (!curveName.empty())
|
||||
{
|
||||
EVPPKey* pKey = new EVPPKey(curveName);
|
||||
assertTrue (pKey != 0);
|
||||
assertTrue(pKey != nullptr);
|
||||
assertTrue (!pKey->isSupported(0));
|
||||
assertTrue (!pKey->isSupported(-1));
|
||||
assertTrue (pKey->isSupported(pKey->type()));
|
||||
@@ -285,7 +285,7 @@ void EVPTest::testECEVPPKey()
|
||||
|
||||
BIO* bioPriv1 = BIO_new(BIO_s_mem());
|
||||
BIO* bioPub1 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey));
|
||||
char* pPrivData1;
|
||||
long sizePriv1 = BIO_get_mem_data(bioPriv1, &pPrivData1);
|
||||
@@ -300,7 +300,7 @@ void EVPTest::testECEVPPKey()
|
||||
|
||||
BIO* bioPriv2 = BIO_new(BIO_s_mem());
|
||||
BIO* bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey));
|
||||
char* pPrivData2;
|
||||
long sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
@@ -320,7 +320,7 @@ void EVPTest::testECEVPPKey()
|
||||
assertTrue (evpPKey2.type() == EVP_PKEY_EC);
|
||||
bioPriv2 = BIO_new(BIO_s_mem());
|
||||
bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey( bioPriv2, evpPKey2, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2));
|
||||
sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2);
|
||||
@@ -338,7 +338,7 @@ void EVPTest::testECEVPPKey()
|
||||
assertTrue (evpPKey3.type() == EVP_PKEY_EC);
|
||||
bioPriv2 = BIO_new(BIO_s_mem());
|
||||
bioPub2 = BIO_new(BIO_s_mem());
|
||||
assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL));
|
||||
assertTrue(0 != PEM_write_bio_PrivateKey( bioPriv2, evpPKey3, nullptr, nullptr, 0, nullptr, nullptr));
|
||||
assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3));
|
||||
sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2);
|
||||
sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2);
|
||||
@@ -402,7 +402,7 @@ void EVPTest::testECEVPSaveLoadStream()
|
||||
assertTrue (strPub2.str() == pubKey);
|
||||
|
||||
std::istringstream iPriv2(strPriv2.str());
|
||||
EVPPKey key3(0, &iPriv2, "testpwd");
|
||||
EVPPKey key3(nullptr, &iPriv2, "testpwd");
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -458,7 +458,7 @@ void EVPTest::testECEVPSaveLoadStreamNoPass()
|
||||
assertTrue (strPriv2.str() == privKey);
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
EVPPKey key3(0, &iPriv2);
|
||||
EVPPKey key3(nullptr, &iPriv2);
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -577,7 +577,7 @@ void EVPTest::testRSAEVPKeyFromX509()
|
||||
X509Certificate cert(str);
|
||||
EVPPKey publicKey(cert);
|
||||
std::istringstream str2(anyPemRSA);
|
||||
EVPPKey privateKey(0, &str2, "test");
|
||||
EVPPKey privateKey(nullptr, &str2, "test");
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(publicKey);
|
||||
Cipher::Ptr pCipher2 = CipherFactory::defaultFactory().createCipher(privateKey);
|
||||
std::string val("lets do some encryption");
|
||||
@@ -631,7 +631,7 @@ void EVPTest::testRSAEVPKeyByLength()
|
||||
assertTrue (!(key2 == keyNE));
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
EVPPKey key3(0, &iPriv2);
|
||||
EVPPKey key3(nullptr, &iPriv2);
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -672,7 +672,7 @@ void EVPTest::testECEVPKeyByLength()
|
||||
assertTrue (!(key2 == keyNE));
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
EVPPKey key3(0, &iPriv2);
|
||||
EVPPKey key3(nullptr, &iPriv2);
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
|
||||
@@ -101,7 +101,7 @@ void RSATest::testNewKeys()
|
||||
RSAKey key2(&iPub, &iPriv, "testpwd");
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
RSAKey key3(0, &iPriv2, "testpwd");
|
||||
RSAKey key3(nullptr, &iPriv2, "testpwd");
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -124,7 +124,7 @@ void RSATest::testNewKeysNoPassphrase()
|
||||
RSAKey key2(&iPub, &iPriv);
|
||||
|
||||
std::istringstream iPriv2(privKey);
|
||||
RSAKey key3(0, &iPriv2);
|
||||
RSAKey key3(nullptr, &iPriv2);
|
||||
std::ostringstream strPub3;
|
||||
key3.save(&strPub3);
|
||||
std::string pubFromPrivate = strPub3.str();
|
||||
@@ -269,7 +269,7 @@ void RSATest::testCertificate()
|
||||
X509Certificate cert(str);
|
||||
RSAKey publicKey(cert);
|
||||
std::istringstream str2(anyPem);
|
||||
RSAKey privateKey(0, &str2, "test");
|
||||
RSAKey privateKey(nullptr, &str2, "test");
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(publicKey);
|
||||
Cipher::Ptr pCipher2 = CipherFactory::defaultFactory().createCipher(privateKey);
|
||||
std::string val("lets do some encryption");
|
||||
|
||||
@@ -205,7 +205,10 @@ BrowseHandle AvahiBrowserImpl::browse(const std::string& regType, const std::str
|
||||
AvahiResponderImpl::ScopedLock lock(_responder);
|
||||
|
||||
AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface;
|
||||
AvahiServiceBrowser* browser = avahi_service_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, regType.c_str(), domain.empty() ? NULL : domain.c_str(), (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onBrowseReply, this);
|
||||
AvahiServiceBrowser* browser = avahi_service_browser_new(
|
||||
_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, regType.c_str(),
|
||||
domain.empty() ? nullptr : domain.c_str(), (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onBrowseReply, this
|
||||
);
|
||||
if (!browser)
|
||||
{
|
||||
int error = avahi_client_errno(_responder._avahiClient);
|
||||
@@ -235,13 +238,19 @@ BrowseHandle AvahiBrowserImpl::enumerateBrowseDomains(Poco::Int32 networkInterfa
|
||||
AvahiResponderImpl::ScopedLock lock(_responder);
|
||||
|
||||
AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface;
|
||||
AvahiDomainBrowser* browser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateBrowseDomainsReply, this);
|
||||
AvahiDomainBrowser* browser = avahi_domain_browser_new(
|
||||
_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, nullptr,
|
||||
AVAHI_DOMAIN_BROWSER_BROWSE, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateBrowseDomainsReply, this
|
||||
);
|
||||
if (!browser)
|
||||
{
|
||||
int error = avahi_client_errno(_responder._avahiClient);
|
||||
throw Poco::DNSSD::DNSSDException("Failed to enumerate browse domains", AvahiResponderImpl::describeError(error), error);
|
||||
}
|
||||
AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultBrowseDomainsReply, this);
|
||||
AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(
|
||||
_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, nullptr,
|
||||
AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultBrowseDomainsReply, this
|
||||
);
|
||||
if (!defaultBrowser)
|
||||
{
|
||||
int error = avahi_client_errno(_responder._avahiClient);
|
||||
@@ -257,13 +266,19 @@ BrowseHandle AvahiBrowserImpl::enumerateRegistrationDomains(Poco::Int32 networkI
|
||||
AvahiResponderImpl::ScopedLock lock(_responder);
|
||||
|
||||
AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface;
|
||||
AvahiDomainBrowser* browser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_REGISTER, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateRegistrationDomainsReply, this);
|
||||
AvahiDomainBrowser* browser = avahi_domain_browser_new(
|
||||
_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, nullptr,
|
||||
AVAHI_DOMAIN_BROWSER_REGISTER, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateRegistrationDomainsReply, this
|
||||
);
|
||||
if (!browser)
|
||||
{
|
||||
int error = avahi_client_errno(_responder._avahiClient);
|
||||
throw Poco::DNSSD::DNSSDException("Failed to enumerate registration domains", AvahiResponderImpl::describeError(error), error);
|
||||
}
|
||||
AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultRegistrationDomainsReply, this);
|
||||
AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(
|
||||
_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, nullptr,
|
||||
AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultRegistrationDomainsReply, this
|
||||
);
|
||||
if (!defaultBrowser)
|
||||
{
|
||||
int error = avahi_client_errno(_responder._avahiClient);
|
||||
|
||||
@@ -66,8 +66,8 @@ extern "C" void onGroupStateChange(AvahiEntryGroup* avahiGroup, AvahiEntryGroupS
|
||||
AvahiResponderImpl::AvahiResponderImpl(Poco::DNSSD::DNSSDResponder& owner):
|
||||
_owner(owner),
|
||||
_browser(*this),
|
||||
_avahiPoll(0),
|
||||
_avahiClient(0),
|
||||
_avahiPoll(nullptr),
|
||||
_avahiClient(nullptr),
|
||||
_running(false),
|
||||
_nextRecordId(1)
|
||||
{
|
||||
@@ -299,8 +299,8 @@ void AvahiResponderImpl::setupEntryGroup(AvahiEntryGroup* avahiGroup, const Serv
|
||||
}
|
||||
std::string name(service.name());
|
||||
if (name.empty()) name = avahi_client_get_host_name(_avahiClient);
|
||||
const char* domain = service.domain().empty() ? 0 : service.domain().c_str();
|
||||
const char* host = service.host().empty() ? 0 : service.host().c_str();
|
||||
const char* domain = service.domain().empty() ? nullptr : service.domain().c_str();
|
||||
const char* host = service.host().empty() ? nullptr : service.host().c_str();
|
||||
|
||||
int error = rename ? AVAHI_ERR_COLLISION : avahi_entry_group_add_service_strlst(
|
||||
avahiGroup,
|
||||
@@ -390,7 +390,7 @@ void AvahiResponderImpl::setupEntryGroup(AvahiEntryGroup* avahiGroup, const Serv
|
||||
|
||||
AvahiStringList* AvahiResponderImpl::createTXTRecord(const Service::Properties& properties)
|
||||
{
|
||||
AvahiStringList* avahiList = 0;
|
||||
AvahiStringList* avahiList = nullptr;
|
||||
Service::Properties::ConstIterator itVers = properties.find("txtvers");
|
||||
Service::Properties::ConstIterator itEnd = properties.end();
|
||||
std::string entry;
|
||||
@@ -399,7 +399,7 @@ AvahiStringList* AvahiResponderImpl::createTXTRecord(const Service::Properties&
|
||||
std::string entry(itVers->first);
|
||||
entry += '=';
|
||||
entry += itVers->second;
|
||||
avahiList = avahi_string_list_new(entry.c_str(), NULL);
|
||||
avahiList = avahi_string_list_new(entry.c_str(), nullptr);
|
||||
}
|
||||
|
||||
Service::Properties::ConstIterator it = properties.begin();
|
||||
@@ -409,7 +409,11 @@ AvahiStringList* AvahiResponderImpl::createTXTRecord(const Service::Properties&
|
||||
{
|
||||
if (avahiList)
|
||||
{
|
||||
avahiList = avahi_string_list_add_pair_arbitrary(avahiList, it->first.c_str(), reinterpret_cast<const uint8_t*>(it->second.empty() ? NULL : it->second.c_str()), it->second.size());
|
||||
avahiList = avahi_string_list_add_pair_arbitrary(
|
||||
avahiList, it->first.c_str(), reinterpret_cast<const uint8_t*>(it->second.empty() ?
|
||||
nullptr :
|
||||
it->second.c_str()), it->second.size()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -419,7 +423,7 @@ AvahiStringList* AvahiResponderImpl::createTXTRecord(const Service::Properties&
|
||||
entry += '=';
|
||||
entry += it->second;
|
||||
}
|
||||
avahiList = avahi_string_list_new(entry.c_str(), NULL);
|
||||
avahiList = avahi_string_list_new(entry.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ BrowseHandle BonjourBrowserImpl::browse(const std::string& regType, const std::s
|
||||
{
|
||||
DNSServiceRef sdRef(nullptr);
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceBrowse(&sdRef, 0, networkInterface, regType.c_str(), domain.empty() ? 0 : domain.c_str(), Poco::DNSSD::Bonjour::onBrowseReply, this);
|
||||
DNSServiceErrorType err = DNSServiceBrowse(&sdRef, 0, networkInterface, regType.c_str(), domain.empty() ? nullptr : domain.c_str(), Poco::DNSSD::Bonjour::onBrowseReply, this);
|
||||
if (err == kDNSServiceErr_NoError)
|
||||
{
|
||||
_eventLoop.add(sdRef);
|
||||
@@ -186,7 +186,7 @@ BrowseHandle BonjourBrowserImpl::browse(const std::string& regType, const std::s
|
||||
|
||||
BrowseHandle BonjourBrowserImpl::resolve(const Service& service, int options)
|
||||
{
|
||||
DNSServiceRef sdRef(0);
|
||||
DNSServiceRef sdRef(nullptr);
|
||||
Poco::Int32 ifIndex = (options & RESOLVE_ON_ALL_INTERFACES) ? 0 : service.networkInterface();
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceResolve(&sdRef, 0, ifIndex, service.name().c_str(), service.type().c_str(), service.domain().c_str(), Poco::DNSSD::Bonjour::onResolveReply, this);
|
||||
@@ -202,7 +202,7 @@ BrowseHandle BonjourBrowserImpl::resolve(const Service& service, int options)
|
||||
|
||||
BrowseHandle BonjourBrowserImpl::enumerateBrowseDomains(Poco::Int32 networkInterface)
|
||||
{
|
||||
DNSServiceRef sdRef(0);
|
||||
DNSServiceRef sdRef(nullptr);
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceEnumerateDomains(&sdRef, kDNSServiceFlagsBrowseDomains, networkInterface, Poco::DNSSD::Bonjour::onEnumerateBrowseDomainsReply, this);
|
||||
if (err == kDNSServiceErr_NoError)
|
||||
@@ -216,7 +216,7 @@ BrowseHandle BonjourBrowserImpl::enumerateBrowseDomains(Poco::Int32 networkInter
|
||||
|
||||
BrowseHandle BonjourBrowserImpl::enumerateRegistrationDomains(Poco::Int32 networkInterface)
|
||||
{
|
||||
DNSServiceRef sdRef(0);
|
||||
DNSServiceRef sdRef(nullptr);
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceEnumerateDomains(&sdRef, kDNSServiceFlagsRegistrationDomains, networkInterface, Poco::DNSSD::Bonjour::onEnumerateRegistrationDomainsReply, this);
|
||||
if (err == kDNSServiceErr_NoError)
|
||||
@@ -247,7 +247,7 @@ BrowseHandle BonjourBrowserImpl::queryRecord(const std::string& name, Poco::UInt
|
||||
|
||||
BrowseHandle BonjourBrowserImpl::resolveHost(const std::string& host, int options, Poco::Int32 networkInterface)
|
||||
{
|
||||
DNSServiceRef sdRef(0);
|
||||
DNSServiceRef sdRef(nullptr);
|
||||
DNSServiceFlags flags(0);
|
||||
if (options & BROWSE_FORCE_MULTICAST) flags |= kDNSServiceFlagsForceMulticast;
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
|
||||
@@ -85,7 +85,13 @@ ServiceHandle BonjourResponderImpl::registerService(const Service& service, int
|
||||
if (options & DNSSDResponder::REG_NON_BROWSABLE) flags |= kDNSServiceFlagsNonBrowsable;
|
||||
#endif
|
||||
std::string txtRecord = createTXTRecord(service.properties());
|
||||
DNSServiceErrorType err = DNSServiceRegister(&sdRef, flags, intf, service.name().empty() ? 0 : service.name().c_str(), service.type().c_str(), service.domain().empty() ? 0 : service.domain().c_str(), service.host().empty() ? 0 : service.host().c_str(), Poco::ByteOrder::toNetwork(service.port()), txtRecord.size(), txtRecord.empty() ? 0 : txtRecord.data(), Poco::DNSSD::Bonjour::onRegisterServiceReply, this);
|
||||
DNSServiceErrorType err = DNSServiceRegister(
|
||||
&sdRef, flags, intf,
|
||||
service.name().empty() ? nullptr : service.name().c_str(),
|
||||
service.type().c_str(), service.domain().empty() ? nullptr : service.domain().c_str(),
|
||||
service.host().empty() ? nullptr : service.host().c_str(),
|
||||
Poco::ByteOrder::toNetwork(service.port()), txtRecord.size(), txtRecord.empty() ? nullptr : txtRecord.data(),
|
||||
Poco::DNSSD::Bonjour::onRegisterServiceReply, this);
|
||||
if (err == kDNSServiceErr_NoError)
|
||||
{
|
||||
_eventLoop.add(sdRef);
|
||||
@@ -105,7 +111,7 @@ void BonjourResponderImpl::unregisterService(ServiceHandle& serviceHandle)
|
||||
|
||||
RecordHandle BonjourResponderImpl::addRecord(ServiceHandle serviceHandle, const Record& record)
|
||||
{
|
||||
DNSRecordRef recRef(0);
|
||||
DNSRecordRef recRef(nullptr);
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceAddRecord(serviceHandle.cast<DNSServiceRef>(), &recRef, 0, record.type(), record.length(), record.data(), record.ttl());
|
||||
if (err == kDNSServiceErr_NoError)
|
||||
@@ -119,7 +125,9 @@ RecordHandle BonjourResponderImpl::addRecord(ServiceHandle serviceHandle, const
|
||||
void BonjourResponderImpl::updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record)
|
||||
{
|
||||
EventLoop::ScopedLock lock(_eventLoop);
|
||||
DNSServiceErrorType err = DNSServiceUpdateRecord(serviceHandle.cast<DNSServiceRef>(), recordHandle.cast<DNSRecordRef>(), 0, record.length(), record.data(), record.ttl());
|
||||
DNSServiceErrorType err = DNSServiceUpdateRecord(
|
||||
serviceHandle.cast<DNSServiceRef>(), recordHandle.cast<DNSRecordRef>(), 0,
|
||||
record.length(), record.data(), record.ttl());
|
||||
if (err != kDNSServiceErr_NoError)
|
||||
{
|
||||
throw Poco::DNSSD::DNSSDException("Failed to update record " + record.name(), describeError(err), err);
|
||||
@@ -268,7 +276,7 @@ std::string BonjourResponderImpl::createTXTRecord(const Service::Properties& pro
|
||||
if (itVers != itEnd)
|
||||
{
|
||||
Poco::UInt8 valueSize = static_cast<Poco::UInt8>(itVers->second.size());
|
||||
TXTRecordSetValue(&ref, itVers->first.c_str(), valueSize, valueSize == 0 ? 0 : itVers->second.c_str());
|
||||
TXTRecordSetValue(&ref, itVers->first.c_str(), valueSize, valueSize == 0 ? nullptr : itVers->second.c_str());
|
||||
}
|
||||
|
||||
it = properties.begin();
|
||||
@@ -277,7 +285,7 @@ std::string BonjourResponderImpl::createTXTRecord(const Service::Properties& pro
|
||||
if (it != itVers)
|
||||
{
|
||||
Poco::UInt8 valueSize = static_cast<Poco::UInt8>(it->second.size());
|
||||
TXTRecordSetValue(&ref, it->first.c_str(), valueSize, valueSize == 0 ? 0 : it->second.c_str());
|
||||
TXTRecordSetValue(&ref, it->first.c_str(), valueSize, valueSize == 0 ? nullptr : it->second.c_str());
|
||||
}
|
||||
}
|
||||
const void* txtRecord = TXTRecordGetBytesPtr(&ref);
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
if (request.getURI() == "/")
|
||||
return new TimeRequestHandler(_format);
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Poco {
|
||||
namespace DNSSD {
|
||||
|
||||
|
||||
DNSSDResponderImplFactory* DNSSDResponder::_pImplFactory(0);
|
||||
DNSSDResponderImplFactory* DNSSDResponder::_pImplFactory(nullptr);
|
||||
|
||||
|
||||
DNSSDResponder::DNSSDResponder():
|
||||
_pImpl(0)
|
||||
_pImpl(nullptr)
|
||||
{
|
||||
if (_pImplFactory)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ void DNSSDResponder::registerImplFactory(DNSSDResponderImplFactory& factory)
|
||||
|
||||
void DNSSDResponder::unregisterImplFactory()
|
||||
{
|
||||
_pImplFactory = 0;
|
||||
_pImplFactory = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Record::Record():
|
||||
_type(0),
|
||||
_clazz(0),
|
||||
_length(0),
|
||||
_data(0),
|
||||
_data(nullptr),
|
||||
_ttl(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
~SessionHandle();
|
||||
/// Destroy handle, close connection
|
||||
|
||||
void init(MYSQL* mysql = 0);
|
||||
void init(MYSQL* mysql = nullptr);
|
||||
/// Initializes the handle iff not initialized.
|
||||
|
||||
void options(mysql_option opt);
|
||||
|
||||
@@ -30,7 +30,7 @@ Binder::~Binder()
|
||||
for (std::vector<MYSQL_TIME*>::iterator it = _dates.begin(); it != _dates.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
*it = 0;
|
||||
*it = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ void Binder::bind(std::size_t pos, const UUID& val, Direction dir)
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
realBind(pos, MYSQL_TYPE_NULL, 0, 0);
|
||||
realBind(pos, MYSQL_TYPE_NULL, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ MYSQL_BIND* Binder::getBindArray() const
|
||||
{
|
||||
if (_bindArray.size() == 0)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return const_cast<MYSQL_BIND*>(&_bindArray[0]);
|
||||
@@ -286,7 +286,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
|
||||
std::memset(&_bindArray[s], 0, sizeof(MYSQL_BIND) * (_bindArray.size() - s));
|
||||
}
|
||||
|
||||
MYSQL_BIND b = {0};
|
||||
MYSQL_BIND b = {nullptr};
|
||||
|
||||
b.buffer_type = type;
|
||||
b.buffer = const_cast<void*>(buffer);
|
||||
|
||||
@@ -52,7 +52,7 @@ Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::strin
|
||||
|
||||
void Connector::registerConnector()
|
||||
{
|
||||
if (mysql_library_init(0, 0, 0) != 0)
|
||||
if (mysql_library_init(0, nullptr, nullptr) != 0)
|
||||
{
|
||||
throw Exception("mysql_library_init error");
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void Extractor::reset()
|
||||
|
||||
bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* buffer, bool isUnsigned)
|
||||
{
|
||||
MYSQL_BIND bind = {0};
|
||||
MYSQL_BIND bind = {nullptr};
|
||||
my_bool isNull = 0;
|
||||
|
||||
bind.is_null = &isNull;
|
||||
|
||||
@@ -116,7 +116,7 @@ std::string StatementException::compose(const std::string& text, MYSQL_STMT* h,
|
||||
str += "[Comment]: ";
|
||||
str += text;
|
||||
|
||||
if (h != 0)
|
||||
if (h != nullptr)
|
||||
{
|
||||
str += "\t[mysql_stmt_error]: ";
|
||||
str += mysql_stmt_error(h);
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
#endif
|
||||
|
||||
|
||||
SessionHandle::SessionHandle(MYSQL* mysql): _pHandle(0)
|
||||
SessionHandle::SessionHandle(MYSQL* mysql): _pHandle(nullptr)
|
||||
{
|
||||
init(mysql);
|
||||
#ifdef POCO_OS_FAMILY_UNIX
|
||||
@@ -95,7 +95,7 @@ SessionHandle::~SessionHandle()
|
||||
|
||||
void SessionHandle::options(mysql_option opt)
|
||||
{
|
||||
if (mysql_options(_pHandle, opt, 0) != 0)
|
||||
if (mysql_options(_pHandle, opt, nullptr) != 0)
|
||||
throw ConnectionException("mysql_options error", _pHandle);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void SessionHandle::options(mysql_option opt, unsigned int i)
|
||||
void SessionHandle::connect(const char* host, const char* user, const char* password, const char* db, unsigned int port)
|
||||
{
|
||||
#ifdef HAVE_MYSQL_REAL_CONNECT
|
||||
if (!mysql_real_connect(_pHandle, host, user, password, db, port, 0, 0))
|
||||
if (!mysql_real_connect(_pHandle, host, user, password, db, port, nullptr, 0))
|
||||
throw ConnectionFailedException(mysql_error(_pHandle));
|
||||
#else
|
||||
if (!mysql_connect(_pHandle, host, user, password))
|
||||
@@ -144,7 +144,7 @@ void SessionHandle::close()
|
||||
if (_pHandle)
|
||||
{
|
||||
mysql_close(_pHandle);
|
||||
_pHandle = 0;
|
||||
_pHandle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ const std::string SessionImpl::MYSQL_SERIALIZABLE = "SERIALIZABLE";
|
||||
SessionImpl::SessionImpl(const std::string& connectionString, std::size_t loginTimeout) :
|
||||
Poco::Data::AbstractSessionImpl<SessionImpl>(connectionString, loginTimeout),
|
||||
_connector("MySQL"),
|
||||
_handle(0),
|
||||
_handle(nullptr),
|
||||
_reset(false),
|
||||
_connected(false),
|
||||
_inTransaction(false),
|
||||
@@ -120,7 +120,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
if (options["user"].empty())
|
||||
throw MySQLException("create session: specify user name");
|
||||
|
||||
const char * db = NULL;
|
||||
const char * db = nullptr;
|
||||
if (!options["db"].empty())
|
||||
db = options["db"].c_str();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void StatementExecutor::bindParams(MYSQL_BIND* params, std::size_t count)
|
||||
throw StatementException("Statement is not compiled yet");
|
||||
|
||||
if (count != mysql_stmt_param_count(_pHandle))
|
||||
throw StatementException("wrong bind parameters count", 0, _query);
|
||||
throw StatementException("wrong bind parameters count", nullptr, _query);
|
||||
|
||||
if (count == 0) return;
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ using Poco::Nullable;
|
||||
using Poco::Tuple;
|
||||
using Poco::NamedTuple;
|
||||
|
||||
Poco::SharedPtr<Poco::Data::Session> MySQLTest::_pSession = 0;
|
||||
Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
|
||||
Poco::SharedPtr<Poco::Data::Session> MySQLTest::_pSession = nullptr;
|
||||
Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = nullptr;
|
||||
|
||||
//
|
||||
// Parameters for barebone-test
|
||||
@@ -936,7 +936,7 @@ CppUnit::Test* MySQLTest::suite()
|
||||
catch (ConnectionFailedException& ex)
|
||||
{
|
||||
std::cout << ex.displayText() << std::endl;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,14 +158,14 @@ SQLExecutor::~SQLExecutor()
|
||||
void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const char* pwd, const char* db, int port, const char* tableCreateString)
|
||||
{
|
||||
int rc;
|
||||
MYSQL* hsession = mysql_init(0);
|
||||
assertTrue (hsession != 0);
|
||||
MYSQL* hsession = mysql_init(nullptr);
|
||||
assertTrue (hsession != nullptr);
|
||||
|
||||
MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, 0, 0);
|
||||
MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, nullptr, 0);
|
||||
assertTrue (tmp == hsession);
|
||||
|
||||
MYSQL_STMT* hstmt = mysql_stmt_init(hsession);
|
||||
assertTrue (hstmt != 0);
|
||||
assertTrue (hstmt != nullptr);
|
||||
|
||||
std::string sql = "DROP TABLE Test";
|
||||
mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length()));
|
||||
@@ -185,7 +185,7 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch
|
||||
int fourth = 4;
|
||||
float fifth = 1.5;
|
||||
|
||||
MYSQL_BIND bind_param[5] = {{0}};
|
||||
MYSQL_BIND bind_param[5] = {{nullptr}};
|
||||
|
||||
bind_param[0].buffer = const_cast<char*>(str[0].c_str());
|
||||
bind_param[0].buffer_length = static_cast<unsigned long>(str[0].length());
|
||||
@@ -225,7 +225,7 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch
|
||||
fourth = 0;
|
||||
fifth = 0.0f;
|
||||
|
||||
MYSQL_BIND bind_result[5] = {{0}};
|
||||
MYSQL_BIND bind_result[5] = {{nullptr}};
|
||||
|
||||
bind_result[0].buffer = chr[0];
|
||||
bind_result[0].buffer_length = sizeof(chr[0]);
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
Binder(const StatementHandle& rStmt,
|
||||
std::size_t maxFieldSize,
|
||||
ParameterBinding dataBinding = PB_IMMEDIATE,
|
||||
const TypeInfo* pDataTypes = 0,
|
||||
const TypeInfo* pDataTypes = nullptr,
|
||||
Poco::TextEncoding::Ptr pFromEncoding = nullptr,
|
||||
Poco::TextEncoding::Ptr pDBEncoding = nullptr);
|
||||
/// Creates the Binder.
|
||||
@@ -427,7 +427,7 @@ private:
|
||||
|
||||
getColSizeAndPrecision(pos, cDataType, colSize, decDigits);
|
||||
|
||||
_lengthIndicator.push_back(0);
|
||||
_lengthIndicator.push_back(nullptr);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
@@ -436,7 +436,7 @@ private:
|
||||
Utility::sqlDataType(cDataType),
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &val, 0, 0)))
|
||||
(SQLPOINTER) &val, 0, nullptr)))
|
||||
{
|
||||
throw StatementException(_rStmt, "ODBC::Binder::SQLBindParameter()");
|
||||
}
|
||||
@@ -492,7 +492,7 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length);
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ private:
|
||||
if (PB_IMMEDIATE != _paramBinding)
|
||||
throw InvalidAccessException("Containers can only be bound immediately.");
|
||||
|
||||
const C* pVal = 0;
|
||||
const C* pVal = nullptr;
|
||||
if (!transcodeRequired()) pVal = &valC;
|
||||
else
|
||||
{
|
||||
@@ -614,12 +614,12 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1, SQL_NTS);
|
||||
}
|
||||
|
||||
if (_charPtrs.size() <= pos)
|
||||
_charPtrs.resize(pos + 1, 0);
|
||||
_charPtrs.resize(pos + 1, nullptr);
|
||||
|
||||
_charPtrs[pos] = (char*) std::calloc(pVal->size() * size, sizeof(char));
|
||||
|
||||
@@ -685,12 +685,12 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1, SQL_NTS);
|
||||
}
|
||||
|
||||
if (_utf16CharPtrs.size() <= pos)
|
||||
_utf16CharPtrs.resize(pos + 1, 0);
|
||||
_utf16CharPtrs.resize(pos + 1, nullptr);
|
||||
|
||||
_utf16CharPtrs[pos] = (UTF16Char*)std::calloc(val.size() * size, sizeof(UTF16Char));
|
||||
|
||||
@@ -745,7 +745,7 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1);
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ private:
|
||||
}
|
||||
|
||||
if (_charPtrs.size() <= pos)
|
||||
_charPtrs.resize(pos + 1, 0);
|
||||
_charPtrs.resize(pos + 1, nullptr);
|
||||
|
||||
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(CharType));
|
||||
poco_check_ptr (_charPtrs[pos]);
|
||||
@@ -811,13 +811,13 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1);
|
||||
}
|
||||
|
||||
if (_dateVecVec.size() <= pos)
|
||||
{
|
||||
_dateVecVec.resize(pos + 1, 0);
|
||||
_dateVecVec.resize(pos + 1, nullptr);
|
||||
_dateVecVec[pos] = new DateVec(length ? length : 1);
|
||||
}
|
||||
|
||||
@@ -859,13 +859,13 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1);
|
||||
}
|
||||
|
||||
if (_timeVecVec.size() <= pos)
|
||||
{
|
||||
_timeVecVec.resize(pos + 1, 0);
|
||||
_timeVecVec.resize(pos + 1, nullptr);
|
||||
_timeVecVec[pos] = new TimeVec(length ? length : 1);
|
||||
}
|
||||
|
||||
@@ -908,13 +908,13 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1);
|
||||
}
|
||||
|
||||
if (_dateTimeVecVec.size() <= pos)
|
||||
{
|
||||
_dateTimeVecVec.resize(pos + 1, 0);
|
||||
_dateTimeVecVec.resize(pos + 1, nullptr);
|
||||
_dateTimeVecVec[pos] = new DateTimeVec(length ? length : 1);
|
||||
}
|
||||
|
||||
@@ -958,12 +958,12 @@ private:
|
||||
SQLINTEGER size = 16; // UUID is fixed 16 bytes
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length ? length : 1, size);
|
||||
}
|
||||
|
||||
if (_charPtrs.size() <= pos)
|
||||
_charPtrs.resize(pos + 1, 0);
|
||||
_charPtrs.resize(pos + 1, nullptr);
|
||||
|
||||
_charPtrs[pos] = (char*)std::calloc(val.size() * size, sizeof(char));
|
||||
std::size_t offset = 0;
|
||||
@@ -1015,7 +1015,7 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length, SQL_NULL_DATA);
|
||||
}
|
||||
|
||||
@@ -1030,7 +1030,7 @@ private:
|
||||
TypeInfo::sqlDataType<SQL_C_CHAR>(),
|
||||
colSize,
|
||||
decDigits,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
@@ -1057,7 +1057,7 @@ private:
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
_vecLengthIndicator.resize(pos + 1, nullptr);
|
||||
_vecLengthIndicator[pos] = new LengthVec(length, SQL_NULL_DATA);
|
||||
auto valIt = val.begin(), valEnd = val.end();
|
||||
auto lenIt = _vecLengthIndicator[pos]->begin(), lenEnd = _vecLengthIndicator[pos]->end();
|
||||
@@ -1080,7 +1080,7 @@ private:
|
||||
TypeInfo::sqlDataType<SQL_C_CHAR>(),
|
||||
colSize,
|
||||
decDigits,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ class Handle
|
||||
public:
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
_rConnection(rConnection),
|
||||
_handle(0)
|
||||
_handle(nullptr)
|
||||
/// Creates the Handle.
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
|
||||
@@ -428,7 +428,7 @@ private:
|
||||
Preparator& operator = (const Preparator&);
|
||||
|
||||
template <typename C>
|
||||
void prepareImpl(std::size_t pos, const C* pVal = 0)
|
||||
void prepareImpl(std::size_t pos, const C* pVal = nullptr)
|
||||
/// Utility function to prepare Any and Dynamic::Var.
|
||||
{
|
||||
ODBCMetaColumn col(_rStmt, pos);
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
SQLSMALLINT> TypeInfoTup;
|
||||
typedef std::vector<TypeInfoTup> TypeInfoVec;
|
||||
|
||||
explicit TypeInfo(SQLHDBC* pHDBC=0);
|
||||
explicit TypeInfo(SQLHDBC* pHDBC=nullptr);
|
||||
/// Creates the TypeInfo.
|
||||
|
||||
~TypeInfo();
|
||||
|
||||
@@ -114,7 +114,7 @@ void Binder::freeMemory()
|
||||
|
||||
void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
|
||||
{
|
||||
char* pTCVal = 0;
|
||||
char* pTCVal = nullptr;
|
||||
SQLINTEGER size = 0;
|
||||
if (transcodeRequired())
|
||||
{
|
||||
@@ -125,7 +125,7 @@ void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
|
||||
std::memcpy(pTCVal, tcVal.data(), size);
|
||||
}
|
||||
else size = static_cast<SQLINTEGER>(val.size());
|
||||
SQLPOINTER pVal = 0;
|
||||
SQLPOINTER pVal = nullptr;
|
||||
SQLINTEGER colSize = 0;
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_C_CHAR, colSize, decDigits, val.size());
|
||||
@@ -183,7 +183,7 @@ void Binder::bind(std::size_t pos, const UTF16String& val, Direction dir)
|
||||
{
|
||||
typedef UTF16String::value_type CharT;
|
||||
|
||||
SQLPOINTER pVal = 0;
|
||||
SQLPOINTER pVal = nullptr;
|
||||
SQLINTEGER size = (SQLINTEGER)(val.size() * sizeof(CharT));
|
||||
SQLINTEGER colSize = 0;
|
||||
SQLSMALLINT decDigits = 0;
|
||||
@@ -366,7 +366,7 @@ void Binder::bind(std::size_t pos, const NullData& val, Direction dir)
|
||||
if (isOutBound(dir) || !isInBound(dir))
|
||||
throw NotImplementedException("NULL parameter type can only be inbound.");
|
||||
|
||||
_inParams.insert(ParamMap::value_type(SQLPOINTER(0), SQLINTEGER(0)));
|
||||
_inParams.insert(ParamMap::value_type(SQLPOINTER(nullptr), SQLINTEGER(0)));
|
||||
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
*pLenIn = SQL_NULL_DATA;
|
||||
@@ -384,7 +384,7 @@ void Binder::bind(std::size_t pos, const NullData& val, Direction dir)
|
||||
TypeInfo::sqlDataType<SQL_C_CHAR>(),
|
||||
colSize,
|
||||
decDigits,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ bool Extractor::extractBoundImpl<UTF16String>(std::size_t pos, UTF16String& val)
|
||||
typedef UTF16String::value_type CharT;
|
||||
if (isNull(pos)) return false;
|
||||
std::size_t dataSize = _pPreparator->actualDataSize(pos);
|
||||
CharT* sp = 0;
|
||||
CharT* sp = nullptr;
|
||||
UTF16String us;
|
||||
const std::type_info& ti = _pPreparator->at(pos).type();
|
||||
if (ti == typeid(CharT*))
|
||||
|
||||
@@ -64,9 +64,9 @@ bool ODBCMetaColumn::isUnsigned() const
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLColAttribute(_rStmt,
|
||||
(SQLUSMALLINT)position() + 1, // ODBC columns are 1-based
|
||||
SQL_DESC_UNSIGNED,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
&val)))
|
||||
{
|
||||
throw StatementException(_rStmt, "ODBCMetaColumn::isUnsigned()");
|
||||
@@ -82,9 +82,9 @@ void ODBCMetaColumn::init()
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLColAttribute(_rStmt,
|
||||
(SQLUSMALLINT) position() + 1, // ODBC columns are 1-based
|
||||
SQL_DESC_LENGTH,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
&_dataLength)))
|
||||
{
|
||||
throw StatementException(_rStmt, "ODBCMetaColumn::init()");
|
||||
|
||||
@@ -92,7 +92,7 @@ void ODBCStatementImpl::compileImpl()
|
||||
Binder::ParameterBinding bind = session().getFeature("autoBind") ?
|
||||
Binder::PB_IMMEDIATE : Binder::PB_AT_EXEC;
|
||||
|
||||
const TypeInfo* pDT = 0;
|
||||
const TypeInfo* pDT = nullptr;
|
||||
try
|
||||
{
|
||||
Poco::Any dti = session().getProperty("dataTypeInfo");
|
||||
@@ -194,7 +194,7 @@ void ODBCStatementImpl::doPrepare()
|
||||
"SQLSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE)");
|
||||
}
|
||||
|
||||
AbstractPreparation::Ptr pAP = 0;
|
||||
AbstractPreparation::Ptr pAP = nullptr;
|
||||
Poco::Data::AbstractPreparator::Ptr pP = _preparations[curDataSet];
|
||||
for (std::size_t pos = 0; it != itEnd; ++it)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ void ODBCStatementImpl::execDirectImpl(const std::string& query)
|
||||
|
||||
void ODBCStatementImpl::putData()
|
||||
{
|
||||
SQLPOINTER pParam = 0;
|
||||
SQLPOINTER pParam = nullptr;
|
||||
SQLINTEGER dataSize = 0;
|
||||
SQLRETURN rc;
|
||||
|
||||
@@ -433,7 +433,7 @@ std::string ODBCStatementImpl::nativeSQL()
|
||||
|
||||
SQLINTEGER length = (SQLINTEGER) statement.size() * 2;
|
||||
|
||||
char* pNative = 0;
|
||||
char* pNative = nullptr;
|
||||
SQLINTEGER retlen = length;
|
||||
do
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
&SessionImpl::setDataTypeInfo,
|
||||
&SessionImpl::dataTypeInfo);
|
||||
|
||||
Poco::Data::ODBC::SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, 0, 0);
|
||||
Poco::Data::ODBC::SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, nullptr, 0);
|
||||
|
||||
if (!canTransact()) autoCommit("", true);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ inline Poco::Any SessionImpl::getCursorUse(const std::string&) const
|
||||
#pragma warning (disable : 4995) // ignore marked as deprecated
|
||||
#endif
|
||||
SQLUINTEGER curUse = 0;
|
||||
Poco::Data::ODBC::SQLGetConnectAttr(_db, SQL_ATTR_ODBC_CURSORS, &curUse, SQL_IS_UINTEGER, 0);
|
||||
Poco::Data::ODBC::SQLGetConnectAttr(_db, SQL_ATTR_ODBC_CURSORS, &curUse, SQL_IS_UINTEGER, nullptr);
|
||||
switch (curUse)
|
||||
{
|
||||
case SQL_CUR_USE_ODBC:
|
||||
@@ -263,7 +263,7 @@ bool SessionImpl::canTransact() const
|
||||
if (ODBC_TXN_CAPABILITY_UNKNOWN == _canTransact)
|
||||
{
|
||||
SQLUSMALLINT ret;
|
||||
checkError(Poco::Data::ODBC::SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
checkError(Poco::Data::ODBC::SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, nullptr),
|
||||
"Failed to obtain transaction capability info.");
|
||||
|
||||
_canTransact = (SQL_TC_NONE != ret) ?
|
||||
@@ -318,7 +318,7 @@ bool SessionImpl::getMultiActiveResultset(const std::string&) const
|
||||
{
|
||||
#ifdef POCO_DATA_ODBC_HAVE_SQL_SERVER_EXT
|
||||
SQLINTEGER mars;
|
||||
Poco::Data::ODBC::SQLGetConnectAttr(_db, SQL_COPT_SS_MARS_ENABLED, &mars, SQL_IS_INTEGER, 0);
|
||||
Poco::Data::ODBC::SQLGetConnectAttr(_db, SQL_COPT_SS_MARS_ENABLED, &mars, SQL_IS_INTEGER, nullptr);
|
||||
return mars == SQL_MARS_ENABLED_YES;
|
||||
#else
|
||||
return false;
|
||||
@@ -332,7 +332,7 @@ Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
||||
checkError(SQLGetConnectAttr(_db, SQL_ATTR_TXN_ISOLATION,
|
||||
&isolation,
|
||||
0,
|
||||
0));
|
||||
nullptr));
|
||||
|
||||
return transactionIsolation(isolation);
|
||||
}
|
||||
@@ -359,7 +359,7 @@ Poco::UInt32 SessionImpl::getDefaultTransactionIsolation() const
|
||||
checkError(SQLGetInfo(_db, SQL_DEFAULT_TXN_ISOLATION,
|
||||
&isolation,
|
||||
0,
|
||||
0));
|
||||
nullptr));
|
||||
|
||||
return transactionIsolation(isolation);
|
||||
}
|
||||
@@ -418,7 +418,7 @@ bool SessionImpl::isAutoCommit(const std::string&) const
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
0));
|
||||
nullptr));
|
||||
|
||||
return (0 != value);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ bool SessionImpl::isTransaction() const
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
0));
|
||||
nullptr));
|
||||
|
||||
if (0 == value) return _inTransaction;
|
||||
else return false;
|
||||
@@ -505,7 +505,7 @@ int SessionImpl::maxStatementLength() const
|
||||
SQL_MAXIMUM_STATEMENT_LENGTH,
|
||||
(SQLPOINTER) &info,
|
||||
0,
|
||||
0)))
|
||||
nullptr)))
|
||||
{
|
||||
throw ConnectionException(_db,
|
||||
"SQLGetInfo(SQL_MAXIMUM_STATEMENT_LENGTH)");
|
||||
|
||||
@@ -35,7 +35,7 @@ using Poco::format;
|
||||
using Poco::NotFoundException;
|
||||
|
||||
|
||||
Session* ODBCAccessTest::_pSession = 0;
|
||||
Session* ODBCAccessTest::_pSession = nullptr;
|
||||
std::string ODBCAccessTest::_dbConnString;
|
||||
Poco::Data::ODBC::Utility::DriverMap ODBCAccessTest::_drivers;
|
||||
|
||||
@@ -209,5 +209,5 @@ CppUnit::Test* ODBCAccessTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -681,5 +681,5 @@ CppUnit::Test* ODBCDB2Test::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -506,5 +506,5 @@ CppUnit::Test* ODBCMySQLTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1024,5 +1024,5 @@ CppUnit::Test* ODBCOracleTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -687,5 +687,5 @@ CppUnit::Test* ODBCPostgreSQLTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1211,5 +1211,5 @@ CppUnit::Test* ODBCSQLServerTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -398,5 +398,5 @@ CppUnit::Test* ODBCSQLiteTest::suite()
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1454,7 +1454,7 @@ ODBCTest::SessionPtr ODBCTest::init(const std::string& driver,
|
||||
const std::string& dbEncoding)
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
if (!canConnect(driver, dsn, uid, pwd, dbConnString, db)) return 0;
|
||||
if (!canConnect(driver, dsn, uid, pwd, dbConnString, db)) return nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1466,6 +1466,6 @@ ODBCTest::SessionPtr ODBCTest::init(const std::string& driver,
|
||||
}catch (ConnectionFailedException& ex)
|
||||
{
|
||||
std::cout << ex.displayText() << std::endl;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
SQLCHAR connectOutput[1024] = {0};
|
||||
SQLSMALLINT result;
|
||||
rc = SQLDriverConnect(hdbc
|
||||
, NULL
|
||||
, nullptr
|
||||
,(SQLCHAR*) dbConnString.c_str()
|
||||
,(SQLSMALLINT) SQL_NTS
|
||||
, connectOutput
|
||||
@@ -307,7 +307,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
0,
|
||||
(SQLPOINTER) &fourth,
|
||||
0,
|
||||
0);
|
||||
nullptr);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
@@ -319,7 +319,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
1,
|
||||
(SQLPOINTER) &fifth,
|
||||
0,
|
||||
0);
|
||||
nullptr);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
if (dateTimeColSize == 0 || dateTimeDecDigits == -1)
|
||||
@@ -354,7 +354,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
dateTimeDecDigits,
|
||||
(SQLPOINTER) &sixth,
|
||||
0,
|
||||
0);
|
||||
nullptr);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLExecute(hstmt);
|
||||
@@ -362,7 +362,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
|
||||
if (SQL_NEED_DATA == rc)
|
||||
{
|
||||
SQLPOINTER pParam = 0;
|
||||
SQLPOINTER pParam = nullptr;
|
||||
while (SQL_NEED_DATA == (rc = SQLParamData(hstmt, &pParam)))
|
||||
{
|
||||
SQLINTEGER dataSize = 0;
|
||||
@@ -600,7 +600,7 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
SQLCHAR connectOutput[512] = {0};
|
||||
SQLSMALLINT result;
|
||||
rc = SQLDriverConnect(hdbc
|
||||
, NULL
|
||||
, nullptr
|
||||
,(SQLCHAR*) dbConnString.c_str()
|
||||
,(SQLSMALLINT) SQL_NTS
|
||||
, connectOutput
|
||||
@@ -822,7 +822,7 @@ void SQLExecutor::bareboneODBCStoredFuncTest(const std::string& dbConnString,
|
||||
SQLCHAR connectOutput[1024] = { 0 };
|
||||
SQLSMALLINT result;
|
||||
rc = SQLDriverConnect(hdbc
|
||||
, NULL
|
||||
, nullptr
|
||||
, (SQLCHAR*)dbConnString.c_str()
|
||||
, (SQLSMALLINT)SQL_NTS
|
||||
, connectOutput
|
||||
@@ -944,7 +944,7 @@ void SQLExecutor::bareboneODBCStoredFuncTest(const std::string& dbConnString,
|
||||
|
||||
if (SQL_NEED_DATA == rc)
|
||||
{
|
||||
SQLPOINTER pParam = 0;
|
||||
SQLPOINTER pParam = nullptr;
|
||||
while (SQL_NEED_DATA == (rc = SQLParamData(hstmt, &pParam)))
|
||||
{
|
||||
if ((pParam != (SQLPOINTER)retVal) &&
|
||||
|
||||
@@ -428,7 +428,7 @@ private:
|
||||
//
|
||||
inline bool BinaryExtractor::isColumnNull(const OutputParameter& anOutputParameter) const
|
||||
{
|
||||
return anOutputParameter.isNull() || 0 == anOutputParameter.pData();
|
||||
return anOutputParameter.isNull() || nullptr == anOutputParameter.pData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ private:
|
||||
//
|
||||
inline bool Extractor::isColumnNull(const OutputParameter& outputParameter) const
|
||||
{
|
||||
return outputParameter.isNull() || 0 == outputParameter.pData();
|
||||
return outputParameter.isNull() || nullptr == outputParameter.pData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -194,16 +194,16 @@ inline InputParameter::InputParameter(Poco::Data::MetaColumn::ColumnDataType fie
|
||||
_pData(aDataPtr),
|
||||
_size(theSize),
|
||||
_isBinary(Poco::Data::MetaColumn::FDT_BLOB == _fieldType || Poco::Data::MetaColumn::FDT_CLOB == _fieldType),
|
||||
_pNonStringVersionRepresentation(0)
|
||||
_pNonStringVersionRepresentation(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline InputParameter::InputParameter(): _fieldType(Poco::Data::MetaColumn::FDT_UNKNOWN),
|
||||
_pData(0),
|
||||
_pData(nullptr),
|
||||
_size(0),
|
||||
_isBinary(false),
|
||||
_pNonStringVersionRepresentation(0)
|
||||
_pNonStringVersionRepresentation(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ inline bool InputParameter::isBinary() const
|
||||
|
||||
inline void InputParameter::setStringVersionRepresentation(const std::string& aString)
|
||||
{
|
||||
_pNonStringVersionRepresentation = 0;
|
||||
_pNonStringVersionRepresentation = nullptr;
|
||||
_stringVersionRepresentation = aString;
|
||||
_size = _stringVersionRepresentation.size();
|
||||
}
|
||||
@@ -281,7 +281,7 @@ inline const void* InputParameter::pInternalRepresentation() const
|
||||
|
||||
case Poco::Data::MetaColumn::FDT_UNKNOWN:
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ inline OutputParameter::OutputParameter():
|
||||
_fieldType(Poco::Data::MetaColumn::FDT_UNKNOWN),
|
||||
_internalFieldType(static_cast<Oid>(-1)),
|
||||
_rowNumber(0),
|
||||
_pData(0),
|
||||
_pData(nullptr),
|
||||
_size(0),
|
||||
_isNull(true)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ inline PQConnectionInfoOptionsFree::~PQConnectionInfoOptionsFree()
|
||||
if (_pConnectionInfoOption)
|
||||
{
|
||||
PQconninfoFree(_pConnectionInfoOption);
|
||||
_pConnectionInfoOption = 0;
|
||||
_pConnectionInfoOption = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ inline PQResultClear::~PQResultClear()
|
||||
if (_pPQResult)
|
||||
{
|
||||
PQclear(_pPQResult);
|
||||
_pPQResult = 0;
|
||||
_pPQResult = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ inline PGCancelFree::~PGCancelFree()
|
||||
if (_pPGCancel)
|
||||
{
|
||||
PQfreeCancel(_pPGCancel);
|
||||
_pPGCancel = 0;
|
||||
_pPGCancel = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ void Binder::bind(std::size_t pos, const UUID& val, Direction dir)
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
realBind(pos, Poco::Data::MetaColumn::FDT_UNKNOWN, 0, 0);
|
||||
realBind(pos, Poco::Data::MetaColumn::FDT_UNKNOWN, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ const std::string SessionHandle::POSTGRESQL_SERIALIZABLE = "SERIALIZABLE";
|
||||
|
||||
|
||||
SessionHandle::SessionHandle():
|
||||
_pConnection(0),
|
||||
_pConnection(nullptr),
|
||||
_inTransaction(false),
|
||||
_isAsynchronousCommit(false),
|
||||
_tranactionIsolationLevel(Session::TRANSACTION_READ_COMMITTED)
|
||||
@@ -86,7 +86,7 @@ void SessionHandle::connect(const std::string& aConnectionString)
|
||||
{
|
||||
// free bad connection
|
||||
PQfinish(_pConnection);
|
||||
_pConnection = 0;
|
||||
_pConnection = nullptr;
|
||||
}
|
||||
|
||||
_pConnection = PQconnectdb(aConnectionString.c_str());
|
||||
@@ -97,7 +97,7 @@ void SessionHandle::connect(const std::string& aConnectionString)
|
||||
if (_pConnection)
|
||||
{
|
||||
PQfinish(_pConnection);
|
||||
_pConnection = 0;
|
||||
_pConnection = nullptr;
|
||||
}
|
||||
throw ConnectionFailedException(msg);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void SessionHandle::disconnect()
|
||||
{
|
||||
PQfinish(_pConnection);
|
||||
|
||||
_pConnection = 0;
|
||||
_pConnection = nullptr;
|
||||
|
||||
_connectionString = std::string();
|
||||
_inTransaction= false;
|
||||
@@ -197,7 +197,7 @@ std::string SessionHandle::lastError() const
|
||||
std::string SessionHandle::lastErrorNoLock() const
|
||||
{
|
||||
// DO NOT ACQUIRE THE MUTEX IN PRIVATE METHODS
|
||||
std::string lastErrorString (0 != _pConnection ? PQerrorMessage(_pConnection) : "not connected");
|
||||
std::string lastErrorString (nullptr != _pConnection ? PQerrorMessage(_pConnection) : "not connected");
|
||||
|
||||
return lastErrorString;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ void SessionHandle::cancel()
|
||||
|
||||
PGCancelFree cancelFreer(ptrPGCancel);
|
||||
|
||||
PQcancel(ptrPGCancel, 0, 0); // no error buffer
|
||||
PQcancel(ptrPGCancel, nullptr, 0); // no error buffer
|
||||
}
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ SessionParametersMap SessionHandle::connectionParameters() const
|
||||
throw NotConnectedException();
|
||||
}
|
||||
|
||||
PQconninfoOption* ptrConnInfoOptions = 0;
|
||||
PQconninfoOption* ptrConnInfoOptions = nullptr;
|
||||
{
|
||||
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ StatementExecutor::StatementExecutor(SessionHandle& sessionHandle, bool binaryEx
|
||||
_sessionHandle(sessionHandle),
|
||||
_binaryExtraction(binaryExtraction),
|
||||
_state(STMT_INITED),
|
||||
_pResultHandle(0),
|
||||
_pResultHandle(nullptr),
|
||||
_countPlaceholdersInSQLStatement(0),
|
||||
_currentRow(0),
|
||||
_affectedRowCount(0)
|
||||
@@ -133,13 +133,13 @@ void StatementExecutor::prepare(const std::string& aSQLStatement)
|
||||
std::replace(statementName.begin(), statementName.end(), '-', 'p'); // PostgreSQL doesn't like dashes in prepared statement names
|
||||
const char* pStatementName = statementName.c_str();
|
||||
|
||||
PGresult* ptrPGResult = 0;
|
||||
PGresult* ptrPGResult = nullptr;
|
||||
|
||||
{
|
||||
Poco::FastMutex::ScopedLock mutexLocker(_sessionHandle.mutex());
|
||||
|
||||
// prepare the statement - temporary PGresult returned
|
||||
ptrPGResult = PQprepare(_sessionHandle, pStatementName, ptrCSQLStatement, (int)countPlaceholdersInSQLStatement, 0);
|
||||
ptrPGResult = PQprepare(_sessionHandle, pStatementName, ptrCSQLStatement, (int)countPlaceholdersInSQLStatement, nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -254,15 +254,15 @@ void StatementExecutor::execute()
|
||||
// clear out any result data. One way or another it is now obsolete.
|
||||
clearResults();
|
||||
|
||||
PGresult* ptrPGResult = 0;
|
||||
PGresult* ptrPGResult = nullptr;
|
||||
{
|
||||
Poco::FastMutex::ScopedLock mutexLocker(_sessionHandle.mutex());
|
||||
|
||||
ptrPGResult = PQexecPrepared(_sessionHandle,
|
||||
_preparedStatementName.c_str(), (int)_countPlaceholdersInSQLStatement,
|
||||
_inputParameterVector.size() != 0 ? &pParameterVector[ 0 ] : 0,
|
||||
_inputParameterVector.size() != 0 ? ¶meterLengthVector[ 0 ] : 0,
|
||||
_inputParameterVector.size() != 0 ? ¶meterFormatVector[ 0 ] : 0,
|
||||
_inputParameterVector.size() != 0 ? &pParameterVector[ 0 ] : nullptr,
|
||||
_inputParameterVector.size() != 0 ? ¶meterLengthVector[ 0 ] : nullptr,
|
||||
_inputParameterVector.size() != 0 ? ¶meterFormatVector[ 0 ] : nullptr,
|
||||
_binaryExtraction ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ void StatementExecutor::execute()
|
||||
{ // non Select DML statments also have an affected row count.
|
||||
// unfortunately PostgreSQL offers up this count as a char * - go figure!
|
||||
const char * pNonSelectAffectedRowCountString = PQcmdTuples(_pResultHandle);
|
||||
if (0 != pNonSelectAffectedRowCountString)
|
||||
if (nullptr != pNonSelectAffectedRowCountString)
|
||||
{
|
||||
if ( Poco::NumberParser::tryParse(pNonSelectAffectedRowCountString, affectedRowCount)
|
||||
&& affectedRowCount >= 0
|
||||
|
||||
@@ -41,8 +41,8 @@ using Poco::NamedTuple;
|
||||
using Poco::Environment;
|
||||
|
||||
|
||||
Poco::SharedPtr<Poco::Data::Session> PostgreSQLTest::_pSession = 0;
|
||||
Poco::SharedPtr<SQLExecutor> PostgreSQLTest::_pExecutor = 0;
|
||||
Poco::SharedPtr<Poco::Data::Session> PostgreSQLTest::_pSession = nullptr;
|
||||
Poco::SharedPtr<SQLExecutor> PostgreSQLTest::_pExecutor = nullptr;
|
||||
|
||||
|
||||
//
|
||||
@@ -1254,7 +1254,7 @@ CppUnit::Test* PostgreSQLTest::suite()
|
||||
catch (ConnectionFailedException& ex)
|
||||
{
|
||||
std::cout << ex.displayText() << std::endl;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::cout << "*** Connected to [" << "PostgreSQL" << "] test database." << std::endl;
|
||||
|
||||
@@ -174,13 +174,13 @@ void SQLExecutor::oidPostgreSQLTest(std::string host, std::string user, std::str
|
||||
connectionString.append("port=");
|
||||
connectionString.append(port);
|
||||
|
||||
PGconn * pConnection = 0;
|
||||
PGconn * pConnection = nullptr;
|
||||
|
||||
pConnection = PQconnectdb(connectionString.c_str());
|
||||
|
||||
assertTrue (PQstatus(pConnection) == CONNECTION_OK);
|
||||
|
||||
PGresult * pResult = 0;
|
||||
PGresult * pResult = nullptr;
|
||||
std::string sql = "DROP TABLE IF EXISTS Test";
|
||||
|
||||
pResult = PQexec(pConnection, sql.c_str());
|
||||
@@ -203,7 +203,7 @@ void SQLExecutor::oidPostgreSQLTest(std::string host, std::string user, std::str
|
||||
sql = "SELECT * FROM Test";
|
||||
std::string selectStatementName = "SELECT Statement";
|
||||
|
||||
pResult = PQprepare(pConnection, selectStatementName.c_str(), sql.c_str(), 0, 0);
|
||||
pResult = PQprepare(pConnection, selectStatementName.c_str(), sql.c_str(), 0, nullptr);
|
||||
|
||||
assertTrue (PQresultStatus(pResult) == PGRES_COMMAND_OK);
|
||||
PQclear(pResult);
|
||||
@@ -273,20 +273,20 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
connectionString.append("port=");
|
||||
connectionString.append(port);
|
||||
|
||||
PGconn * pConnection = 0;
|
||||
PGconn * pConnection = nullptr;
|
||||
|
||||
pConnection = PQconnectdb(connectionString.c_str());
|
||||
|
||||
assertTrue (PQstatus(pConnection) == CONNECTION_OK);
|
||||
|
||||
PGresult * pResult = 0;
|
||||
PGresult * pResult = nullptr;
|
||||
std::string sql = "DROP TABLE IF EXISTS Test";
|
||||
|
||||
pResult = PQexec(pConnection, sql.c_str());
|
||||
|
||||
std::cout << "Drop Table Test Result: " << PQresStatus(PQresultStatus(pResult)) << " statement: "<< sql.c_str() << std::endl;
|
||||
|
||||
assertTrue ( PQresultStatus(pResult) == PGRES_COMMAND_OK
|
||||
assertTrue (PQresultStatus(pResult) == PGRES_COMMAND_OK
|
||||
|| PQresultStatus(pResult) == PGRES_FATAL_ERROR);
|
||||
|
||||
PQclear(pResult);
|
||||
@@ -306,7 +306,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
insertStatementName.c_str(),
|
||||
sql.c_str(),
|
||||
5,
|
||||
0
|
||||
nullptr
|
||||
);
|
||||
|
||||
assertTrue (PQresultStatus(pResult) == PGRES_COMMAND_OK);
|
||||
@@ -316,7 +316,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
int fourth = ByteOrder::toNetwork((Poco::UInt32) 4);
|
||||
float fifth = 1.5;
|
||||
|
||||
const char *paramValues[5] = { 0 };
|
||||
const char *paramValues[5] = { nullptr };
|
||||
int paramLengths[5] = { 0 };
|
||||
int paramFormats[5] = { 0 };
|
||||
|
||||
@@ -364,7 +364,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
|
||||
assertTrue (PQntuples(pResult) == 1);
|
||||
|
||||
char* pSelectResult[5] = { 0 };
|
||||
char* pSelectResult[5] = { nullptr };
|
||||
int pResultLengths[5] = { 0 };
|
||||
|
||||
// column 0
|
||||
@@ -377,7 +377,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
0,
|
||||
0
|
||||
);
|
||||
assertTrue (pSelectResult[ 0 ] != 0);
|
||||
assertTrue (pSelectResult[ 0 ] != nullptr);
|
||||
assertTrue (pResultLengths[ 0 ] != 0);
|
||||
|
||||
// column 1
|
||||
@@ -390,7 +390,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
0,
|
||||
1
|
||||
);
|
||||
assertTrue (pSelectResult[ 1 ] != 0);
|
||||
assertTrue (pSelectResult[ 1 ] != nullptr);
|
||||
assertTrue (pResultLengths[ 1 ] != 0);
|
||||
|
||||
// column 2
|
||||
@@ -403,7 +403,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
0,
|
||||
2
|
||||
);
|
||||
assertTrue (pSelectResult[ 2 ] != 0);
|
||||
assertTrue (pSelectResult[ 2 ] != nullptr);
|
||||
assertTrue (pResultLengths[ 2 ] != 0);
|
||||
|
||||
// column 3
|
||||
@@ -416,7 +416,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
0,
|
||||
3
|
||||
);
|
||||
assertTrue (pSelectResult[ 3 ] != 0);
|
||||
assertTrue (pSelectResult[ 3 ] != nullptr);
|
||||
assertTrue (pResultLengths[ 3 ] != 0);
|
||||
|
||||
// column 4
|
||||
@@ -429,7 +429,7 @@ void SQLExecutor::barebonePostgreSQLTest(std::string host, std::string user, std
|
||||
0,
|
||||
4
|
||||
);
|
||||
assertTrue (pSelectResult[ 4 ] != 0);
|
||||
assertTrue (pSelectResult[ 4 ] != nullptr);
|
||||
assertTrue (pResultLengths[ 4 ] != 0);
|
||||
|
||||
/*
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
static CBMap retMap;
|
||||
T* pRet = reinterpret_cast<T*>(eventHookRegister(pDB, callbackFn, pParam));
|
||||
|
||||
if (pRet == 0)
|
||||
if (pRet == nullptr)
|
||||
{
|
||||
if (retMap.find(pDB) == retMap.end())
|
||||
{
|
||||
@@ -161,8 +161,8 @@ public:
|
||||
CBMapItPair retMapRange = retMap.equal_range(pDB);
|
||||
for (CBMapIt it = retMapRange.first; it != retMapRange.second; ++it)
|
||||
{
|
||||
poco_assert (it->second.first != 0);
|
||||
if ((callbackFn == 0) && (*pRet == *it->second.second))
|
||||
poco_assert (it->second.first != nullptr);
|
||||
if ((callbackFn == nullptr) && (*pRet == *it->second.second))
|
||||
{
|
||||
retMap.erase(it);
|
||||
return true;
|
||||
|
||||
@@ -69,7 +69,7 @@ bool Notifier::disableUpdate()
|
||||
{
|
||||
Poco::Mutex::ScopedLock l(_mutex);
|
||||
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::UpdateCallbackType) 0, this))
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::UpdateCallbackType) nullptr, this))
|
||||
_enabledEvents &= ~SQLITE_NOTIFY_UPDATE;
|
||||
|
||||
return !updateEnabled();
|
||||
@@ -97,7 +97,7 @@ bool Notifier::disableCommit()
|
||||
{
|
||||
Poco::Mutex::ScopedLock l(_mutex);
|
||||
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::CommitCallbackType) 0, this))
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::CommitCallbackType) nullptr, this))
|
||||
_enabledEvents &= ~SQLITE_NOTIFY_COMMIT;
|
||||
|
||||
return !commitEnabled();
|
||||
@@ -125,7 +125,7 @@ bool Notifier::disableRollback()
|
||||
{
|
||||
Poco::Mutex::ScopedLock l(_mutex);
|
||||
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::RollbackCallbackType) 0, this))
|
||||
if (Utility::registerUpdateHandler(Utility::dbHandle(_session), (Utility::RollbackCallbackType) nullptr, this))
|
||||
_enabledEvents &= ~SQLITE_NOTIFY_ROLLBACK;
|
||||
|
||||
return !rollbackEnabled();
|
||||
|
||||
@@ -32,7 +32,7 @@ const int SQLiteStatementImpl::POCO_SQLITE_INV_ROW_CNT = -1;
|
||||
SQLiteStatementImpl::SQLiteStatementImpl(Poco::Data::SessionImpl& rSession, sqlite3* pDB):
|
||||
StatementImpl(rSession),
|
||||
_pDB(pDB),
|
||||
_pStmt(0),
|
||||
_pStmt(nullptr),
|
||||
_stepCalled(false),
|
||||
_nextResponse(0),
|
||||
_affectedRowCount(POCO_SQLITE_INV_ROW_CNT),
|
||||
@@ -66,14 +66,14 @@ void SQLiteStatementImpl::compileImpl()
|
||||
|
||||
std::string statement(toString());
|
||||
|
||||
sqlite3_stmt* pStmt = 0;
|
||||
sqlite3_stmt* pStmt = nullptr;
|
||||
const char* pSql = _pLeftover ? _pLeftover->c_str() : statement.c_str();
|
||||
|
||||
if (0 == std::strlen(pSql))
|
||||
throw InvalidSQLStatementException("Empty statements are illegal");
|
||||
|
||||
int rc = SQLITE_OK;
|
||||
const char* pLeftover = 0;
|
||||
const char* pLeftover = nullptr;
|
||||
bool queryFound = false;
|
||||
|
||||
do
|
||||
@@ -82,7 +82,7 @@ void SQLiteStatementImpl::compileImpl()
|
||||
if (rc != SQLITE_OK)
|
||||
{
|
||||
if (pStmt) sqlite3_finalize(pStmt);
|
||||
pStmt = 0;
|
||||
pStmt = nullptr;
|
||||
std::string errMsg = sqlite3_errmsg(_pDB);
|
||||
Utility::throwException(_pDB, rc, errMsg);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void SQLiteStatementImpl::bindImpl()
|
||||
{
|
||||
_stepCalled = false;
|
||||
_nextResponse = 0;
|
||||
if (_pStmt == 0) return;
|
||||
if (_pStmt == nullptr) return;
|
||||
|
||||
sqlite3_reset(_pStmt);
|
||||
|
||||
@@ -217,9 +217,9 @@ void SQLiteStatementImpl::clear()
|
||||
if (_pStmt)
|
||||
{
|
||||
sqlite3_finalize(_pStmt);
|
||||
_pStmt=0;
|
||||
_pStmt=nullptr;
|
||||
}
|
||||
_pLeftover = 0;
|
||||
_pLeftover = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ bool SQLiteStatementImpl::hasNext()
|
||||
return (_nextResponse == SQLITE_ROW);
|
||||
|
||||
// _pStmt is allowed to be null for conditional SQL statements
|
||||
if (_pStmt == 0)
|
||||
if (_pStmt == nullptr)
|
||||
{
|
||||
_stepCalled = true;
|
||||
_nextResponse = SQLITE_DONE;
|
||||
@@ -305,7 +305,7 @@ const MetaColumn& SQLiteStatementImpl::metaColumn(std::size_t pos) const
|
||||
int SQLiteStatementImpl::affectedRowCount() const
|
||||
{
|
||||
if (_affectedRowCount != POCO_SQLITE_INV_ROW_CNT) return _affectedRowCount;
|
||||
return _pStmt == 0 || sqlite3_stmt_readonly(_pStmt) ? 0 : sqlite3_changes(_pDB);
|
||||
return _pStmt == nullptr || sqlite3_stmt_readonly(_pStmt) ? 0 : sqlite3_changes(_pDB);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ Utility::TypeMap Utility::_types;
|
||||
Poco::Mutex Utility::_mutex;
|
||||
|
||||
|
||||
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex((pDB) ? sqlite3_db_mutex(pDB) : 0)
|
||||
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex((pDB) ? sqlite3_db_mutex(pDB) : nullptr)
|
||||
{
|
||||
if (_pMutex)
|
||||
sqlite3_mutex_enter(_pMutex);
|
||||
@@ -256,7 +256,7 @@ bool Utility::fileToMemory(sqlite3* pInMemory, const std::string& fileName)
|
||||
|
||||
// Note: SQLITE_OPEN_READWRITE is required to correctly handle an existing hot journal.
|
||||
// See #3135
|
||||
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI, NULL);
|
||||
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI, nullptr);
|
||||
if(rc == SQLITE_OK )
|
||||
{
|
||||
pBackup = sqlite3_backup_init(pInMemory, "main", pFile, "main");
|
||||
@@ -279,7 +279,7 @@ bool Utility::memoryToFile(const std::string& fileName, sqlite3* pInMemory)
|
||||
sqlite3* pFile;
|
||||
sqlite3_backup* pBackup;
|
||||
|
||||
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, NULL);
|
||||
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, nullptr);
|
||||
if(rc == SQLITE_OK )
|
||||
{
|
||||
pBackup = sqlite3_backup_init(pFile, "main", pInMemory, "main");
|
||||
|
||||
@@ -476,7 +476,7 @@ void SQLiteTest::testNullCharPointer()
|
||||
|
||||
try
|
||||
{
|
||||
const char* pc = 0;
|
||||
const char* pc = nullptr;
|
||||
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)",
|
||||
bind("lastname"),
|
||||
bind("firstname"),
|
||||
@@ -506,7 +506,7 @@ void SQLiteTest::testInsertCharPointer()
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
|
||||
|
||||
const char* pc = 0;
|
||||
const char* pc = nullptr;
|
||||
try
|
||||
{
|
||||
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", bind(pc), now;
|
||||
@@ -522,7 +522,7 @@ void SQLiteTest::testInsertCharPointer()
|
||||
bind("Address"),
|
||||
bind(133132));
|
||||
|
||||
std::free((void*) pc); pc = 0;
|
||||
std::free((void*) pc); pc = nullptr;
|
||||
assertTrue (1 == stmt.execute());
|
||||
|
||||
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
|
||||
@@ -3005,7 +3005,7 @@ void SQLiteTest::testUpdateCallback()
|
||||
assertTrue (_deleteCounter == 1);
|
||||
|
||||
// disarm callback and do the same drill
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::UpdateCallbackType) 0, &val));
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::UpdateCallbackType) nullptr, &val));
|
||||
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
|
||||
@@ -3074,7 +3074,7 @@ void SQLiteTest::testCommitCallback()
|
||||
tmp.commit();
|
||||
assertTrue (val == 2);
|
||||
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::CommitCallbackType) 0, &val));
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::CommitCallbackType) nullptr, &val));
|
||||
val = 0;
|
||||
tmp.begin();
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
@@ -3115,7 +3115,7 @@ void SQLiteTest::testRollbackCallback()
|
||||
tmp.rollback();
|
||||
assertTrue (val == 2);
|
||||
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::RollbackCallbackType) 0, &val));
|
||||
assertTrue (Utility::registerUpdateHandler(tmp, (Utility::RollbackCallbackType) nullptr, &val));
|
||||
val = 0;
|
||||
tmp.begin();
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
/// If the LOB is empty, returns NULL.
|
||||
{
|
||||
if (_pContent->empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return _pContent->data();
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
/// If the LOB is empty, returns NULL.
|
||||
{
|
||||
if (_pContent->empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return _pContent->data();
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
val.assign(_val.begin(), _val.end());
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
@@ -332,7 +332,7 @@ public:
|
||||
val.assign(_val.begin(), _val.end());
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
|
||||
@@ -78,12 +78,12 @@ public:
|
||||
static const std::size_t UNKNOWN_TOTAL_ROW_COUNT;
|
||||
|
||||
explicit RecordSet(const Statement& rStatement,
|
||||
RowFormatter::Ptr pRowFormatter = 0);
|
||||
RowFormatter::Ptr pRowFormatter = nullptr);
|
||||
/// Creates the RecordSet.
|
||||
|
||||
RecordSet(Session& rSession,
|
||||
const std::string& query,
|
||||
RowFormatter::Ptr pRowFormatter = 0);
|
||||
RowFormatter::Ptr pRowFormatter = nullptr);
|
||||
/// Creates the RecordSet.
|
||||
|
||||
RecordSet(Session& rSession,
|
||||
|
||||
@@ -82,12 +82,12 @@ public:
|
||||
/// Creates the Row.
|
||||
|
||||
Row(NameVecPtr pNames,
|
||||
const RowFormatter::Ptr& pFormatter = 0);
|
||||
const RowFormatter::Ptr& pFormatter = nullptr);
|
||||
/// Creates the Row.
|
||||
|
||||
Row(NameVecPtr pNames,
|
||||
const SortMapPtr& pSortMap,
|
||||
const RowFormatter::Ptr& pFormatter = 0);
|
||||
const RowFormatter::Ptr& pFormatter = nullptr);
|
||||
/// Creates the Row.
|
||||
|
||||
~Row();
|
||||
@@ -200,14 +200,14 @@ public:
|
||||
const ValueVec& values() const;
|
||||
/// Returns the const reference to values vector.
|
||||
|
||||
void setFormatter(const RowFormatter::Ptr& pFormatter = 0);
|
||||
void setFormatter(const RowFormatter::Ptr& pFormatter = nullptr);
|
||||
/// Sets the formatter for this row and takes the
|
||||
/// shared ownership of it.
|
||||
|
||||
const RowFormatter& getFormatter() const;
|
||||
/// Returns the reference to the formatter.
|
||||
|
||||
void setSortMap(const SortMapPtr& pSortMap = 0);
|
||||
void setSortMap(const SortMapPtr& pSortMap = nullptr);
|
||||
/// Adds the sorting fields entry and takes the
|
||||
/// shared ownership of it.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Data_API Transaction
|
||||
/// See Transaction for more details and purpose of this template.
|
||||
{
|
||||
public:
|
||||
Transaction(Poco::Data::Session& session, Poco::Logger* pLogger = 0);
|
||||
Transaction(Poco::Data::Session& session, Poco::Logger* pLogger = nullptr);
|
||||
/// Creates the Transaction and starts it, using the given database session and logger.
|
||||
|
||||
Transaction(Poco::Data::Session& session, bool start);
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/// to start the transaction.
|
||||
|
||||
template <typename T>
|
||||
Transaction(Poco::Data::Session& rSession, T& t, Poco::Logger* pLogger = 0):
|
||||
Transaction(Poco::Data::Session& rSession, T& t, Poco::Logger* pLogger = nullptr):
|
||||
_rSession(rSession),
|
||||
_pLogger(pLogger)
|
||||
/// Creates the Transaction, using the given database session, transactor and logger.
|
||||
|
||||
@@ -88,7 +88,7 @@ class WebSocketRequestHandler: public HTTPRequestHandler
|
||||
/// Handler for the WebSocket connection.
|
||||
{
|
||||
public:
|
||||
WebSocketRequestHandler() : _pWS(0), _flags(0)
|
||||
WebSocketRequestHandler() : _pWS(nullptr), _flags(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class RequestHandlerFactory: public HTTPRequestHandlerFactory
|
||||
/// Web request handler factory.
|
||||
{
|
||||
public:
|
||||
RequestHandlerFactory() : _pHandler(0)
|
||||
RequestHandlerFactory() : _pHandler(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
if (uri != "/favicon.ico")
|
||||
std::cout << "Unknown URI: " << uri << std::endl;
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebSocketRequestHandler& handler()
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Data {
|
||||
AbstractBinding::AbstractBinding(const std::string& name,
|
||||
Direction direction,
|
||||
Poco::UInt32 bulkSize):
|
||||
_pBinder(0),
|
||||
_pBinder(nullptr),
|
||||
_name(name),
|
||||
_direction(direction),
|
||||
_bulkSize(bulkSize)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Data {
|
||||
AbstractExtraction::AbstractExtraction(Poco::UInt32 limit,
|
||||
Poco::UInt32 position,
|
||||
bool bulk):
|
||||
_pExtractor(0),
|
||||
_pExtractor(nullptr),
|
||||
_limit(limit),
|
||||
_position(position),
|
||||
_bulk(bulk),
|
||||
|
||||
@@ -130,9 +130,9 @@ RecordSet& RecordSet::operator = (RecordSet&& other) noexcept
|
||||
void RecordSet::reset(const Statement& stmt)
|
||||
{
|
||||
delete _pBegin;
|
||||
_pBegin = 0;
|
||||
_pBegin = nullptr;
|
||||
delete _pEnd;
|
||||
_pEnd = 0;
|
||||
_pEnd = nullptr;
|
||||
_currentRow = 0;
|
||||
_totalRowCount = UNKNOWN_TOTAL_ROW_COUNT;
|
||||
|
||||
@@ -473,7 +473,7 @@ Row& RecordSet::row(std::size_t pos)
|
||||
throw RangeException("Invalid recordset row requested.");
|
||||
|
||||
RowMap::const_iterator it = _rowMap.find(pos);
|
||||
Row* pRow = 0;
|
||||
Row* pRow = nullptr;
|
||||
std::size_t columns = columnCount();
|
||||
if (it == _rowMap.end())
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ std::ostream& operator << (std::ostream &os, const Row& row)
|
||||
|
||||
|
||||
Row::Row():
|
||||
_pNames(0),
|
||||
_pNames(nullptr),
|
||||
_pSortMap(new SortMap),
|
||||
_pFormatter(new SimpleRowFormatter)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ Row::Row(NameVecPtr pNames,
|
||||
const RowFormatter::Ptr& pFormatter): _pNames(pNames)
|
||||
{
|
||||
if (!_pNames) throw NullPointerException();
|
||||
init(0, pFormatter);
|
||||
init(nullptr, pFormatter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ RowFilter::RowFilter(RecordSet* pRecordSet): _pRecordSet(pRecordSet), _not(false
|
||||
}
|
||||
|
||||
|
||||
RowFilter::RowFilter(Ptr pParent, LogicOperator op): _pRecordSet(0),
|
||||
RowFilter::RowFilter(Ptr pParent, LogicOperator op): _pRecordSet(nullptr),
|
||||
_pParent(pParent),
|
||||
_not(false)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ RowFilter::~RowFilter()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_pRecordSet) _pRecordSet->filter(0);
|
||||
if (_pRecordSet) _pRecordSet->filter(nullptr);
|
||||
if (_pParent && _pParent->has(this))
|
||||
_pParent->removeFilter(this);
|
||||
release();
|
||||
@@ -89,7 +89,7 @@ bool RowFilter::isAllowed(std::size_t row) const
|
||||
if (_comparisonMap.find(name) == _comparisonMap.end()) continue;
|
||||
|
||||
Poco::Dynamic::Var ret;
|
||||
CompT compOp = 0;
|
||||
CompT compOp = nullptr;
|
||||
Poco::Dynamic::Var val = rs.value(col, row, false);
|
||||
|
||||
switch (it->second.get<1>())
|
||||
@@ -180,8 +180,8 @@ void RowFilter::removeFilter(Ptr pFilter)
|
||||
|
||||
_pRecordSet->moveFirst();
|
||||
_filterMap.erase(pFilter);
|
||||
pFilter->_pRecordSet = 0;
|
||||
pFilter->_pParent = 0;
|
||||
pFilter->_pRecordSet = nullptr;
|
||||
pFilter->_pParent = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Transaction::Transaction(Poco::Data::Session& rSession, Poco::Logger* pLogger):
|
||||
|
||||
Transaction::Transaction(Poco::Data::Session& rSession, bool start):
|
||||
_rSession(rSession),
|
||||
_pLogger(0)
|
||||
_pLogger(nullptr)
|
||||
{
|
||||
if (start) begin();
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ SessionImpl::SessionImpl(const std::string& init, std::size_t timeout):
|
||||
_connected(true)
|
||||
{
|
||||
addFeature("f1", &SessionImpl::setF, &SessionImpl::getF);
|
||||
addFeature("f2", 0, &SessionImpl::getF);
|
||||
addFeature("f3", &SessionImpl::setF, 0);
|
||||
addFeature("f2", nullptr, &SessionImpl::getF);
|
||||
addFeature("f3", &SessionImpl::setF, nullptr);
|
||||
addFeature("throwOnHasNext", &SessionImpl::setThrowOnHasNext, &SessionImpl::getThrowOnHasNext);
|
||||
addFeature("connected", &SessionImpl::setConnected, &SessionImpl::getConnected);
|
||||
addProperty("p1", &SessionImpl::setP, &SessionImpl::getP);
|
||||
addProperty("p2", 0, &SessionImpl::getP);
|
||||
addProperty("p2", nullptr, &SessionImpl::getP);
|
||||
addProperty("p3", &SessionImpl::setP, &SessionImpl::getP);
|
||||
setDBMSName("Test");
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/Net/HTTPStreamFactory.h"
|
||||
#include "Poco/Net/FTPStreamFactory.h"
|
||||
#include <iostream>
|
||||
@@ -367,7 +366,7 @@ const std::string TextEncodingCompiler::IMPL_TEMPLATE(
|
||||
"const char* ${CLASS}::_names[] =\n"
|
||||
"{\n"
|
||||
"${ENCODING_NAMES}"
|
||||
" NULL\n"
|
||||
" nullptr\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"\n"
|
||||
|
||||
@@ -65,7 +65,7 @@ protected:
|
||||
/// {
|
||||
/// "myencoding",
|
||||
/// "MyEncoding",
|
||||
/// NULL
|
||||
/// nullptr
|
||||
/// };
|
||||
///
|
||||
/// The first entry in names must be the canonical name.
|
||||
|
||||
@@ -23,7 +23,7 @@ const char* ISO8859_10Encoding::_names[] =
|
||||
"ISO-8859-10",
|
||||
"Latin6",
|
||||
"Latin-6",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Poco {
|
||||
const char* ISO8859_11Encoding::_names[] =
|
||||
{
|
||||
"ISO-8859-11",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user