zbar-windows/test/test_cpp.cpp
Mauro Carvalho Chehab 280b0a71f8 fix warnings: catching polymorphic type by value
qt/QZBar.cpp: In member function ‘virtual void zbar::QZBar::paintEvent(QPaintEvent*)’:
qt/QZBar.cpp:244:11: warning: catching polymorphic type ‘class zbar::Exception’ by value [-Wcatch-value=]
     catch(Exception) {
           ^~~~~~~~~
qt/QZBar.cpp: In member function ‘virtual void zbar::QZBar::resizeEvent(QResizeEvent*)’:
qt/QZBar.cpp:257:11: warning: catching polymorphic type ‘class zbar::Exception’ by value [-Wcatch-value=]
     catch(Exception) { /* ignore */ }
           ^~~~~~~~~
qt/QZBar.cpp: In member function ‘virtual void zbar::QZBar::changeEvent(QEvent*)’:
qt/QZBar.cpp:272:11: warning: catching polymorphic type ‘class zbar::Exception’ by value [-Wcatch-value=]
     catch(Exception) { /* ignore (FIXME do something w/error) */ }
           ^~~~~~~~~
qt/QZBar.cpp: In member function ‘void zbar::QZBar::attach()’:
qt/QZBar.cpp:293:11: warning: catching polymorphic type ‘class zbar::Exception’ by value [-Wcatch-value=]
     catch(Exception) { /* ignore (FIXME do something w/error) */ }
           ^~~~~~~~~

test/test_cpp.cpp: In function ‘int main(int, char**)’:
test/test_cpp.cpp:40:17: warning: catching polymorphic type ‘class zbar::ClosedError’ by value [-Wcatch-value=]
     catch(zbar::ClosedError) { }
                 ^~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-02-06 07:09:13 -02:00

44 lines
1.5 KiB
C++

//------------------------------------------------------------------------
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
//
// This file is part of the ZBar Bar Code Reader.
//
// The ZBar Bar Code Reader is free software; you can redistribute it
// and/or modify it under the terms of the GNU Lesser Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.
//
// The ZBar Bar Code Reader is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser Public License for more details.
//
// You should have received a copy of the GNU Lesser Public License
// along with the ZBar Bar Code Reader; if not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301 USA
//
// http://sourceforge.net/projects/zbar
//------------------------------------------------------------------------
// NB do not put anything before this header
// it's here to check that we didn't omit any dependencies
#include <zbar.h>
int main (int argc, char **argv)
{
const char *video_dev = "/dev/video0";
if(argc > 1)
video_dev = argv[1];
zbar::Processor proc = zbar::Processor(true, video_dev);
proc.set_visible();
proc.set_active();
try {
proc.user_wait();
}
catch(zbar::ClosedError&) { }
return(0);
}