File: ZipException.cpp

package info (click to toggle)
mozilla-firefox 1.0.4-2sarge17
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 255,356 kB
  • ctags: 267,207
  • sloc: cpp: 1,623,961; ansic: 792,828; xml: 85,380; makefile: 41,934; perl: 27,802; asm: 14,884; sh: 14,807; cs: 4,507; python: 4,398; java: 4,004; yacc: 1,380; lex: 409; pascal: 354; php: 244; csh: 132; objc: 73; ada: 44; sql: 4
file content (78 lines) | stat: -rw-r--r-- 2,087 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ZipException.cpp: implementation of the CZipException class.
//
////////////////////////////////////////////////////////////////////////////////
//  Copyright (C) 2000 Tadeusz Dracz.
//  For conditions of distribution and use, see copyright notice in ZipArchive.h
////////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ZipException.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC( CZipException, CException)

CZipException::CZipException(int iCause, LPCTSTR lpszZipName):CException(TRUE)
{
	m_iCause = iCause;

	if (lpszZipName)
		m_szFileName = lpszZipName;	
}

CZipException::~CZipException()
{

}

void AfxThrowZipException(int iZipError, LPCTSTR lpszZipName)
{
	throw new CZipException(CZipException::ZipErrToCause(iZipError), lpszZipName);
}

int CZipException::ZipErrToCause(int iZipError)
{
	switch (iZipError)
	{
	case 2://Z_NEED_DICT:
		return CZipException::needDict;
	case 1://Z_STREAM_END:
		return CZipException::streamEnd;
	case -1://Z_ERRNO:
		return CZipException::errNo;
	case -2://Z_STREAM_ERROR:
		return CZipException::streamError;
	case -3://Z_DATA_ERROR:
		return CZipException::dataError;
	case -4://Z_MEM_ERROR:
		return CZipException::memError;
	case -5://Z_BUF_ERROR:
		return CZipException::bufError;
	case -6://Z_VERSION_ERROR:
		return CZipException::versionError;
	case ZIP_BADZIPFILE:
		return CZipException::badZipFile;
	case ZIP_BADCRC:
		return CZipException::badCrc;
	case ZIP_ABORTED:
		return CZipException::aborted;
	case ZIP_NOCALLBACK:
		return CZipException::noCallback;
	case ZIP_NONREMOVABLE:
		return CZipException::nonRemovable;
	case ZIP_TOOMANYVOLUMES:
		return CZipException::tooManyVolumes;
	case ZIP_TOOLONGFILENAME:
		return CZipException::tooLongFileName;
	case ZIP_BADPASSWORD:
		return CZipException::badPassword;
	case ZIP_CDIR_NOTFOUND:
		return CZipException::cdirNotFound;


	default:
		return CZipException::generic;
	}
	
}