~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/modules/plugin/tools/XPIPackager/ZipException.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ZipException.cpp: implementation of the CZipException class.
 
2
//
 
3
////////////////////////////////////////////////////////////////////////////////
 
4
//  Copyright (C) 2000 Tadeusz Dracz.
 
5
//  For conditions of distribution and use, see copyright notice in ZipArchive.h
 
6
////////////////////////////////////////////////////////////////////////////////
 
7
 
 
8
#include "stdafx.h"
 
9
#include "ZipException.h"
 
10
 
 
11
//////////////////////////////////////////////////////////////////////
 
12
// Construction/Destruction
 
13
//////////////////////////////////////////////////////////////////////
 
14
IMPLEMENT_DYNAMIC( CZipException, CException)
 
15
 
 
16
CZipException::CZipException(int iCause, LPCTSTR lpszZipName):CException(TRUE)
 
17
{
 
18
        m_iCause = iCause;
 
19
 
 
20
        if (lpszZipName)
 
21
                m_szFileName = lpszZipName;     
 
22
}
 
23
 
 
24
CZipException::~CZipException()
 
25
{
 
26
 
 
27
}
 
28
 
 
29
void AfxThrowZipException(int iZipError, LPCTSTR lpszZipName)
 
30
{
 
31
        throw new CZipException(CZipException::ZipErrToCause(iZipError), lpszZipName);
 
32
}
 
33
 
 
34
int CZipException::ZipErrToCause(int iZipError)
 
35
{
 
36
        switch (iZipError)
 
37
        {
 
38
        case 2://Z_NEED_DICT:
 
39
                return CZipException::needDict;
 
40
        case 1://Z_STREAM_END:
 
41
                return CZipException::streamEnd;
 
42
        case -1://Z_ERRNO:
 
43
                return CZipException::errNo;
 
44
        case -2://Z_STREAM_ERROR:
 
45
                return CZipException::streamError;
 
46
        case -3://Z_DATA_ERROR:
 
47
                return CZipException::dataError;
 
48
        case -4://Z_MEM_ERROR:
 
49
                return CZipException::memError;
 
50
        case -5://Z_BUF_ERROR:
 
51
                return CZipException::bufError;
 
52
        case -6://Z_VERSION_ERROR:
 
53
                return CZipException::versionError;
 
54
        case ZIP_BADZIPFILE:
 
55
                return CZipException::badZipFile;
 
56
        case ZIP_BADCRC:
 
57
                return CZipException::badCrc;
 
58
        case ZIP_ABORTED:
 
59
                return CZipException::aborted;
 
60
        case ZIP_NOCALLBACK:
 
61
                return CZipException::noCallback;
 
62
        case ZIP_NONREMOVABLE:
 
63
                return CZipException::nonRemovable;
 
64
        case ZIP_TOOMANYVOLUMES:
 
65
                return CZipException::tooManyVolumes;
 
66
        case ZIP_TOOLONGFILENAME:
 
67
                return CZipException::tooLongFileName;
 
68
        case ZIP_BADPASSWORD:
 
69
                return CZipException::badPassword;
 
70
        case ZIP_CDIR_NOTFOUND:
 
71
                return CZipException::cdirNotFound;
 
72
 
 
73
 
 
74
        default:
 
75
                return CZipException::generic;
 
76
        }
 
77
        
 
78
}