mirror of
https://github.com/qpdf/qpdf.git
synced 2024-09-28 04:59:05 +00:00
6b9297882e
Put a specific comment marker next to every piece of code that MSVC gives warning 4996 for. This warning is generated for calls to functions that Microsoft considers insecure or deprecated. This change is in preparation for fixing all these cases even though none of them are actually incorrect or insecure as used in qpdf. The comment marker makes them easier to find so they can be fixed in subsequent commits.
46 lines
906 B
C++
46 lines
906 B
C++
#include <qpdf/QTC.hh>
|
|
|
|
#include <set>
|
|
#include <stdio.h>
|
|
#include <qpdf/QUtil.hh>
|
|
|
|
static bool tc_active(char const* const scope)
|
|
{
|
|
std::string value;
|
|
return (QUtil::get_env("TC_SCOPE", &value) && (value == scope));
|
|
}
|
|
|
|
void QTC::TC(char const* const scope, char const* const ccase, int n)
|
|
{
|
|
static std::set<std::pair<std::string, int> > cache;
|
|
|
|
if (! tc_active(scope))
|
|
{
|
|
return;
|
|
}
|
|
|
|
std::string filename;
|
|
#ifdef _WIN32
|
|
# define TC_ENV "TC_WIN_FILENAME"
|
|
#else
|
|
# define TC_ENV "TC_FILENAME"
|
|
#endif
|
|
if (! QUtil::get_env(TC_ENV, &filename))
|
|
{
|
|
return;
|
|
}
|
|
#undef TC_ENV
|
|
|
|
if (cache.count(std::make_pair(ccase, n)))
|
|
{
|
|
return;
|
|
}
|
|
cache.insert(std::make_pair(ccase, n));
|
|
|
|
FILE* tc =
|
|
QUtil::fopen_wrapper("open test coverage file (" + filename + ")",
|
|
fopen(filename.c_str(), "ab")); // XXXX
|
|
fprintf(tc, "%s %d\n", ccase, n);
|
|
fclose(tc);
|
|
}
|