From 8156766fe373ea43c941adfe179a4b60abe3997e Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 27 Nov 2010 14:29:28 +0100 Subject: [PATCH] Another Clang report. * iface/nips/nips.cc (format_state): Do not use a variable-sized array, this is not allowed in C++. --- ChangeLog | 7 +++++++ iface/nips/nips.cc | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b932da60e..9b23b5e6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-11-27 Alexandre Duret-Lutz + + Another Clang report. + + * iface/nips/nips.cc (format_state): Do not use a variable-sized + array, this is not allowed in C++. + 2010-11-27 Alexandre Duret-Lutz Fix more errors reported by Clang. diff --git a/iface/nips/nips.cc b/iface/nips/nips.cc index d80596ea9..5dc4a8263 100644 --- a/iface/nips/nips.cc +++ b/iface/nips/nips.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2008 Laboratoire de Recherche et DĂ©veloppement +// Copyright (C) 2008, 2010 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -339,11 +339,14 @@ namespace spot { const state_nips* s = dynamic_cast(state); unsigned size = global_state_to_str(s->get_state(), 0, 0, 0); - char buf[size]; + char* buf = new char[size]; global_state_to_str(s->get_state(), 0, buf, size); - return std::string(buf); + std::string res(buf); + delete buf; + + return res; } bdd