BIND 10 trac2369, updated. 0dd898f80907bcb0180858a3a1b2811c803012a9 [2369] Use createSreamName() from #2371 instead of using sprintf()

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 31 07:34:18 UTC 2012


The branch, trac2369 has been updated
       via  0dd898f80907bcb0180858a3a1b2811c803012a9 (commit)
      from  ba71154440e841836726bbc6b9088f095d14f7d1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0dd898f80907bcb0180858a3a1b2811c803012a9
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Oct 31 13:04:03 2012 +0530

    [2369] Use createSreamName() from #2371 instead of using sprintf()

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/inputsource.cc |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/inputsource.cc b/src/lib/dns/inputsource.cc
index f52f493..051705b 100644
--- a/src/lib/dns/inputsource.cc
+++ b/src/lib/dns/inputsource.cc
@@ -14,25 +14,29 @@
 
 #include <dns/inputsource.h>
 
-#include <cstdio>
-
-using namespace std;
-
 namespace isc {
 namespace dns {
 namespace master_lexer_internal {
 
+namespace { // unnamed namespace
+
+std::string
+createStreamName(std::istream& input_stream) {
+     std::stringstream ss;
+     ss << "stream-" << &input_stream;
+     return (ss.str());
+}
+
+} // end of unnamed namespace
+
 InputSource::InputSource(std::istream& input_stream) :
     at_eof_(false),
     line_(1),
     saved_line_(line_),
     buffer_pos_(buffer_.size()),
+    name_(createStreamName(input_stream)),
     input_(input_stream)
-{
-    char buf[FILENAME_MAX];
-    snprintf(buf, sizeof(buf), "stream-%p", &input_stream);
-    name_ = buf;
-}
+{}
 
 InputSource::InputSource(const char* filename) :
     at_eof_(false),
@@ -42,7 +46,7 @@ InputSource::InputSource(const char* filename) :
     name_(filename),
     input_(file_stream_)
 {
-    file_stream_.open(filename, fstream::in);
+    file_stream_.open(filename, std::fstream::in);
 }
 
 InputSource::~InputSource()



More information about the bind10-changes mailing list