Re: [PATCH spice-streaming-agent] Remove using entire std namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Thu, 2018-02-08 at 16:21 +0000, Frediano Ziglio wrote:
> > As discussed about style the usage or "using namespace" should be
> > avoided.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  src/concrete-agent.cpp        | 11 +++++------
> >  src/mjpeg-fallback.cpp        |  3 +--
> >  src/spice-streaming-agent.cpp |  5 ++---
> >  3 files changed, 8 insertions(+), 11 deletions(-)
> > 
> > diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
> > index ebeef33..891c09b 100644
> > --- a/src/concrete-agent.cpp
> > +++ b/src/concrete-agent.cpp
> > @@ -13,7 +13,6 @@
> >  #include "concrete-agent.hpp"
> >  #include "static-plugin.hpp"
> >  
> > -using namespace std;
> >  using namespace spice::streaming_agent;
> >  
> >  static inline unsigned MajorVersion(unsigned version)
> > @@ -40,7 +39,7 @@ bool ConcreteAgent::PluginVersionIsCompatible(unsigned
> > pluginVersion) const
> >  
> >  void ConcreteAgent::Register(Plugin& plugin)
> >  {
> > -    plugins.push_back(shared_ptr<Plugin>(&plugin));
> > +    plugins.push_back(std::shared_ptr<Plugin>(&plugin));
> >  }
> >  
> >  const ConfigureOption* ConcreteAgent::Options() const
> > @@ -56,11 +55,11 @@ void ConcreteAgent::AddOption(const char *name, const
> > char *value)
> >      options.insert(--options.end(), ConcreteConfigureOption(name, value));
> >  }
> >  
> > -void ConcreteAgent::LoadPlugins(const string &directory)
> > +void ConcreteAgent::LoadPlugins(const std::string &directory)
> >  {
> >      StaticPlugin::InitAll(*this);
> >  
> > -    string pattern = directory + "/*.so";
> > +    std::string pattern = directory + "/*.so";
> >      glob_t globbuf;
> >  
> >      int glob_result = glob(pattern.c_str(), 0, NULL, &globbuf);
> > @@ -77,7 +76,7 @@ void ConcreteAgent::LoadPlugins(const string &directory)
> >      globfree(&globbuf);
> >  }
> >  
> > -void ConcreteAgent::LoadPlugin(const string &plugin_filename)
> > +void ConcreteAgent::LoadPlugin(const std::string &plugin_filename)
> >  {
> >      void *dl = dlopen(plugin_filename.c_str(), RTLD_LOCAL|RTLD_NOW);
> >      if (!dl) {
> > @@ -101,7 +100,7 @@ void ConcreteAgent::LoadPlugin(const string
> > &plugin_filename)
> >  
> >  FrameCapture *ConcreteAgent::GetBestFrameCapture(const
> >  std::set<SpiceVideoCodecType>& codecs)
> >  {
> > -    vector<pair<unsigned, shared_ptr<Plugin>>> sorted_plugins;
> > +    std::vector<std::pair<unsigned, std::shared_ptr<Plugin>>>
> > sorted_plugins;
> >  
> >      // sort plugins base on ranking, reverse order
> >      for (const auto& plugin: plugins) {
> > diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> > index 10543ad..74682f3 100644
> > --- a/src/mjpeg-fallback.cpp
> > +++ b/src/mjpeg-fallback.cpp
> > @@ -18,7 +18,6 @@
> >  #include "static-plugin.hpp"
> >  #include "jpeg.hpp"
> >  
> > -using namespace std;
> >  using namespace spice::streaming_agent;
> >  
> >  #define ERROR(args) do { \
> > @@ -55,7 +54,7 @@ private:
> >      MjpegSettings settings;
> >      Display *dpy;
> >  
> > -    vector<uint8_t> frame;
> > +    std::vector<uint8_t> frame;
> >  
> >      // last frame sizes
> >      uint32_t last_width = ~0u, last_height = ~0u;
> > diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> > index 0e7641e..f4fee2d 100644
> > --- a/src/spice-streaming-agent.cpp
> > +++ b/src/spice-streaming-agent.cpp
> > @@ -35,7 +35,6 @@
> >  #include "hexdump.h"
> >  #include "concrete-agent.hpp"
> >  
> > -using namespace std;
> >  using namespace spice::streaming_agent;
> >  
> >  static ConcreteAgent agent;
> > @@ -351,7 +350,7 @@ static void cursor_changes(Display *display, int
> > event_base)
> >  }
> >  
> >  static void
> > -do_capture(const string &streamport, FILE *f_log)
> > +do_capture(const std::string &streamport, FILE *f_log)
> >  {
> >      streamfd = open(streamport.c_str(), O_RDWR);
> >      if (streamfd < 0)
> > @@ -437,7 +436,7 @@ done:
> >  
> >  int main(int argc, char* argv[])
> >  {
> > -    string streamport = "/dev/virtio-ports/com.redhat.stream.0";
> > +    std::string streamport = "/dev/virtio-ports/com.redhat.stream.0";
> >      char opt;
> >      const char *log_filename = NULL;
> >      int logmask = LOG_UPTO(LOG_WARNING);
> 
> Acked-by: Lukáš Hrázký <lhrazky@xxxxxxxxxx>
> 
> Are you planning on doing the namespace spice::streaming_agent in .cpp
> and the renaming of methods too?
> 
> I'm updating the separation patch I just posted and will send an
> update.
> 
> Lukas
> 

I think I finish for today.
I was not planning the method renames, more finishing the namespace
"using" (using either the namespace if implementing it or not including
all namespace like std one).

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]