X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fmemory.cpp;h=79956cdafecae37a113b7421d10cb30fadd1d2c1;hp=6ea130b54ae134478ab40851f4c49cf1d68ad439;hb=8f2711fba7a2817840038630d9cf9a2060ecbe8e;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848 diff --git a/source/io/memory.cpp b/source/io/memory.cpp index 6ea130b..79956cd 100644 --- a/source/io/memory.cpp +++ b/source/io/memory.cpp @@ -1,6 +1,5 @@ #include #include -#include "except.h" #include "memory.h" using namespace std; @@ -98,10 +97,10 @@ unsigned Memory::seek(int off, SeekType type) else if(type==S_END) new_pos = end+off; else - throw InvalidParameterValue("Invalid seek type"); + throw invalid_argument("Memory::seek"); if(new_posend) - throw InvalidParameterValue("Invalid seek offset"); + throw out_of_range("Memory::seek"); pos = new_pos; return pos-begin; @@ -109,18 +108,13 @@ unsigned Memory::seek(int off, SeekType type) Handle Memory::get_event_handle() { - throw Exception("Memory doesn't support events"); + throw logic_error("Memory doesn't support events"); } void Memory::check_mode(Mode m) const { - if(m==M_WRITE) - { - if(!(mode&M_WRITE)) - throw InvalidState("Memory is not writable"); - if(pos==end) - throw InvalidState("Attempt to write past end of Memory"); - } + if(m==M_WRITE && !(mode&M_WRITE)) + throw invalid_access(M_WRITE); } } // namespace IO