Esempio n. 1
0
BOOL CUST_IsCustomAnimation(int * iFrames)
{
    char *pFile;
    BOOL bRet = FALSE;

    // set iFrames to default

    PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile);
    if (pFile) {
        if (*pFile) bRet = TRUE;
        XP_FREE(pFile);
        pFile = NULL;
    }
    PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile);
    if (pFile) {
        if (*pFile) bRet = TRUE;
        XP_FREE(pFile);
        pFile = NULL;
    }
    if (bRet) {
        int32 iTmp;
        PREF_GetConfigInt("toolbar.logo.frames",&iTmp);
        if (iTmp > 0 && iTmp <1000) // pure arbitrary bounds check
            if (iFrames) *iFrames = iTmp;
    }
    return bRet;
}
Esempio n. 2
0
lo_MapRec *
lo_FreeMap(lo_MapRec *map)
{
	lo_MapRec *next;

	if (map->areas != NULL)
	{
		lo_MapAreaRec *tmp_area;
		lo_MapAreaRec *areas;

		areas = map->areas;
		while (areas != NULL)
		{
			tmp_area = areas;
			areas = areas->next;
			if (tmp_area->alt != NULL)
			{
				PA_FREE(tmp_area->alt);
			}
			if (tmp_area->coords != NULL)
			{
				XP_FREE(tmp_area->coords);
			}
			XP_DELETE(tmp_area);
		}
	}
	if (map->name != NULL)
	{
		XP_FREE(map->name);
	}
	next = map->next;
	XP_DELETE(map);
	return next;
}
Esempio n. 3
0
/* 
 *  Do something interesting with the object and free it
 *  ----------------------------------------------------
 */
extern "C"  void 
memory_stream_complete (NET_StreamClass *stream)
{
    DataObject * data = (DataObject *)stream->data_object;	

    if(data->address)
        XP_FREE(data->address);

	// Make sure we are text and NULL terminated
	if(data->loc)
		*(data->loc) = '\0';
	
	if(data->start) { 
		XP_FREE(data->start);
		data->start = NULL;
	}
	    
    if(data->params) {
        XP_FREE(data->params);
        data->params = NULL;
    }

	delete data;
	return;
}
Esempio n. 4
0
/*
** Free up quantizer information attached to ic. If this is the last
** quantizer then free up the sample range limit table.
*/
void
il_free_quantize(il_container *ic)
{
    my_cquantize_ptr cquantize = (my_cquantize_ptr) ic->quantize;
    int i;

    if (cquantize) 
    {
#ifdef DEBUG
		if (il_debug > 5) 
			XP_TRACE(("il: 0x%x: free quantize", ic));
#endif
		for (i = 0; i < 3; i++) 
		{
			if (cquantize->fserrors[i]) 
			{
				XP_FREE(cquantize->fserrors[i]);
				cquantize->fserrors[i] = 0;
			}
		}

		XP_FREE(cquantize);
		ic->quantize = 0;
    }
}
Esempio n. 5
0
VR_INTERFACE(REGERR) VR_UninstallDeleteSharedFilesKey(char *component_path)
{
    REGERR err;
    char *regbuf;
    char *converted_component_path;
    uint32 convertedDataLength = 0;
    uint32 regbuflen = 0;
    uint32 curregbuflen = 0;
    uint32 len = 0;
        
    err = vr_Init();
    if (err != REGERR_OK)
        return err;

    if ( component_path == NULL )
        err = REGERR_PARAM;

    convertedDataLength = 2 * XP_STRLEN(component_path) + 1;
    converted_component_path = (char*)XP_ALLOC(convertedDataLength);
    if (converted_component_path == NULL ) {
        err = REGERR_MEMORY;
        return err;
    }
    err = vr_convertPackageName(component_path, converted_component_path, convertedDataLength);
    if (err != REGERR_OK)
    {
        XP_FREEIF(converted_component_path);
        return err;
    }

    regbuflen = 256 + XP_STRLEN(converted_component_path);
    regbuf = (char*)XP_ALLOC( regbuflen );
    if (regbuf != NULL )
    {
        err = vr_GetUninstallItemPath(converted_component_path, regbuf, regbuflen); 
        if (err == REGERR_OK)
        {
            curregbuflen = XP_STRLEN(regbuf);
            len = XP_STRLEN(SHAREDFILESSTR);
            if (len < (regbuflen - curregbuflen))
            {
                XP_STRCAT(regbuf, SHAREDFILESSTR);
                err = NR_RegDeleteKey( vreg, ROOTKEY_PRIVATE, regbuf );
            }
            else
                err = REGERR_BUFTOOSMALL;
        }
        XP_FREE(regbuf);
    }
    else
    {
        err = REGERR_MEMORY;
    }

    XP_FREE(converted_component_path);
    return err;

}   /* UninstallDeleteSharedFilesKey */
Esempio n. 6
0
/*
 * Make all the directories specified in the path
 */
int XP_MakeDirectoryR(const char* name, XP_FileType type)
{
    char separator;
    int result = 0;
    char * finalName;

#if defined(XP_WIN) || defined(XP_OS2)
    separator = '\\';
#elif defined XP_UNIX
    separator = '/';
#endif
    finalName = WH_FileName(name, type);
    if ( finalName )
    {
        char * dirPath;
        char * currentEnd;
        int err = 0;
        XP_StatStruct s;
        dirPath = XP_STRDUP( finalName );
        if (dirPath == NULL)
            return -1;

        currentEnd = XP_STRCHR(dirPath, separator);
        /* Loop through every part of the directory path */
        while (currentEnd != 0)
        {
            char savedChar;
            savedChar = currentEnd[1];
            currentEnd[1] = 0;
            if ( XP_Stat(dirPath, &s, xpURL ) != 0)
                err = XP_MakeDirectory(dirPath, xpURL);
            if ( err != 0)
            {
                XP_ASSERT( FALSE );	/* Could not create the directory? */
                break;
            }
            currentEnd[1] = savedChar;
            currentEnd = XP_STRCHR( &currentEnd[1], separator);
        }
        if ( err == 0 )
            /* If the path is not terminated with / */
        {
            if ( dirPath[XP_STRLEN( dirPath) - 1] != separator )
                if ( XP_Stat(dirPath, &s, xpURL ) != 0)
                    err = XP_MakeDirectory(dirPath, xpURL);
        }
        if ( 0 != err )
            result = err;
        if ( dirPath )
            XP_FREE( dirPath );
    }
    else
        result = -1;
    if ( finalName )
        XP_FREE( finalName );
    XP_ASSERT( result == 0 );	/* For debugging only */
    return result;
}
nsFolderSpec::~nsFolderSpec(void)
{
  if (folderID) 
    XP_FREE(folderID);
  if (versionRegistryPath) 
    XP_FREE(versionRegistryPath);
  if (userPackageName) 
    XP_FREE(userPackageName);
  if (urlPath) 
    XP_FREE(urlPath);
}
Esempio n. 8
0
PRIVATE void net_CvtCharCodeAbort (NET_StreamClass *stream, int status)
{
	NetStreamData *nsd=stream->data_object;	
	(*nsd->next_stream->abort)(nsd->next_stream, status);

	XP_FREE(nsd->next_stream);
    XP_FREE(nsd->obj);
    XP_FREE(nsd);

    return;
}
Esempio n. 9
0
PUBLIC void 			
INTL_CompoundStrDestroy(INTL_CompoundStr* This)
{
	INTL_CompoundStr* Next;
	for(; (This != NULL); This=Next)
	{
		if(This->next)
			Next=This->next;
		else
			Next=NULL;
		XP_FREE(This->text);
		XP_FREE(This);	
	}
}
Esempio n. 10
0
void CFE_TextTranslationExitRoutine(PrintSetup *pTextFE)    {
	//	Enable clicking now.
	FE_EnableClicking(VOID2CX(pTextFE->carg, CAbstractCX)->GetContext());

    VOID2CX(pTextFE->carg, CAbstractCX)->TextTranslationExitRoutine(pTextFE);

    //  Clean up what the CAbstractCX was responsible for allocating.
    XP_FREE(pTextFE->prefix);
    XP_FREE(pTextFE->filename);
    fclose(pTextFE->out);

    //  Don't remove the print setup.
    //	It is freed elsewhere by other
    //		code (TextFE stuff).
}
Esempio n. 11
0
void XFE_ReadAttachDrag::dragComplete()
{
    if (_dragDataURL) {
        XP_FREE(_dragDataURL);
        _dragDataURL=NULL;
    }

    if (_dragDataName) {
        XP_FREE(_dragDataName);
        _dragDataName=NULL;
    }

    // if we created tmp files, delete them.
    cleanupDataFiles();    
}
Esempio n. 12
0
char *CFE_Prompt(MWContext *pContext, const char *pPrompt, const char *pDefault)	{
	if(ABSTRACTCX(pContext)->IsDestroyed())	{
		//	Don't allow this to happen if the context has been destroyed...
		TRACE("Context %p Destroyed :: Prompt Blocking\n", pContext);
		return(NULL);
	}

	char *pWinPrompt = FE_Windowsify(pPrompt);
	char *pWinDefault = FE_Windowsify(pDefault);
	char *pReturn = ABSTRACTCX(pContext)->Prompt(pContext, pWinPrompt, pWinDefault);
	XP_FREE(pWinPrompt);
	if (pWinDefault)
		XP_FREE(pWinDefault);
	return(pReturn);
}
Esempio n. 13
0
void XFE_URLDesktopType::freeItemList()
{
    for (int i=0;i<_numItems;i++) {
        if (_url[i]) { XP_FREE(_url[i]); _url[i]=NULL; }
        if (_title[i]) { XP_FREE(_title[i]); _title[i]=NULL; }
        if (_description[i]) { XP_FREE(_description[i]); _description[i]=NULL; }
        if (_filename && _filename[i]) { XP_FREE(_filename[i]); _filename[i]=NULL; }
    }
    if (_url) { delete _url; _url=NULL; }
    if (_title) { delete _title; _title=NULL; }
    if (_description) { delete _description; _description=NULL; }
    if (_filename) { delete _filename; _filename=NULL; }

    _numItems=0;
}
Esempio n. 14
0
jint FontDisplayerPeerObject::
describe(FontCatalogFile &fc)
{
	char *s;
	
	// Print out the displayer information
	
	if (fpType != WF_FP_DYNAMIC)
	{
		return (0);
	}
	fc.output("displayer = {");
	fc.indentIn();

	s = "dynamic";
	fc.output("type", s);

	s = dlm.describe();
	fc.output("dlm", s);
	if (s)
	{
		XP_FREE(s);
	}

	fc.output("name", displayerName);
	fc.output("description", displayerDescription);

	s = mimeList.describe();
	fc.output("mimeString", s);
	if (s)
	{
		XP_FREE(s);
	}

	fc.output("deleted", deleted);
	fc.output("disabled", disabled);

	fc.output("catalog = {");
	fc.indentIn();
	catalog.describe(fc);
	fc.indentOut();
	fc.output("} // End of catalog");

	fc.indentOut();
	fc.output("} // End of displayer");

	return (0);
}
Esempio n. 15
0
void XFE_ComposeAttachFolderView::processBookmarkDrop(fe_dnd_Source *source)
{
    XFE_BookmarkView* bookmarkView=( XFE_BookmarkView*)source->closure;
    if (!bookmarkView)
        return;

    MWContext *context=bookmarkView->getContext();
    XFE_Outliner *outliner=bookmarkView->getOutliner();
    const int *selectedList;
    int numSelected;

    if (outliner->getSelection(&selectedList, &numSelected)) {
        char **items=new char*[numSelected];
        int numItems=0;
        int i;
        
        for (i=0; i<numSelected; i++) {
            BM_Entry* entry=BM_AtIndex(context,selectedList[i]+1);
            if (BM_GetType(entry)==BM_TYPE_URL ||
                BM_GetType(entry)==BM_TYPE_ALIAS) {
                const char *address=BM_GetAddress(entry);
                if (address) {
                    XDEBUG(printf("    %d:%s\n",selectedList[i],address));
                    items[numItems++]=XP_STRDUP(address);
                }
            }
        } 
        if (numItems>0)
            addAttachments((const char **) items,numItems);
        
        for (i=0; i<numItems; i++)
            XP_FREE(items[i]);
        delete items;
    }
}
Esempio n. 16
0
int XP_FileRename(const char * from, XP_FileType fromtype,
                  const char * to, XP_FileType totype)
{
    char * fromName = WH_FileName(from, fromtype);
    char * toName = WH_FileName(to, totype);
    int res = 0;
    if (fromName && toName)
        res = rename(fromName, toName);
    else
        res = -1;
    if (fromName)
        XP_FREE(fromName);
    if (toName)
        XP_FREE(toName);
    return res;
}
Esempio n. 17
0
void XFE_ComposeAttachFolderView::processMessageDrop(fe_dnd_Source *source)
{
    XFE_ThreadView *threadView=(XFE_ThreadView*)source->closure;
    XFE_Outliner *outliner=threadView->getOutliner();
    const int *selectedList;
    int numSelected;
    if (outliner->getSelection(&selectedList, &numSelected)) {
        char **items=new char*[numSelected];
        int numItems=0;
        int i;
        
        for (i=0; i<numSelected; i++) {
            MessageKey key=MSG_GetMessageKey(threadView->getPane(),selectedList[i]);
            URL_Struct *messageURL=MSG_ConstructUrlForMessage(threadView->getPane(),key);
            if (messageURL && messageURL->address) {
                XDEBUG(printf("    %d:%s\n",selectedList[i],messageURL->address));
                items[numItems++]=XP_STRDUP(messageURL->address);
            }
            if (messageURL)
                NET_FreeURLStruct(messageURL);
        }
        
        if (numItems>0)
            addAttachments((const char **) items,numItems);
        
        for (i=0; i<numItems; i++)
            XP_FREE(items[i]);
        delete items;
    }
}
Esempio n. 18
0
/* WARNING ! the mac FE does not call this ! */
void
XP_DeleteContext(MWContext *context)
{
  XP_ASSERT(context);
  INTL_CSIDestroy(context->INTL_CSIInfo);
  XP_FREE(context);
}
Esempio n. 19
0
void CFE_Alert(MWContext *pContext, const char *pMessage)	{
	if(ABSTRACTCX(pContext)->IsDestroyed())	{
		//	Don't allow this to happen if the context has been destroyed...
		TRACE("Context %p Destroyed :: Alert Blocking\n", pContext);
		return;
	}
    else if(pMessage)   {
	    char *pWinMessage = FE_Windowsify(pMessage);
        if(pWinMessage) {
	        //	If the context has ncapi data, have it pass off this information to
	        //		external applications first, and see if we pass it on from here.
	        BOOL bWeAlert = TRUE;
	        if(ABSTRACTCX(pContext)->m_pNcapiUrlData != NULL)	{
		        if(ABSTRACTCX(pContext)->m_pNcapiUrlData->Alert(pWinMessage) != 0)	{
			        bWeAlert = FALSE;
		        }
	        }

	        if(bWeAlert == TRUE)	{
    	        ABSTRACTCX(pContext)->Alert(pContext, pWinMessage);
	        }
	        XP_FREE(pWinMessage);
        }
    }
}
Esempio n. 20
0
XP_Bool CFE_Confirm(MWContext *pContext, const char *pConfirmMessage)	{
	if(ABSTRACTCX(pContext)->IsDestroyed())	{
		//	Don't allow this to happen if the context has been destroyed...
		TRACE("Context %p Destroyed :: Confirm Blocking\n", pContext);
		return(FALSE);
	}

	char *pWinConfirmMessage = FE_Windowsify(pConfirmMessage);

	//	If the context has ncapi data, have it pass off this information to
	//		external applications first, and see if we pass it on from here.
	BOOL bWeConfirm = TRUE;
	XP_Bool bReturn;
	if(ABSTRACTCX(pContext)->m_pNcapiUrlData != NULL)	{
		bReturn = ABSTRACTCX(pContext)->m_pNcapiUrlData->Confirm(pWinConfirmMessage);
		if(bReturn == TRUE || bReturn == FALSE)	{
			bWeConfirm = FALSE;
		}
	}

	if(bWeConfirm == TRUE)	{
    	bReturn = ABSTRACTCX(pContext)->Confirm(pContext, pWinConfirmMessage);
	}

	XP_FREE(pWinConfirmMessage);
	return(bReturn);
}
Esempio n. 21
0
void XFE_ComposeAttachFolderView::processHistoryDrop(fe_dnd_Source *source)
{
    XFE_HistoryView *historyView = (XFE_HistoryView*)source->closure;
    if (!historyView)
        return;

    MWContext *context=historyView->getContext();
    XFE_Outliner *outliner=historyView->getOutliner();
    const int *selectedList;
    int numSelected;

    if (outliner->getSelection(&selectedList, &numSelected)) {
        char **items=new char*[numSelected];
        int numItems=0;
        int i;
        
        for (i=0; i<numSelected; i++) {
            gh_HistEntry *entry=historyView->getEntry(selectedList[i]);
            if (entry && entry->address) {
                XDEBUG(printf("    %d:%s\n",selectedList[i],entry->address));
                items[numItems++]=XP_STRDUP(entry->address);
            }
        } 
        if (numItems>0)
            addAttachments((const char **) items,numItems);
        
        for (i=0; i<numItems; i++)
            XP_FREE(items[i]);
        delete items;
    }
}
Esempio n. 22
0
static void
fe_movemail_perror(MWContext *context, const char *message)
{
  int e = errno;
  char *es = 0;
  char *buf1 = 0;
  char buf2[512];
  char *suffix;
  int L;

  XP_ASSERT(context);
  if (!context) return;

  if ((unsigned)e < (unsigned)sys_nerr)
    {
      es = sys_errlist [e];
    }
  else
    {
      PR_snprintf (buf2, sizeof (buf2), XP_GetString( XFE_UNKNOWN_ERROR_CODE ),
		errno);
      es = buf2;
    }

  suffix = XP_GetString(XFE_MOVEMAIL_FAILURE_SUFFIX);
  if(!suffix) suffix = "";
  if(!message) message = "";
  L = XP_STRLEN(message) + XP_STRLEN(es) + XP_STRLEN(suffix) + 40;
  buf1 = (char *) XP_ALLOC(L);
  if(!buf1) return;
  PR_snprintf (buf1, L-1, "%s\n%s\n\n%s", message, es, suffix);
  FE_Alert (context, buf1);
  XP_FREE(buf1);
}
Esempio n. 23
0
void
lo_FormatJavaObject(MWContext *context, lo_DocState *state, PA_Tag *tag, LO_JavaAppStruct *java_app)
{
    PA_Block buff;

    buff = lo_FetchParamValue(context, tag, PARAM_CLASSID);
    if (buff != NULL)
    {
        char* str;
        PA_LOCK(str, char *, buff);
        if (XP_STRNCASECMP(str, "java:", 5) == 0)
            java_app->selector_type = LO_JAVA_SELECTOR_OBJECT_JAVA;
        else if (XP_STRNCASECMP(str, "javaprogram:", 12) == 0)
            java_app->selector_type = LO_JAVA_SELECTOR_OBJECT_JAVAPROGRAM;
        else if (XP_STRNCASECMP(str, "javabean:", 8) == 0)
            java_app->selector_type = LO_JAVA_SELECTOR_OBJECT_JAVABEAN;
        PA_UNLOCK(buff);
        XP_FREE(buff);
    }

    if (java_app->selector_type == LO_JAVA_SELECTOR_OBJECT_JAVAPROGRAM)
    {
        java_app->ele_attrmask |= LO_ELE_HIDDEN;
    }
    else 
    {
        /* Get the HIDDEN parameter */
        java_app->ele_attrmask = 0;
        buff = lo_FetchParamValue(context, tag, PARAM_HIDDEN);
        if (buff != NULL)
        {
            Bool hidden = TRUE;
            char* str;

            PA_LOCK(str, char *, buff);
            if (pa_TagEqual("no", str))
            {
                hidden = FALSE;
            }
            else if (pa_TagEqual("false", str))
            {
                hidden = FALSE;
            }
            else if (pa_TagEqual("off", str))
            {
                hidden = FALSE;
            }
            PA_UNLOCK(buff);
            PA_FREE(buff);

            if (hidden != FALSE)
            {
                java_app->ele_attrmask |= LO_ELE_HIDDEN;
            }
        }
    }

    /* Finish formatting the object */
    lo_FormatJavaAppInternal(context, state, tag, java_app);
}
Esempio n. 24
0
DB *
CallDBOpenUsingFileURL(char *fileURL, int flags,int mode, DBTYPE type, const void *openinfo)
{
	DB *result;
	char *path;
	char *escapedPath;

        if (fileURL == NULL) return NULL;

	escapedPath = unescapeURL(fileURL);

#ifdef XP_MAC
	path = WH_FilePlatformName(convertFileURLToNSPRCopaceticPath(fileURL));
	XP_ASSERT(path != NULL);
#else
	
	path = convertFileURLToNSPRCopaceticPath(escapedPath);
#endif
	result = dbopen(path, flags, mode, type, openinfo);
#ifdef XP_MAC
	XP_FREE(path);
#endif

	if (escapedPath != NULL)	freeMem(escapedPath);

	return result;
}
Esempio n. 25
0
VR_INTERFACE(REGERR) VR_GetUninstallUserName(char *regPackageName, char *outbuf, uint32 buflen)
{
    REGERR err;
    RKEY key = 0;
    char *regbuf = NULL;
    char *convertedName = NULL;
    uint32 convertedDataLength = 0;
    uint32 regbuflen = 0;

    err = vr_Init();
    if (err != REGERR_OK)
        return err;

    if ( regPackageName == NULL || *regPackageName == '\0' || outbuf == NULL )
        return REGERR_PARAM;
   
    convertedDataLength = 2 * XP_STRLEN(regPackageName) + 1;
    convertedName = (char*)XP_ALLOC(convertedDataLength);
    if (convertedName == NULL ) {
        err = REGERR_MEMORY;
        return err;
    }
  
    err = vr_convertPackageName(regPackageName, convertedName, convertedDataLength);
    if (err != REGERR_OK) {
        XP_FREE(convertedName);
        return err;
    }
    regbuflen = 256 + XP_STRLEN(convertedName);
    regbuf = (char*)XP_ALLOC( regbuflen );
    if (regbuf == NULL ) {
        err = REGERR_MEMORY;
    } else {
        err = vr_GetUninstallItemPath(convertedName, regbuf, regbuflen);
        if (err == REGERR_OK) {
            err = NR_RegGetKey( vreg, ROOTKEY_PRIVATE, regbuf, &key );
        }
        XP_FREE(regbuf);
    }

    if (err == REGERR_OK)
        err = NR_RegGetEntryString( vreg, key, PACKAGENAMESTR, outbuf, buflen );
  
    XP_FREE(convertedName);
    return err;

}   /* GetUninstallName */
Esempio n. 26
0
NET_StreamClass *
OLE_ViewStream(int format_out, void *pDataObj, URL_Struct *urls,
              MWContext *pContext)
{
    NET_StreamClass *stream = nil, *viewstream;
	char *org_content_type;
    
    if (!(stream = XP_NEW_ZAP(NET_StreamClass))) {
		XP_TRACE(("OLE_ViewStream memory lossage"));
		return 0;
	}
	
    stream->name           = "ole viewer";
    stream->complete       = ole_view_complete;
    stream->abort          = ole_view_abort;
    stream->is_write_ready = ole_view_write_ready;
    stream->data_object    = NULL;
    stream->window_id      = pContext;
    stream->put_block      = (MKStreamWriteFunc)ole_view_write;

	org_content_type = urls->content_type; 
	urls->content_type = 0;
	StrAllocCopy(urls->content_type, TEXT_HTML);
	urls->is_binary = 1;	/* secret flag for mail-to save as */

	if((viewstream=NET_StreamBuilder(format_out, urls, pContext)) != 0)
	{
        char *buffer = (char*)
            XP_ALLOC(XP_STRLEN(fakehtml) + XP_STRLEN(urls->address) + 1);

        if (buffer)
        {
            XP_SPRINTF(buffer, fakehtml, urls->address);
            (*viewstream->put_block)(viewstream,
                                     buffer, XP_STRLEN(buffer));
            (*viewstream->complete)(viewstream);
            XP_FREE(buffer);
        }
	}

	/* XXX hack alert - this has to be set back for abort to work
       correctly */
	XP_FREE(urls->content_type);
	urls->content_type = org_content_type;

    return stream;
}
Esempio n. 27
0
PRIVATE void
pre_Finished(URL_Struct* url_struct, int status, MWContext* context)
{
	/* this should change to update the colors of 
	the prefetched links */
	XP_FREE(url_struct);
	url_struct = 0;
}
Esempio n. 28
0
/* Must remain idempotent.  Also used to make sure that the ic->quantize has the same 
colorSpace info as the rest of ic. */
int
il_init_quantize(il_container *ic)
{
    size_t arraysize;
    int i, j;
    my_cquantize_ptr cquantize;

    if (ic->quantize)
        il_free_quantize(ic);

    ic->quantize = XP_NEW_ZAP(my_cquantize);
    if (!ic->quantize) 
	{
	loser:
		ILTRACE(0,("il: MEM il_init_quantize"));
		return FALSE;
    }

    cquantize = (my_cquantize_ptr) ic->quantize;
    arraysize = (size_t) ((ic->image->header.width + 2) * SIZEOF(FSERROR));
    for (i = 0; i < 3; i++) 
	{
		cquantize->fserrors[i] = (FSERRPTR) XP_CALLOC(1, arraysize);
		if (!cquantize->fserrors[i]) 
		{
			/* ran out of memory part way thru */
			for (j = 0; j < i; j++) 
			{
				if (cquantize->fserrors[j])
				{
					XP_FREE(cquantize->fserrors[j]);
					cquantize->fserrors[j]=0;
				}
			}
			if (cquantize)
			{
				XP_FREE(cquantize);
				ic->quantize = 0;
			}
			goto loser;
		}
    }

    return TRUE;
}
Esempio n. 29
0
MODULE_PRIVATE void 
pre_FreePrefetchURLStruct(PrefetchURLStruct *pus)
{
    if(pus) 
      {
        FREEIF(pus->URL_s);
        XP_FREE(pus);
      }
}
Esempio n. 30
0
rdf_DisposeEvent_GetURL(MozillaEvent_rdf_GetURL *event)
{
	if (event->url != NULL)
	{
		freeMem(event->url);
		event->url = NULL;
	}
	XP_FREE(event);
}