1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_shell.hxx"
26 #include "internal/global.hxx"
27 #include "zipexcptn.hxx"
28 
29 //------------------------------------------
30 /**
31 */
RuntimeException(int Error)32 RuntimeException::RuntimeException(int Error) :
33     m_Error(Error)
34 {
35 }
36 
37 //------------------------------------------
38 /**
39 */
~RuntimeException()40 RuntimeException::~RuntimeException() throw()
41 {
42 }
43 
44 //------------------------------------------
45 /**
46 */
GetErrorCode() const47 int RuntimeException::GetErrorCode() const
48 {
49 	return m_Error;
50 }
51 
52 //------------------------------------------
53 /**
54 */
ZipException(int Error)55 ZipException::ZipException(int Error) :
56 	RuntimeException(Error)
57 {
58 }
59 
60 //------------------------------------------
61 /**
62 */
what() const63 const char* ZipException::what() const throw()
64 {
65 	return 0;
66 }
67 
68 //------------------------------------------
69 /**
70 */
Win32Exception(int Error)71 Win32Exception::Win32Exception(int Error) :
72 	RuntimeException(Error),
73 	m_MsgBuff(0)
74 {
75 }
76 
77 //------------------------------------------
78 /**
79 */
~Win32Exception()80 Win32Exception::~Win32Exception() throw()
81 {
82 #ifndef OS2
83 	if (m_MsgBuff)
84 		LocalFree(m_MsgBuff);
85 #endif
86 }
87 
88 //------------------------------------------
89 /**
90 */
what() const91 const char* Win32Exception::what() const throw()
92 {
93 #ifdef OS2
94 	return "Win32Exception!";
95 #else
96 	FormatMessage(
97 		FORMAT_MESSAGE_ALLOCATE_BUFFER |
98 		FORMAT_MESSAGE_FROM_SYSTEM |
99 		FORMAT_MESSAGE_IGNORE_INSERTS,
100 		NULL,
101 		GetErrorCode(),
102 		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
103 		(LPTSTR) &m_MsgBuff,
104 		0,
105 		NULL);
106 
107 	return reinterpret_cast<char*>(m_MsgBuff);
108 #endif
109 }
110 
111 //------------------------------------------
112 /**
113 */
ZipContentMissException(int Error)114 ZipContentMissException::ZipContentMissException(int Error) :
115 	ZipException(Error)
116 {
117 }
118 
119 //------------------------------------------
120 /**
121 */
AccessViolationException(int Error)122 AccessViolationException::AccessViolationException(int Error) :
123 	Win32Exception(Error)
124 {
125 }
126 
127 //------------------------------------------
128 /**
129 */
IOException(int Error)130 IOException::IOException(int Error) :
131 	Win32Exception(Error)
132 {
133 }
134