예제 #1
0
파일: DECODER.C 프로젝트: mrchurrisky/chaos
short gif_decoder(short linewidth)
{
	unsigned char far *buf, far * stack, far * suffix;
	unsigned short far *prefix;
	short ret;

	ret = OUT_OF_MEMORY;
	stack = suffix = (unsigned char *) prefix = NULL;
	safe_alloc = 1;
	if ((buf = farmalloc(linewidth + 1)) == NULL)
		goto OUT;
	safe_alloc = 1;
	if ((stack = farmalloc(MAX_CODES + 1)) == NULL)
		goto OUT;
	safe_alloc = 1;
	if ((suffix = farmalloc(MAX_CODES + 1)) == NULL)
		goto OUT;
	safe_alloc = 1;
	if ((prefix = (unsigned short far *) farmalloc((MAX_CODES + 1) * sizeof(unsigned short))) == NULL)
		goto OUT;
	ret = decoder(linewidth, buf, stack, suffix, prefix);
OUT:
	if (ret == OUT_OF_MEMORY)
	    ErrorBox("Not enough memory to view a Gif file.");
	if (buf)
		farfree(buf);
	if (stack)
		farfree(stack);
	if (prefix)
		farfree(prefix);
	if (suffix)
		farfree(suffix);
	return (ret);
}
예제 #2
0
/* free a pointer allocated by PNG_MALLOC().  In the default
   configuration, png_ptr is not used, but is passed in case it
   is needed.  If ptr is NULL, return without taking any action. */
void
PNG_FREE(png_structp png_ptr, png_voidp ptr)
{
   if (png_ptr == NULL || ptr == NULL)
      return;

   if (png_ptr->offset_table != NULL)
   {
      int i;

      for (i = 0; i < png_ptr->offset_table_count; i++)
      {
         if (ptr == png_ptr->offset_table_ptr[i])
         {
            ptr = NULL;
            png_ptr->offset_table_count_free++;
            break;
         }
      }
      if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
      {
         farfree(png_ptr->offset_table);
         farfree(png_ptr->offset_table_ptr);
         png_ptr->offset_table = NULL;
         png_ptr->offset_table_ptr = NULL;
      }
   }

   if (ptr != NULL)
   {
      farfree(ptr);
      ptr = NULL;
   }
}
예제 #3
0
void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */

   if (png_ptr == NULL || ptr == NULL)
      return;

   if (png_ptr->offset_table != NULL)
   {
      int i;

      for (i = 0; i < png_ptr->offset_table_count; i++)
      {
         if (ptr == png_ptr->offset_table_ptr[i])
         {
            ptr = NULL;
            png_ptr->offset_table_count_free++;
            break;
         }
      }
      if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
      {
         farfree(png_ptr->offset_table);
         farfree(png_ptr->offset_table_ptr);
         png_ptr->offset_table = NULL;
         png_ptr->offset_table_ptr = NULL;
      }
   }

   if (ptr != NULL)
   {
      farfree(ptr);
   }
}
예제 #4
0
/* free a pointer allocated by png_large_malloc().  In the default
  configuration, png_ptr is not used, but is passed in case it
  is needed.  If ptr is NULL, return without taking any action. */
void
png_large_free(png_structp png_ptr, png_voidp ptr)
{
   if (!png_ptr)
      return;

   if (ptr != NULL)
   {
      if (png_ptr->offset_table)
      {
         int i;

         for (i = 0; i < png_ptr->offset_table_count; i++)
         {
            if (ptr == png_ptr->offset_table_ptr[i])
            {
               ptr = 0;
               png_ptr->offset_table_count_free++;
               break;
            }
         }
         if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
         {
            farfree(png_ptr->offset_table);
            farfree(png_ptr->offset_table_ptr);
            png_ptr->offset_table = 0;
            png_ptr->offset_table_ptr = 0;
         }
      }

      if (ptr)
         farfree(ptr);
   }
}
예제 #5
0
파일: MOUSE2.CPP 프로젝트: pjmodi/projects
void restore(int x1,int y1)
{
putimage(x1,y1,p1,OR_PUT);
putimage(midx+1,y1,p2,OR_PUT);
putimage(x1,midy+1,p3,OR_PUT);
putimage(midx+1,midy+1,p4,OR_PUT);


farfree(p1);
farfree(p2);
farfree(p3);
farfree(p4);
}
예제 #6
0
파일: fdisk.cpp 프로젝트: dvorka/rfs
word SetGroupFreeSpace( byte Device, byte Party, dword GroupID,
			word FreeSpaceSec )
// - free space is in sectors
{
 MasterBootRecord MBR;

 word     far *Buffer = (word far *)farmalloc(512lu);
 if( !Buffer ) { printf("\n Not enough far memory in %s line %d...", __FILE__, __LINE__ ); exit(0); }

 // read MBR
 if( LoadMasterBoot( Device, &MBR ) )
 {
  farfree( Buffer );
  return ERR_FS_FATAL_ERROR;
 }

 // stat sector is second on party
 dword GroupSec    = GroupID/512lu,    // 512 records in one sector
       GroupSecOff = GroupID%512lu;

       GroupSec   += MBR.PartyTable.Party[Party-1].FirstSectorOff+2lu;
		     // 1 boot record + 1 second boot
		     // => now points to first grp stat sector
		     // offset in this statistic already counted

 // read group stat sector boot
 if( ReadLogicalSector( Device, GroupSec, Buffer ) )
 {
  farfree( Buffer );
  return ERR_FS_FATAL_ERROR;
 }

 // get free space in sectors
 Buffer[GroupSecOff]=FreeSpaceSec;

 #ifdef DEBUG
  printf("\n New free sectors in group %lu is %u...", GroupID, FreeSpaceSec );
 #endif

 // write new values
 if( WriteLogicalSector( Device, GroupSec, Buffer ) )
 {
  farfree( Buffer );
  return ERR_FS_FATAL_ERROR;
 }


 farfree( Buffer );
 return ERR_FS_NO_ERROR;
}
예제 #7
0
void exitgame()
{
	int loop;
	for (loop=0;loop<52;loop++)
		farfree(data.block[loop]);
	for (loop=0;loop<3;loop++)
		farfree(data.coin[loop]);
	free(hcoin);
	free_cw();
	free_bt(); 
	uninstall_new_key_handler();
	RestoreTimer();
	set_mode(TEXT_MODE);
}
예제 #8
0
void operator delete( void far *ptr )
{
    if (FP_SEG(ptr) == _DS)
        free((void *) ptr);
    else
        farfree(ptr);
}
예제 #9
0
파일: GFXFORM3.C 프로젝트: krattai/flosh
void restore_screen(FILE *fptr, unsigned size)
{
	/* this function will display actual logo and then restore screen */

	int ystart=19,yend,yincr,x;
	void far *ptr[3];

	yincr=(465+1)/3;
	yend=yincr+ystart;

	for(x=0;x<=2;x++)
	{
		if((ptr[x] = farmalloc(size)) == NULL)
		{
			closegraph();
			printf("Error: not enough heap size in restore_screen().\n");
			exit(1);
		}
		fread(ptr[x],size,1,fptr);
		putimage(105,ystart,ptr[x],COPY_PUT);
		ystart=yend+1;
		yend+=yincr+1;
		farfree(ptr[x]);
	}
}
예제 #10
0
파일: KEY.C 프로젝트: alannet/example
void uninstall_new_key_handler(void)
{
  if (new_key_handler_installed) {
    farfree(keybuf);
    setvect(9, old_int09_handler);
  }
}
예제 #11
0
파일: gsscr.c 프로젝트: thujer/FontView
//-----------------------------------------------------------------------
// Obnovi z bufferu Buf vyrez obrazovky dany rozmery x0, y0, x1, y1
//------------------------------------------------------------------------
void SetScr(char x0,char y0,char x1,char y1)
{
	uchar x,y;

  if(ScrBuf_ix == 0) printf("\r\nERROR-SetScr: Neni ulozen zadny vyrez, nelze obnovit obraz !");
  else
  { if(ScrBuf_ix > ScrBuffers) cprintf("\r\nERROR-SetScr: Prekrocen maximalni index pro obnoveni vyrezu !");
    else
    { ScrBuf_ix--;
      if(ScrBuf[ScrBuf_ix]==0) printf("\r\nERROR-SetScr: Nebyla alokovana pamet obraz nebyl ulozen! Index: %2d",ScrBuf_ix);
      else
      { for (y=y0; y<y1; y++)
        { for (x=x0; x<x1; x++)
          { pokeb(0xB800,x*2+y*80*2,    ScrBuf[ScrBuf_ix][(x-x0)*2 + (y-y0)*(x1-x0)*2    ]);
            pokeb(0xB800,x*2+y*80*2 + 1,ScrBuf[ScrBuf_ix][(x-x0)*2 + (y-y0)*(x1-x0)*2 + 1]);
          }
        }
        farfree(ScrBuf[ScrBuf_ix]);  // Uvolneni pouzite pameti
        ScrBuf[ScrBuf_ix]=0;      // Nulovani ukazatele
      }
    }
  }

  //{ if(ScrBuf_ix) ScrBuf_ix--;
  //
  //  for (y=y0;y<=y1;y++)
  //  for (x=x0;x<=x1;x++)
  //   { pokeb(0xB800,x*2+y*80*2,ScrBuf[ScrBuf_ix][x*2 + y*80*2]);
  //     pokeb(0xB800,x*2+y*80*2 + 1,ScrBuf[ScrBuf_ix][x*2 + y*80*2 + 1]); }
  //}
  //else
  //{ gotoxy(1,1); textattr(15);
  //  cprintf("\nChyba: SetScr: Buffer neni %2d inicializovan !",ScrBuf_ix-1);
  //}
}
예제 #12
0
파일: MARKEXE.C 프로젝트: ifilex/SRC
long calcexe(char *exename,long offset)
{
 long x=0;
 int i=0,step[5]={7,3,1,2,7},j=0;
 int f=a_open(exename,O_RDONLY|O_BINARY);
 char *buf=farmalloc(CHECKBUF+1);

 if(buf)
 {
  if(f>=0)
  {
   lseek(f, offset, SEEK_SET);
   a_read(f,buf,CHECKBUF);

   while(j<CHECKBUF)
   {
    x+=buf[j];
    j+=step[i++];
    if(i==4)i=0;
   }

   a_close(f);

   return x;
  }
  farfree(buf);
 }

 puts("?!");
 exit(0);
}
예제 #13
0
/* Free memory allocated by a png_create_struct() call */
void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
    png_voidp mem_ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
   if (struct_ptr != NULL)
   {
#ifdef PNG_USER_MEM_SUPPORTED
      if (free_fn != NULL)
      {
         png_struct dummy_struct;
         png_structp png_ptr = &dummy_struct;
         png_ptr->mem_ptr=mem_ptr;
         (*(free_fn))(png_ptr, struct_ptr);
         return;
      }
#endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__)
      farfree(struct_ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
      hfree(struct_ptr);
# else
      free(struct_ptr);
# endif
#endif
   }
}
예제 #14
0
파일: VGALIB.C 프로젝트: kytulendu/Stuff
void Restore_Screen( ) {
	register int x, y;
	int x1, y1, x2, y2;
	int plane;

	if ( img_top < 0 )
		return;
	img_top -= 1;
	x1 = scr_ed[img_top].x1;
	x2 = scr_ed[img_top].x2;
	y1 = scr_ed[img_top].y1;
	y2 = scr_ed[img_top].y2;
	for ( plane = 0; plane < 4; plane++ ) {
		switch ( plane ) {
		case 0: set_writecolor( 1 );
			break;
		case 1: set_writecolor( 2 );
			break;
		case 2: set_writecolor( 4 );
			break;
		case 3: set_writecolor( 8 );
			break;
		}
		for ( y = y1; y <= y2; y++ )
			for ( x = x1; x <= x2; x++ )
				scr[x + y * 80] = scr_ed[img_top].img[plane][( x - x1 ) + ( y - y1 ) * ( x2 - x1 + 1 )];
		farfree( scr_ed[img_top].img[plane] );
		scr_ed[img_top].img[plane] = NULL;
	}
	set_writecolor( 15 );
}
예제 #15
0
void ie_clearbin(struct bin_file *fajl) //kdyz je nemazat NULL, tak nic
 // tr.: if nemazat (=not-delete) is NULL, then nothing
{
 //tohle je udelany zatim provizorne!!!
 //tady se budou swapy ktere pati jenom jednomu souboru mazat kopmpletne...
 // tr.: this is provisional for the moment
 //      here those swaps belonging only to one file will be deleted entirely/completely

 ie_resetbin(fajl);

#ifndef MYMEMORY
 if(fajl->lineadr!=NULL)farfree(fajl->lineadr);fajl->lineadr=NULL;
 if(fajl->linesize!=NULL)farfree(fajl->linesize);fajl->linesize=NULL;
#endif


}//end sub
예제 #16
0
파일: pngmem.c 프로젝트: AMDmi3/analog
void
png_destroy_struct(png_voidp struct_ptr)
{
   if (struct_ptr != NULL)
   {
      farfree (struct_ptr);
   }
}
예제 #17
0
/*
** Free
*/
void Free( void  *ptr)
{
#if DT_OS == 'd' && DT_CC == 'b'
   farfree (ptr);
#else
   free (ptr);
#endif
}
예제 #18
0
void LiberaAreas ( void )

	{
	free ( comentario );
	free ( Path );
	farfree ( areaFluxPosBD );
	farfree ( areaFluxPreBD );
	farfree ( areaTampaoInt );
	farfree ( areaVVMInt );
	farfree ( areaEspInt );
	farfree ( areaTampao );
	farfree ( areaVVM );
	farfree ( areaEsp );
	farfree ( PtrVol );
	}
예제 #19
0
void UnallocMemory (void *ptr)
{
	/* just a wrapper around farfree(), but provide an entry point */
	/* for memory debugging routines... */
#ifdef __WIN32__
	free( ptr);
#else
	farfree( ptr);
#endif
}
예제 #20
0
/**
 * Description not yet available.
 * \param
 */
void humungous_pointer::free()
{
  ptr -= adjustment;
  adjustment = 0;
#if defined(__BORLANDC__) || defined(__ZTC__)
  farfree(ptr);
#else
  ::free(ptr);
#endif
  ptr = NULL;
}
예제 #21
0
파일: alloc.c 프로젝트: EdwardGHub/Scripts
void
gpfree(generic *p)
{
#ifdef _Windows
    HGLOBAL hGlobal = GlobalHandle(p);
    GlobalUnlock(hGlobal);
    GlobalFree(hGlobal);
#else
    farfree(p);
#endif
}
예제 #22
0
    void MM_Shutdown (void)
    {
#if 0
        if (!mmstarted)
            return;

        farfree (farheap);
        free (nearheap);
        MML_ShutdownEMS ();
        MML_ShutdownXMS ();
#endif
    }
예제 #23
0
void table::scrolldown()
{
	void far *bitmap=(void far*)farmalloc(visiblecolumns*visiblerows+10);
	if(windowposy+visiblerows<ROWS-1)
	{
		windowposy++;
		getimage(x1,y1+rowwidth,x2,y2,bitmap);
		putimage(x1,y1,bitmap,0);
		for(int loop=windowposx;loop<visiblecolumns+windowposx;loop++)
			drawvalue(loop,windowposy+visiblerows-1);
	}
	farfree(bitmap);
}
예제 #24
0
void table::scrollup()
{
	void far *bitmap=(void far*)farmalloc(visiblecolumns*visiblerows+10);
	if(windowposy>0)
	{
		windowposy--;
		getimage(x1,y1,x2,y2-rowwidth,bitmap);
		putimage(x1,y1+rowwidth,bitmap,0);
		for(int loop=windowposx;loop<windowposx+visiblecolumns;loop++)
			drawvalue(loop,windowposy);
	}
	farfree(bitmap);

}
예제 #25
0
파일: corefar.c 프로젝트: TijmenW/FreeDOS
unsigned long my_farcoreleft(void)
{	unsigned long len, probe;

	for(len = 0, probe = 0x80000000l; probe; probe >>= 1) {
		void far*p;

		if((p = farmalloc(len | probe)) != 0) {
			len |= probe;
			farfree(p);
		}
	}

	return len;
}
예제 #26
0
/* Free memory allocated by a png_create_struct() call */
void
png_destroy_struct(png_voidp struct_ptr)
{
   if (struct_ptr)
#if defined(__TURBOC__) && !defined(__FLAT__)
      farfree(struct_ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
      hfree(struct_ptr);
# else
      free(struct_ptr);
# endif
#endif
}
예제 #27
0
파일: gsscr.c 프로젝트: thujer/FontView
//-----------------------------------------------------------------------
// Uvolni pamet alokovanou procedurou InitGSVideo()
//------------------------------------------------------------------------
void DoneGSVideo()
{
	char B;

  ScrBuf_ix=0;

  for(B=0; B<ScrBuffers; B++)
  {
  	if(ScrBuf[B]!=0)
        farfree(ScrBuf[B]);

    ScrBuf[B]=0;
  }
}
예제 #28
0
//------ Nadefinovani krize ---------------------
void x_defcross(int dx, int dy, int typ)
{
   if(typ != 0)              // ZAPNI -> ALOKOVAT PRO KRIZOVY KURSOR
    { if(xg_x1x2 == NULL)
       { xg_x1x2 = farmalloc((long)MAX_BUF_XX);
	 if(xg_x1x2 == NULL) goto No_cross;
       }
      if(xg_y1y2 == NULL)
       { xg_y1y2 = farmalloc((long)MAX_BUF_YY);
	 if(xg_y1y2 == NULL)
	   { No_cross:
	     if(xg_x1x2 != NULL) { farfree(xg_x1x2); xg_x1x2 = NULL; }
	     xg_typcur = 0;      // Neni misto pro cros_cur
	     return;
	   }
       }
    }
   else                      // VYPNI -> DEALOKOVAT
    { if(xg_x1x2 != NULL) { farfree(xg_x1x2); xg_x1x2 = NULL; }
      if(xg_y1y2 != NULL) { farfree(xg_y1y2); xg_y1y2 = NULL; }
    }

   if(xg_256 == MM_16 || xg_256 == MM_2) // v 16 modech pouze typ 1 max 128 x 128
    { if(typ > 1) typ = 1;
      if(dx > 128) dx = 128;
      if(dy > 128) dy = 128;
    }
   else
    { if(typ > 2) typ = 2;
      if(dx > x_maxx()) dx = x_maxx();
      if(dy > x_maxy()) dy = x_maxy();
    }
   xg_cr_dx = dx;
   xg_cr_dy = dy;
   xg_typcur = typ;
}
예제 #29
0
파일: tcaMem.c 프로젝트: guillep19/frob
void x_ipcFree(void *item)
#endif
{
  if (item == NULL) return;

#if defined(THINK_C) || defined(macintosh) || defined(__sgi)
  free(item);
#elif defined(DBMALLOC)
  debug_free(file,line,item);
#elif defined(__TURBOC__)
  farfree(item);
#else 
  free(item);
#endif /* THINK_C || macintosh */
}
예제 #30
0
void table::scrollright()
{
	void far *bitmap=(void far*)farmalloc(visiblecolumns*visiblerows+10);
	if(windowposx+visiblecolumns<COLS-1)
	{
		windowposx++;

		getimage(x1+colwidth,y1,x2,y2,bitmap);
		putimage(x1,y1,bitmap,0);
		for(int loop=windowposy;loop<visiblerows+windowposy;loop++)
			drawvalue(windowposx+visiblecolumns-1,loop);

		//draw();
	}
	farfree(bitmap);
}