3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / plugins / matroska / libebml / IOCallback.cpp
blob77c587137289191d287410a5951d6ade84fe088c
1 /****************************************************************************
2 ** libebml : parse EBML files, see http://embl.sourceforge.net/
3 **
4 ** <file/class description>
5 **
6 ** Copyright (C) 2002-2004 Ingo Ralf Blum. All rights reserved.
7 **
8 ** This library is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU Lesser General Public
10 ** License as published by the Free Software Foundation; either
11 ** version 2.1 of the License, or (at your option) any later version.
12 **
13 ** This library is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** Lesser General Public License for more details.
17 **
18 ** You should have received a copy of the GNU Lesser General Public
19 ** License along with this library; if not, write to the Free Software
20 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
24 ** Contact license@matroska.org if any conditions of this licensing are
25 ** not clear to you.
27 **********************************************************************/
29 /*!
30 \file
31 \version \$Id: IOCallback.cpp 639 2004-07-09 20:59:14Z mosu $
32 \author Steve Lhomme <robux4 @ users.sf.net>
33 \author Moritz Bunkus <moritz @ bunkus.org>
36 #if !defined(__GNUC__) || (__GNUC__ > 2)
37 #include <sstream>
38 #endif // GCC2
39 #include <stdexcept>
42 #include "ebml/IOCallback.h"
44 using namespace std;
46 START_LIBEBML_NAMESPACE
48 void IOCallback::writeFully(const void*Buffer,size_t Size)
50 if (Size == 0)
51 return;
53 if (Buffer == NULL)
54 throw;
56 if(write(Buffer,Size) != Size)
58 #if !defined(__GNUC__) || (__GNUC__ > 2)
59 stringstream Msg;
60 Msg<<"EOF in writeFully("<<Buffer<<","<<Size<<")";
61 throw runtime_error(Msg.str());
62 #endif // GCC2
68 void IOCallback::readFully(void*Buffer,size_t Size)
70 if(Buffer == NULL)
71 throw;
73 if(read(Buffer,Size) != Size)
75 #if !defined(__GNUC__) || (__GNUC__ > 2)
76 stringstream Msg;
77 Msg<<"EOF in readFully("<<Buffer<<","<<Size<<")";
78 throw runtime_error(Msg.str());
79 #endif // GCC2
83 END_LIBEBML_NAMESPACE