]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2098] make sure unexpected method call doesn't happen by exception/assert
authorJINMEI Tatuya <jinmei@isc.org>
Thu, 30 Aug 2012 23:58:34 +0000 (16:58 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Thu, 30 Aug 2012 23:58:34 +0000 (16:58 -0700)
src/lib/datasrc/memory/rdata_serialization.cc
src/lib/dns/benchmarks/message_renderer_bench.cc
src/lib/dns/benchmarks/oldmessagerenderer.cc

index 6c3e06c35b245eae79146dbe8bbf61cf9890ba00..6ac18d0e6a802ca72dca24ad9c5b31659c04a02e 100644 (file)
@@ -250,6 +250,7 @@ public:
     virtual void setCompressMode(CompressMode) {}
     virtual void writeName(const LabelSequence&, bool) {
         // We don't need this version of writeName
+        isc_throw(Unexpected, "unexpected version of writeName is called");
     }
 
     // Called for each domain name in the RDATA, from the RDATA's toWire()
index 752b1f664c72e7258c2fe3035ee9399a349e6ee1..6376498087a16e3d74035758d86bae1965228b2a 100644 (file)
@@ -116,7 +116,11 @@ public:
     virtual void writeName(const Name& name, const bool = false) {
         name.toWire(getBuffer());
     }
-    virtual void writeName(const LabelSequence&, const bool) {} // unused
+    virtual void writeName(const LabelSequence&, const bool) {
+        // We shouldn't use this version of writeName (and we internally
+        // control it, so we simply assert it here)
+        assert(false);
+    }
 };
 
 void
index a6c7990115a98d9247c9765c448bace21798041a..ed575a083fc6f42bc3414244551bac4cd1cbc5ec 100644 (file)
@@ -277,7 +277,9 @@ OldMessageRenderer::writeName(const Name& name, const bool compress) {
 
 void
 OldMessageRenderer::writeName(const LabelSequence&, const bool) {
-    // we don't use this mode for the benchmark
+    // We shouldn't use this version of writeName (and we internally
+    // control it, so we simply assert it here)
+    assert(false);
 }
 
 }