summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/jbig2/JBig2_Object.cpp
blob: 3a94f0e65a59a13fe8be5f2f1a486daf0b728178 (plain)
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
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "JBig2_Object.h"
#include "JBig2_Module.h"
void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line)
{
    CJBig2_Object *p;
    p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size);
    p->m_pModule = pModule;
    return p;
}
void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line)
{
    pModule->JBig2_Free(p);
}
void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule)
{
    CJBig2_Object *p;
    p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size);
    p->m_pModule = pModule;
    return p;
}
void CJBig2_Object::operator delete(void *p)
{
    ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
}
void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule)
{
    pModule->JBig2_Free(p);
}
void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size,
                                    FX_LPCSTR filename, int line)
{
    void *p;
    FX_BYTE *pCur, *pEnd;
    p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size);
    pCur = (FX_BYTE *)p;
    pEnd = pCur + size;
    for(; pCur < pEnd; pCur += unit_size) {
        ((CJBig2_Object *)pCur)->m_pModule = pModule;
    }
    return p;
}
void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size,
                                      FX_LPCSTR filename, int line)
{
    pModule->JBig2_Free(p);
}
void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size)
{
    void *p;
    FX_BYTE *pCur, *pEnd;
    p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size);
    pCur = (FX_BYTE *)p;
    pEnd = pCur + size;
    for(; pCur < pEnd; pCur += unit_size) {
        ((CJBig2_Object *)pCur)->m_pModule = pModule;
    }
    return p;
}
void CJBig2_Object::operator delete[](void* p)
{
    ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
}
void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size)
{
    pModule->JBig2_Free(p);
}