161 lines
4.3 KiB
C
161 lines
4.3 KiB
C
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Netscape Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
/*******************************************************************************
|
|
* Source date: 9 Apr 1997 21:45:12 GMT
|
|
* netscape/fonts/crc module C stub file
|
|
* Generated by jmc version 1.8 -- DO NOT EDIT
|
|
******************************************************************************/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "xp_mem.h"
|
|
|
|
/* Include the implementation-specific header: */
|
|
#include "Pcrc.h"
|
|
|
|
/* Include other interface headers: */
|
|
|
|
/*******************************************************************************
|
|
* crc Methods
|
|
******************************************************************************/
|
|
|
|
#ifndef OVERRIDE_crc_getInterface
|
|
JMC_PUBLIC_API(void*)
|
|
_crc_getInterface(struct crc* self, jint op, const JMCInterfaceID* iid, JMCException* *exc)
|
|
{
|
|
if (memcmp(iid, &crc_ID, sizeof(JMCInterfaceID)) == 0)
|
|
return crcImpl2crc(crc2crcImpl(self));
|
|
return _crc_getBackwardCompatibleInterface(self, iid, exc);
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_addRef
|
|
JMC_PUBLIC_API(void)
|
|
_crc_addRef(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
crcImplHeader* impl = (crcImplHeader*)crc2crcImpl(self);
|
|
impl->refcount++;
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_release
|
|
JMC_PUBLIC_API(void)
|
|
_crc_release(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
crcImplHeader* impl = (crcImplHeader*)crc2crcImpl(self);
|
|
if (--impl->refcount == 0) {
|
|
crc_finalize(self, exc);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_hashCode
|
|
JMC_PUBLIC_API(jint)
|
|
_crc_hashCode(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
return (jint)self;
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_equals
|
|
JMC_PUBLIC_API(jbool)
|
|
_crc_equals(struct crc* self, jint op, void* obj, JMCException* *exc)
|
|
{
|
|
return self == obj;
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_clone
|
|
JMC_PUBLIC_API(void*)
|
|
_crc_clone(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
crcImpl* impl = crc2crcImpl(self);
|
|
crcImpl* newImpl = (crcImpl*)malloc(sizeof(crcImpl));
|
|
if (newImpl == NULL) return NULL;
|
|
memcpy(newImpl, impl, sizeof(crcImpl));
|
|
((crcImplHeader*)newImpl)->refcount = 1;
|
|
return newImpl;
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_toString
|
|
JMC_PUBLIC_API(const char*)
|
|
_crc_toString(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif
|
|
|
|
#ifndef OVERRIDE_crc_finalize
|
|
JMC_PUBLIC_API(void)
|
|
_crc_finalize(struct crc* self, jint op, JMCException* *exc)
|
|
{
|
|
/* Override this method and add your own finalization here. */
|
|
XP_FREEIF(self);
|
|
}
|
|
#endif
|
|
|
|
/*******************************************************************************
|
|
* Jump Tables
|
|
******************************************************************************/
|
|
|
|
const struct crcInterface crcVtable = {
|
|
_crc_getInterface,
|
|
_crc_addRef,
|
|
_crc_release,
|
|
_crc_hashCode,
|
|
_crc_equals,
|
|
_crc_clone,
|
|
_crc_toString,
|
|
_crc_finalize,
|
|
_crc_GetMajorType,
|
|
_crc_GetMinorType,
|
|
_crc_IsEquivalent,
|
|
_crc_GetPlatformData,
|
|
_crc_SetPlatformData
|
|
};
|
|
|
|
/*******************************************************************************
|
|
* Factory Operations
|
|
******************************************************************************/
|
|
|
|
JMC_PUBLIC_API(crc*)
|
|
crcFactory_Create(JMCException* *exception, jint a, jint b, void** c, jsize c_length)
|
|
{
|
|
crcImplHeader* impl = (crcImplHeader*)XP_NEW_ZAP(crcImpl);
|
|
crc* self;
|
|
if (impl == NULL) {
|
|
JMC_EXCEPTION(exception, JMCEXCEPTION_OUT_OF_MEMORY);
|
|
return NULL;
|
|
}
|
|
self = crcImpl2crc(impl);
|
|
impl->vtablecrc = &crcVtable;
|
|
impl->refcount = 1;
|
|
_crc_init(self, exception, a, b, c, c_length);
|
|
if (JMC_EXCEPTION_RETURNED(exception)) {
|
|
XP_FREE(impl);
|
|
return NULL;
|
|
}
|
|
return self;
|
|
}
|
|
|