mirror of
https://github.com/wfjm/w11.git
synced 2026-01-22 11:00:49 +00:00
BUGFIXes for backend
- RlinkPort: BUGFIX: RawRead(): proper irc for exactsize=false - Rexception: BUGFIX: add fErrtxt for proper what() return
This commit is contained in:
parent
eb53dc6bfd
commit
76244111d1
@ -1,4 +1,4 @@
|
||||
// $Id: RlinkPort.cpp 887 2017-04-28 19:32:52Z mueller $
|
||||
// $Id: RlinkPort.cpp 888 2017-04-30 13:06:51Z mueller $
|
||||
//
|
||||
// Copyright 2011-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2017-04-29 888 1.4.2 BUGFIX: RawRead(): proper irc for exactsize=false
|
||||
// 2017-04-07 868 1.4.1 Dump(): add detail arg
|
||||
// 2017-02-19 853 1.4 use Rtime, drop TimeOfDayAsDouble
|
||||
// 2015-04-11 666 1.3 add fXon, XonEnable()
|
||||
@ -274,8 +275,8 @@ int RlinkPort::RawRead(uint8_t* buf, size_t size, bool exactsize,
|
||||
tnow.GetClock(CLOCK_MONOTONIC);
|
||||
tused = tnow - tbeg;
|
||||
if (irc <= 0) return irc;
|
||||
if (!exactsize) break;
|
||||
ndone += irc;
|
||||
if (!exactsize) break;
|
||||
}
|
||||
|
||||
return (int)ndone;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: Rexception.cpp 887 2017-04-28 19:32:52Z mueller $
|
||||
// $Id: Rexception.cpp 888 2017-04-30 13:06:51Z mueller $
|
||||
//
|
||||
// Copyright 2013-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2017-04-29 888 1.2 BUGFIX: add fErrtxt for proper what() return
|
||||
// 2014-12-30 625 1.1 add ctor(meth,text,emsg)
|
||||
// 2013-01-12 474 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -38,21 +39,25 @@ namespace Retro {
|
||||
//! Default constructor
|
||||
|
||||
Rexception::Rexception()
|
||||
: fErrmsg()
|
||||
{}
|
||||
: fErrmsg(),
|
||||
fErrtxt()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
Rexception::Rexception(const RerrMsg& errmsg)
|
||||
: fErrmsg(errmsg)
|
||||
: fErrmsg(errmsg),
|
||||
fErrtxt(fErrmsg.Message())
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
Rexception::Rexception(const std::string& meth, const std::string& text)
|
||||
: fErrmsg(meth,text)
|
||||
: fErrmsg(meth,text),
|
||||
fErrtxt(fErrmsg.Message())
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -60,7 +65,8 @@ Rexception::Rexception(const std::string& meth, const std::string& text)
|
||||
|
||||
Rexception::Rexception(const std::string& meth, const std::string& text,
|
||||
int errnum)
|
||||
: fErrmsg(meth,text,errnum)
|
||||
: fErrmsg(meth,text,errnum),
|
||||
fErrtxt(fErrmsg.Message())
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -68,7 +74,8 @@ Rexception::Rexception(const std::string& meth, const std::string& text,
|
||||
|
||||
Rexception::Rexception(const std::string& meth, const std::string& text,
|
||||
const RerrMsg& errmsg)
|
||||
: fErrmsg(meth,text+errmsg.Message())
|
||||
: fErrmsg(meth,text+errmsg.Message()),
|
||||
fErrtxt(fErrmsg.Message())
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
@ -82,7 +89,9 @@ Rexception::~Rexception() throw()
|
||||
|
||||
const char* Rexception::what() const throw()
|
||||
{
|
||||
return fErrmsg.Message().c_str();
|
||||
// what() must return a pointer to a string which stays valid at least as long
|
||||
// as the exception object lives. Use member variable fErrtxt for this.
|
||||
return fErrtxt.c_str();
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: Rexception.hpp 887 2017-04-28 19:32:52Z mueller $
|
||||
// $Id: Rexception.hpp 888 2017-04-30 13:06:51Z mueller $
|
||||
//
|
||||
// Copyright 2013-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2017-04-29 888 1.2 BUGFIX: add fErrtxt for proper what() return
|
||||
// 2014-12-30 625 1.1 add ctor(meth,text,emsg)
|
||||
// 2013-02-12 487 1.0.1 add ErrMsg() getter
|
||||
// 2013-01-12 474 1.0 Initial version
|
||||
@ -46,11 +47,12 @@ namespace Retro {
|
||||
const std::string& text, const RerrMsg& errmsg);
|
||||
~Rexception() throw();
|
||||
|
||||
const char* what() const throw();
|
||||
virtual const char* what() const throw();
|
||||
const RerrMsg& ErrMsg() const;
|
||||
|
||||
protected:
|
||||
RerrMsg fErrmsg; //!< message object
|
||||
RerrMsg fErrmsg; //!< message object
|
||||
std::string fErrtxt; //!< message text (for what())
|
||||
};
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user