From 6b9297882e0106b5c0af53320673d6341b9bea91 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 28 Feb 2013 15:47:48 -0500 Subject: Mark secure CRT warnings with comment 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. --- libqpdf/FileInputSource.cc | 2 +- libqpdf/MD5.cc | 2 +- libqpdf/Pl_ASCIIHexDecoder.cc | 4 ++-- libqpdf/Pl_StdioFile.cc | 2 +- libqpdf/QPDFWriter.cc | 2 +- libqpdf/QPDF_String.cc | 2 +- libqpdf/QTC.cc | 2 +- libqpdf/QUtil.cc | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/FileInputSource.cc b/libqpdf/FileInputSource.cc index b49fad99..0cd0ef96 100644 --- a/libqpdf/FileInputSource.cc +++ b/libqpdf/FileInputSource.cc @@ -16,7 +16,7 @@ FileInputSource::setFilename(char const* filename) this->filename = filename; this->close_file = true; this->file = QUtil::fopen_wrapper(std::string("open ") + this->filename, - fopen(this->filename.c_str(), "rb")); + fopen(this->filename.c_str(), "rb")); // XXXX } void diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index 73ba7f9f..ff812f35 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -330,7 +330,7 @@ void MD5::encodeFile(char const *filename, int up_to_size) FILE *file = QUtil::fopen_wrapper( std::string("MD5: open ") + filename, - fopen(filename, "rb")); + fopen(filename, "rb")); // XXXX size_t len; int so_far = 0; diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 0ba85dc7..059f85a7 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -9,7 +9,7 @@ Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : pos(0), eod(false) { - strcpy(this->inbuf, "00"); + strcpy(this->inbuf, "00"); // XXXX } Pl_ASCIIHexDecoder::~Pl_ASCIIHexDecoder() @@ -98,7 +98,7 @@ Pl_ASCIIHexDecoder::flush() getNext()->write(&ch, 1); this->pos = 0; - strcpy(this->inbuf, "00"); + strcpy(this->inbuf, "00"); // XXXX } void diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc index bd56ac61..808177d0 100644 --- a/libqpdf/Pl_StdioFile.cc +++ b/libqpdf/Pl_StdioFile.cc @@ -37,7 +37,7 @@ Pl_StdioFile::write(unsigned char* buf, size_t len) void Pl_StdioFile::finish() { - if (fileno(this->file) != -1) + if (fileno(this->file) != -1) // XXXX { fflush(this->file); } diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 6384df54..96f50c13 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -105,7 +105,7 @@ QPDFWriter::setOutputFilename(char const* filename) { QTC::TC("qpdf", "QPDFWriter write to file"); f = QUtil::fopen_wrapper(std::string("open ") + filename, - fopen(filename, "wb+")); + fopen(filename, "wb+")); // XXXX close_file = true; } setOutputFile(description, f, close_file); diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc index db6fb2f5..b4d6b630 100644 --- a/libqpdf/QPDF_String.cc +++ b/libqpdf/QPDF_String.cc @@ -140,7 +140,7 @@ QPDF_String::unparse(bool force_binary) } else { - sprintf(num, "\\%03o", static_cast(ch)); + sprintf(num, "\\%03o", static_cast(ch)); // XXXX result += num; } break; diff --git a/libqpdf/QTC.cc b/libqpdf/QTC.cc index d0f3e11f..c1d863e6 100644 --- a/libqpdf/QTC.cc +++ b/libqpdf/QTC.cc @@ -39,7 +39,7 @@ void QTC::TC(char const* const scope, char const* const ccase, int n) FILE* tc = QUtil::fopen_wrapper("open test coverage file (" + filename + ")", - fopen(filename.c_str(), "ab")); + fopen(filename.c_str(), "ab")); // XXXX fprintf(tc, "%s %d\n", ccase, n); fclose(tc); } diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 967e832c..5c92613a 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -84,7 +84,7 @@ QUtil::unsigned_char_pointer(char const* str) void QUtil::throw_system_error(std::string const& description) { - throw std::runtime_error(description + ": " + strerror(errno)); + throw std::runtime_error(description + ": " + strerror(errno)); // XXXX } int @@ -159,7 +159,7 @@ QUtil::hex_encode(std::string const& input) buf[hex_size - 1] = '\0'; for (unsigned int i = 0; i < input_size; ++i) { - sprintf(buf + i * 2, "%02x", static_cast(input[i])); + sprintf(buf + i * 2, "%02x", static_cast(input[i])); // XXXX } return buf; } -- cgit v1.2.3-54-g00ecf