static _EGLThreadInfo *
_eglCreateThreadInfo(void)
{
- _EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
+ _EGLThreadInfo *t = calloc(1, sizeof(_EGLThreadInfo));
if (t)
_eglInitThreadInfo(t);
else
/* create a new display */
if (!dpy) {
- dpy = (_EGLDisplay *) calloc(1, sizeof(_EGLDisplay));
+ dpy = calloc(1, sizeof(_EGLDisplay));
if (dpy) {
_eglInitMutex(&dpy->Mutex);
dpy->Platform = plat;
}
/* allocate array of mode pointers */
- modeList = (_EGLMode **) malloc(modes_size * sizeof(_EGLMode *));
+ modeList = malloc(modes_size * sizeof(_EGLMode *));
if (!modeList) {
_eglError(EGL_BAD_MODE_MESA, "eglChooseModeMESA(out of memory)");
return EGL_FALSE;
if (num_modes > _EGL_SCREEN_MAX_MODES)
num_modes = _EGL_SCREEN_MAX_MODES;
- screen->Modes = (_EGLMode *) calloc(num_modes, sizeof(*screen->Modes));
+ screen->Modes = calloc(num_modes, sizeof(*screen->Modes));
screen->NumModes = (screen->Modes) ? num_modes : 0;
}
if (!blocksize)
blocksize = 2*POOL_LARGE_ALLOC;
- newblock = (struct memory_block*)malloc(blocksize);
+ newblock = malloc(blocksize);
newblock->next = pool->blocks;
pool->blocks = newblock;
return ptr;
} else {
- struct memory_block * block = (struct memory_block*)malloc(bytes + sizeof(struct memory_block));
+ struct memory_block * block = malloc(bytes + sizeof(struct memory_block));
block->next = pool->blocks;
pool->blocks = block;
do { \
assert(sizeof(*(ptr)) == sizeof(uint32_t)); \
cs_count = (size); \
- cs_ptr = (ptr) = (uint32_t*)malloc((size) * sizeof(uint32_t)); \
+ cs_ptr = (ptr) = malloc((size) * sizeof(uint32_t)); \
} while (0)
#define END_CB do { \
uint32_t *cs_ptr = NULL; (void) cs_ptr
#define NEW_CB(ptr, size) \
- cs_ptr = (ptr) = (uint32_t*)malloc((size) * sizeof(uint32_t))
+ cs_ptr = (ptr) = malloc((size) * sizeof(uint32_t))
#define BEGIN_CB(ptr, size) cs_ptr = (ptr)
#define END_CB
COMPUTE_DBG(" Aligned size = %d\n", new_size_in_dw);
compute_memory_shadow(pool, pipe, 1);
- pool->shadow = (uint32_t*)realloc(pool->shadow, new_size_in_dw*4);
+ pool->shadow = realloc(pool->shadow, new_size_in_dw*4);
pool->size_in_dw = new_size_in_dw;
pool->screen->screen.resource_destroy(
(struct pipe_screen *)pool->screen,
{
struct r600_cf_stack_entry *sp = &ctx->bc->fc_stack[fc_sp];
- sp->mid = (struct r600_bytecode_cf **)realloc((void *)sp->mid,
+ sp->mid = realloc((void *)sp->mid,
sizeof(struct r600_bytecode_cf *) * (sp->num_mid + 1));
sp->mid[sp->num_mid] = ctx->bc->cf_last;
sp->num_mid++;
next = &base;
for (i = 0; i < count; i++) {
- *next = (__GLcontextModes *) malloc(size);
+ *next = malloc(size);
if (*next == NULL) {
_gl_context_modes_destroy(base);
base = NULL;
length = reply.length * 4;
numbytes = reply.size;
- buf = (char *) malloc(numbytes);
+ buf = malloc(numbytes);
if (buf != NULL) {
_XRead(dpy, buf, numbytes);
length -= numbytes;
/*
** Allocate memory for all the pieces needed for this buffer.
*/
- private = (XExtData *) malloc(sizeof(XExtData));
+ private = malloc(sizeof(XExtData));
if (!private)
return NULL;
- dpyPriv = (__GLXdisplayPrivate *) calloc(1, sizeof(__GLXdisplayPrivate));
+ dpyPriv = calloc(1, sizeof(__GLXdisplayPrivate));
if (!dpyPriv) {
free(private);
return NULL;
/* Create a temporary XImage */
img = XCreateImage( dpy, visinfo->visual, visinfo->depth,
ZPixmap, 0, /*format, offset*/
- (char*) malloc(8), /*data*/
+ malloc(8), /*data*/
1, 1, /*width, height*/
32, /*bitmap_pad*/
0 /*bytes_per_line*/
vg_validate_state(ctx);
buffer_len = 8 + 2 * 4 * kernel_size;
- buffer = (VGfloat*)malloc(buffer_len * sizeof(VGfloat));
+ buffer = malloc(buffer_len * sizeof(VGfloat));
buffer[0] = 0.f;
buffer[1] = 1.f;
stdDeviationX, stdDeviationY);
buffer_len = 8 + 2 * 4 * kernel_size;
- buffer = (VGfloat*)malloc(buffer_len * sizeof(VGfloat));
+ buffer = malloc(buffer_len * sizeof(VGfloat));
buffer[0] = 0.f;
buffer[1] = 1.f;
struct polygon * polygon_create(int size)
{
- struct polygon *poly = (struct polygon*)malloc(sizeof(struct polygon));
+ struct polygon *poly = malloc(sizeof(struct polygon));
poly->data = malloc(sizeof(float) * COMPONENTS * size);
poly->size = size;
void polygon_resize(struct polygon *poly, int new_size)
{
- float *data = (float*)malloc(sizeof(float) * COMPONENTS * new_size);
+ float *data = malloc(sizeof(float) * COMPONENTS * new_size);
int size = MIN2(sizeof(float) * COMPONENTS * new_size,
sizeof(float) * COMPONENTS * poly->size);
memcpy(data, poly->data, size);
out = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
if (num_consts >= 1) {
- constant = (struct ureg_src *) malloc(sizeof(struct ureg_src) * end_const);
+ constant = malloc(sizeof(struct ureg_src) * end_const);
for (i = start_const; i < end_const; i++) {
constant[i] = ureg_DECL_constant(ureg, i);
}
}
if (num_temps >= 1) {
- temp = (struct ureg_dst *) malloc(sizeof(struct ureg_dst) * end_temp);
+ temp = malloc(sizeof(struct ureg_dst) * end_temp);
for (i = start_temp; i < end_temp; i++) {
temp[i] = ureg_DECL_temporary(ureg);
}
}
if (num_samplers >= 1) {
- sampler = (struct ureg_src *) malloc(sizeof(struct ureg_src) * end_sampler);
+ sampler = malloc(sizeof(struct ureg_src) * end_sampler);
for (i = start_sampler; i < end_sampler; i++) {
sampler[i] = ureg_DECL_sampler(ureg, i);
}
csc->nrelocs += 10;
size = csc->nrelocs * sizeof(struct radeon_bo*);
- csc->relocs_bo = (struct radeon_bo**)realloc(csc->relocs_bo, size);
+ csc->relocs_bo = realloc(csc->relocs_bo, size);
size = csc->nrelocs * sizeof(struct drm_radeon_cs_reloc);
- csc->relocs = (struct drm_radeon_cs_reloc*)realloc(csc->relocs, size);
+ csc->relocs = realloc(csc->relocs, size);
csc->chunks[1].chunk_data = (uint64_t)(uintptr_t)csc->relocs;
}
}
if (rep.length) {
- if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) {
+ if (!(*busIdString = calloc(rep.busIdStringLength + 1, 1))) {
_XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
if (rep.length) {
if (!
(*clientDriverName =
- (char *) calloc(rep.clientDriverNameLength + 1, 1))) {
+ calloc(rep.clientDriverNameLength + 1, 1))) {
_XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
if (*numClipRects) {
int len = sizeof(drm_clip_rect_t) * (*numClipRects);
- *pClipRects = (drm_clip_rect_t *) calloc(len, 1);
+ *pClipRects = calloc(len, 1);
if (*pClipRects)
_XRead(dpy, (char *) *pClipRects, len);
}
if (*numBackClipRects) {
int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
- *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1);
+ *pBackClipRects = calloc(len, 1);
if (*pBackClipRects)
_XRead(dpy, (char *) *pBackClipRects, len);
}
*devPrivateSize = rep.devPrivateSize;
if (rep.length) {
- if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) {
+ if (!(*pDevPrivate = calloc(rep.devPrivateSize, 1))) {
_XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
if (!(sp = *spp)) {
- sp = (__GLXattribute *) malloc(sizeof(__GLXattribute));
+ sp = malloc(sizeof(__GLXattribute));
*spp = sp;
}
sp->mask = mask;
length = reply.length;
if (length) {
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
- data = (CARD32 *) malloc(length * sizeof(CARD32));
+ data = malloc(length * sizeof(CARD32));
if (data == NULL) {
/* Throw data on the floor */
_XEatData(dpy, length);
length = reply.length * 4;
numbytes = reply.size;
- buf = (char *) malloc(numbytes);
+ buf = malloc(numbytes);
if (buf != NULL) {
_XRead(dpy, buf, numbytes);
length -= numbytes;
__glXstrdup(const char *str)
{
char *copy;
- copy = (char *) malloc(strlen(str) + 1);
+ copy = malloc(strlen(str) + 1);
if (!copy)
return NULL;
strcpy(copy, str);
next = &base;
for (i = 0; i < count; i++) {
- *next = (struct glx_config *) malloc(size);
+ *next = malloc(size);
if (*next == NULL) {
glx_config_destroy_list(base);
base = NULL;
*/
bufSize = (XMaxRequestSize(psc->dpy) * 4) - sz_xGLXRenderReq;
- gc->buf = (GLubyte *) malloc(bufSize);
+ gc->buf = malloc(bufSize);
if (!gc->buf) {
free(gc->client_state_private);
free(gc);
if (stride != k) {
GLubyte *buf;
- buf = (GLubyte *) malloc(compsize);
+ buf = malloc(compsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
if (stride != k) {
GLubyte *buf;
- buf = (GLubyte *) malloc(compsize);
+ buf = malloc(compsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
if ((vstr != k) || (ustr != k * vord)) {
GLdouble *buf;
- buf = (GLdouble *) malloc(compsize);
+ buf = malloc(compsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
if ((vstr != k) || (ustr != k * vord)) {
GLfloat *buf;
- buf = (GLfloat *) malloc(compsize);
+ buf = malloc(compsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
GLubyte * pc, GLubyte * modes)
{
/* Allocate a temporary holding buffer */
- GLubyte *buf = (GLubyte *) malloc(compsize);
+ GLubyte *buf = malloc(compsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
pc += hdrlen;
/* Allocate a temporary holding buffer */
- buf = (GLubyte *) malloc(bufsize);
+ buf = malloc(bufsize);
if (!buf) {
__glXSetError(gc, GL_OUT_OF_MEMORY);
return;
heightsize = __glImageSize(height, 1, 1, format, type, 0);
/* Allocate a holding buffer to transform the data from */
- rowBuf = (GLubyte *) malloc(widthsize);
+ rowBuf = malloc(widthsize);
if (!rowBuf) {
/* Throw data away */
_XEatData(dpy, compsize);
__glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
free((char *) rowBuf);
}
- colBuf = (GLubyte *) malloc(heightsize);
+ colBuf = malloc(heightsize);
if (!colBuf) {
/* Throw data away */
_XEatData(dpy, compsize - __GLX_PAD(widthsize));
const GLint heightsize =
__glImageSize(height, 1, 1, format, type, 0);
GLubyte *const buf =
- (GLubyte *) malloc((widthsize > heightsize) ? widthsize : heightsize);
+ malloc((widthsize > heightsize) ? widthsize : heightsize);
if (buf == NULL) {
/* Throw data away */
max_bm_width = (max_width + 7) / 8;
max_bm_height = max_height;
- bm = (GLubyte *) malloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
+ bm = malloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
if (!bm) {
XFreeFontInfo(NULL, fs, 1);
__glXSetError(CC, GL_OUT_OF_MEMORY);
str_dup(const char *str)
{
char *copy;
- copy = (char*) malloc(strlen(str) + 1);
+ copy = malloc(strlen(str) + 1);
if (!copy)
return NULL;
strcpy(copy, str);
}
if (mask & GL_DEPTH_BUFFER_BIT) {
- GLuint *tmp = (GLuint *) malloc(srcW * srcH * sizeof(GLuint));
+ GLuint *tmp = malloc(srcW * srcH * sizeof(GLuint));
if (tmp) {
if (!blit->DepthFP)
init_blit_depth_pixels(ctx);
return;
}
- bitmap8 = (GLubyte *) malloc(width * height);
+ bitmap8 = malloc(width * height);
if (bitmap8) {
memset(bitmap8, bg, width * height);
_mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
GLuint size, i;
size = cache->size * 3;
- items = (struct brw_cache_item**) calloc(1, size * sizeof(*items));
+ items = calloc(1, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
for (c = cache->items[i]; c; c = next) {
cache->size = 7;
cache->n_items = 0;
- cache->items = (struct brw_cache_item **)
+ cache->items =
calloc(1, cache->size * sizeof(struct brw_cache_item));
cache->bo = drm_intel_bo_alloc(intel->bufmgr,
assert(screen);
/* Allocate the R200 context */
- rmesa = (r200ContextPtr) calloc(1, sizeof(*rmesa));
+ rmesa = calloc(1, sizeof(*rmesa));
if ( !rmesa ) {
*error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
if (j == reg->nalloc) {
reg->nalloc += 5;
reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
+ reg->values = realloc( reg->values, reg->nalloc * sizeof(union fi) );
}
reg->values[reg->nvalues++].i = val;
assert(screen);
/* Allocate the Radeon context */
- rmesa = (r100ContextPtr) calloc(1, sizeof(*rmesa));
+ rmesa = calloc(1, sizeof(*rmesa));
if ( !rmesa ) {
*error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ)
{
radeon->query.queryobj.cmd_size = (SZ);
- radeon->query.queryobj.cmd = (uint32_t*) calloc(SZ, sizeof(uint32_t));
+ radeon->query.queryobj.cmd = calloc(SZ, sizeof(uint32_t));
radeon->query.queryobj.name = "queryobj";
radeon->query.queryobj.idx = 0;
radeon->query.queryobj.check = radeon_check_query_active;
if (j == reg->nalloc) {
reg->nalloc += 5;
reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
+ reg->values = realloc( reg->values, reg->nalloc * sizeof(union fi) );
}
reg->values[reg->nvalues++].i = val;
uint32_t device_id = 0;
/* Allocate the private area */
- screen = (radeonScreenPtr) calloc(1, sizeof(*screen));
+ screen = calloc(1, sizeof(*screen));
if ( !screen ) {
fprintf(stderr, "%s: Could not allocate memory for screen structure", __FUNCTION__);
fprintf(stderr, "leaving here\n");
VERIFY(GetTextMetrics(fontDevice, &metric));
- dibInfo = (BITMAPINFO *) calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
+ dibInfo = calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dibInfo->bmiHeader.biPlanes = 1;
dibInfo->bmiHeader.biBitCount = 1;
wmesa_new_framebuffer(HDC hdc, struct gl_config *visual)
{
WMesaFramebuffer pwfb
- = (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
+ = malloc(sizeof(struct wmesa_framebuffer));
if (pwfb) {
_mesa_initialize_window_framebuffer(&pwfb->Base, visual);
pwfb->hDC = hdc;
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
+ xmvis->vishandle = malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
if (*nelements > 0) {
XMesaVisual *results;
- results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
+ results = malloc(*nelements * sizeof(XMesaVisual));
if (!results) {
*nelements = 0;
return NULL;
xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
if (xmvis) {
- GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
+ GLXFBConfig *config = malloc(sizeof(XMesaVisual));
if (!config) {
*nitems = 0;
return NULL;
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
+ xmvis->vishandle = malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
if (t) {
struct display_dispatch *d;
- d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch));
+ d = malloc(sizeof(struct display_dispatch));
if (d) {
d->Dpy = dpy;
d->Table = t;
max_bm_width = (max_width + 7) / 8;
max_bm_height = max_height;
- bm = (GLubyte *) malloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
+ bm = malloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
if (!bm) {
XFreeFontInfo(NULL, fs, 1);
_mesa_error(NULL, GL_OUT_OF_MEMORY,
/* Create a temporary XImage */
img = XCreateImage( dpy, visinfo->visual, visinfo->depth,
ZPixmap, 0, /*format, offset*/
- (char*) malloc(8), /*data*/
+ malloc(8), /*data*/
1, 1, /*width, height*/
32, /*bitmap_pad*/
0 /*bytes_per_line*/
_mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.\n");
return;
}
- b->backxrb->ximage->data = (char *) malloc(b->backxrb->ximage->height
+ b->backxrb->ximage->data = malloc(b->backxrb->ximage->height
* b->backxrb->ximage->bytes_per_line);
if (!b->backxrb->ximage->data) {
_mesa_warning(NULL, "alloc_back_buffer: MALLOC failed.\n");
int bytes_per_line =
_mesa_format_row_stride(xrb->Base.Base.Format,
xrb->Base.Base.Width);
- char *image = (char *) malloc(bytes_per_line *
+ char *image = malloc(bytes_per_line *
xrb->Base.Base.Height);
ximage = XCreateImage(xrb->Parent->display,
xrb->Parent->xm_visual->visinfo->visual,
GLuint i, j;
GLfloat (*rgba)[4];
- rgba = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
+ rgba = malloc(width * 4 * sizeof(GLfloat));
if (rgba) {
for (j = 0; j < height; j++) {
GLshort *acc = (GLshort *) accMap;
GLint i, j;
GLfloat (*rgba)[4], (*dest)[4];
- rgba = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
- dest = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
+ rgba = malloc(width * 4 * sizeof(GLfloat));
+ dest = malloc(width * 4 * sizeof(GLfloat));
if (rgba && dest) {
for (j = 0; j < height; j++) {
a start */
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
ctx->ATIFragmentShader.Current->Instructions[i] =
- (struct atifs_instruction *)
calloc(1, sizeof(struct atifs_instruction) *
(MAX_NUM_INSTRUCTIONS_PER_PASS_ATI));
ctx->ATIFragmentShader.Current->SetupInst[i] =
- (struct atifs_setupinst *)
calloc(1, sizeof(struct atifs_setupinst) *
(MAX_NUM_FRAGMENT_REGISTERS_ATI));
}
if (mask & GL_POLYGON_STIPPLE_BIT) {
GLuint *stipple;
- stipple = (GLuint *) malloc( 32*sizeof(GLuint) );
+ stipple = malloc( 32*sizeof(GLuint) );
memcpy( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
save_attrib_data(&head, GL_POLYGON_STIPPLE_BIT, stipple);
}
/* should never happen, but just in case */
numEntries = MAX2(numEntries, size);
- table = (struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc));
+ table = malloc(numEntries * sizeof(_glapi_proc));
if (table) {
_glapi_proc *entry = (_glapi_proc *) table;
GLint i;
ASSERT(visual);
/*ASSERT(driverContext);*/
- ctx = (struct gl_context *) calloc(1, sizeof(struct gl_context));
+ ctx = calloc(1, sizeof(struct gl_context));
if (!ctx)
return NULL;
#define MAX_STRING 50
char *buffer;
- buffer = (char *) malloc(MAX_STRING);
+ buffer = malloc(MAX_STRING);
if (!buffer)
return NULL;
GLubyte *buffer;
char s[100];
- buffer = (GLubyte *) malloc(img->Width * img->Height
+ buffer = malloc(img->Width * img->Height
* img->Depth * 4);
store = ctx->Pack; /* save */
return;
}
- buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4);
+ buffer = malloc(rb->Width * rb->Height * 4);
ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
format, type, &ctx->DefaultPacking, buffer);
const GLuint h = ctx->DrawBuffer->Height;
GLubyte *buf;
- buf = (GLubyte *) malloc(w * h * 4);
+ buf = malloc(w * h * 4);
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
GLubyte *buf2;
GLuint i;
- buf = (GLuint *) malloc(w * h * 4); /* 4 bpp */
- buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
+ buf = malloc(w * h * 4); /* 4 bpp */
+ buf2 = malloc(w * h * 3); /* 3 bpp */
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
GLubyte *buf2;
GLuint i;
- buf = (GLubyte *) malloc(w * h); /* 1 bpp */
- buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
+ buf = malloc(w * h); /* 1 bpp */
+ buf2 = malloc(w * h * 3); /* 3 bpp */
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
}
else if (format == GL_RGBA && type == GL_FLOAT) {
/* convert floats to ubyte */
- GLubyte *buf = (GLubyte *) malloc(w * h * 4 * sizeof(GLubyte));
+ GLubyte *buf = malloc(w * h * 4 * sizeof(GLubyte));
const GLfloat *f = (const GLfloat *) image;
GLuint i;
for (i = 0; i < w * h * 4; i++) {
}
else if (format == GL_RED && type == GL_FLOAT) {
/* convert floats to ubyte */
- GLubyte *buf = (GLubyte *) malloc(w * h * sizeof(GLubyte));
+ GLubyte *buf = malloc(w * h * sizeof(GLubyte));
const GLfloat *f = (const GLfloat *) image;
GLuint i;
for (i = 0; i < w * h; i++) {
{
struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
dlist->Name = name;
- dlist->Head = (Node *) malloc(sizeof(Node) * count);
+ dlist->Head = malloc(sizeof(Node) * count);
dlist->Head[0].opcode = OPCODE_END_OF_LIST;
return dlist;
}
Node *newblock;
n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
n[0].opcode = OPCODE_CONTINUE;
- newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE);
+ newblock = malloc(sizeof(Node) * BLOCK_SIZE);
if (!newblock) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
return NULL;
if (n) {
n[1].e = map;
n[2].i = mapsize;
- n[3].data = (void *) malloc(mapsize * sizeof(GLfloat));
+ n[3].data = malloc(mapsize * sizeof(GLfloat));
memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
if (n) {
- GLubyte *programCopy = (GLubyte *) malloc(len);
+ GLubyte *programCopy = malloc(len);
if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
if (n) {
- GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint));
+ GLuint *idCopy = malloc(num * sizeof(GLuint));
if (!idCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
return;
n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
if (n) {
- GLubyte *nameCopy = (GLubyte *) malloc(len);
+ GLubyte *nameCopy = malloc(len);
if (!nameCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
return;
n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
if (n) {
- GLubyte *programCopy = (GLubyte *) malloc(len);
+ GLubyte *programCopy = malloc(len);
if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return;
if (!points || !size)
return NULL;
- buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
+ buffer = malloc(uorder * size * sizeof(GLfloat));
if (buffer)
for (i = 0, p = buffer; i < uorder; i++, points += ustride)
if (!points || !size)
return NULL;
- buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
+ buffer = malloc(uorder * size * sizeof(GLfloat));
if (buffer)
for (i = 0, p = buffer; i < uorder; i++, points += ustride)
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
map->Order = 1;
map->u1 = 0.0;
map->u2 = 1.0;
- map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
+ map->Points = malloc(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
map->u2 = 1.0;
map->v1 = 0.0;
map->v2 = 1.0;
- map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
+ map->Points = malloc(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
if (extra_extensions != NULL)
length += 1 + strlen(extra_extensions); /* +1 for space */
- exts = (char *) calloc(ALIGN(length + 1, 4), sizeof(char));
+ exts = calloc(ALIGN(length + 1, 4), sizeof(char));
if (exts == NULL) {
free(extra_extensions);
return NULL;
default:
/* get float values, convert to ubyte */
{
- GLfloat *tmp = (GLfloat *) malloc(n * 4 * sizeof(GLfloat));
+ GLfloat *tmp = malloc(n * 4 * sizeof(GLfloat));
if (tmp) {
GLuint i;
_mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp);
ASSERT( alignment > 0 );
- ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *));
+ ptr = malloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
ASSERT( alignment > 0 );
- ptr = (uintptr_t) calloc(1, bytes + alignment + sizeof(void *));
+ ptr = calloc(1, bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
{
if (s) {
size_t l = strlen(s);
- char *s2 = (char *) malloc(l + 1);
+ char *s2 = malloc(l + 1);
if (s2)
strcpy(s2, s);
return s2;
stack->MaxDepth = maxDepth;
stack->DirtyFlag = dirtyFlag;
/* The stack */
- stack->Stack = (GLmatrix *) calloc(maxDepth, sizeof(GLmatrix));
+ stack->Stack = calloc(maxDepth, sizeof(GLmatrix));
for (i = 0; i < maxDepth; i++) {
_math_matrix_ctr(&stack->Stack[i]);
}
}
/* Map src texture image slices */
- srcMaps = (GLubyte **) calloc(srcDepth, sizeof(GLubyte *));
+ srcMaps = calloc(srcDepth, sizeof(GLubyte *));
if (srcMaps) {
for (slice = 0; slice < srcDepth; slice++) {
ctx->Driver.MapTextureImage(ctx, srcImage, slice,
}
/* Map dst texture image slices */
- dstMaps = (GLubyte **) calloc(dstDepth, sizeof(GLubyte *));
+ dstMaps = calloc(dstDepth, sizeof(GLubyte *));
if (dstMaps) {
for (slice = 0; slice < dstDepth; slice++) {
ctx->Driver.MapTextureImage(ctx, dstImage, slice,
/* allocate storage for the temporary, uncompressed image */
/* 20 extra bytes, just be safe when calling last FetchTexel */
temp_src_stride = _mesa_format_row_stride(temp_format, srcImage->Width);
- temp_src = (GLubyte *) malloc(temp_src_stride * srcImage->Height + 20);
+ temp_src = malloc(temp_src_stride * srcImage->Height + 20);
if (!temp_src) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
return;
temp_dst_stride = _mesa_format_row_stride(temp_format, dstWidth);
if (!temp_dst) {
- temp_dst = (GLubyte *) malloc(temp_dst_stride * dstHeight);
+ temp_dst = malloc(temp_dst_stride * dstHeight);
if (!temp_dst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
break;
if (!size)
return NULL;
- heap = (struct mem_block *) calloc(1, sizeof(struct mem_block));
+ heap = calloc(1, sizeof(struct mem_block));
if (!heap)
return NULL;
- block = (struct mem_block *) calloc(1, sizeof(struct mem_block));
+ block = calloc(1, sizeof(struct mem_block));
if (!block) {
free(heap);
return NULL;
/* break left [p, newblock, p->next], then p = newblock */
if (startofs > p->ofs) {
- newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
+ newblock = calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs;
/* break right, also [p, newblock, p->next] */
if (size < p->size) {
- newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
+ newblock = calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs + size;
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) malloc( bytes );
+ buffer = malloc( bytes );
if (!buffer)
return NULL;
dstFormat == GL_LUMINANCE_ALPHA ||
dstFormat == GL_LUMINANCE_INTEGER_EXT ||
dstFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT) {
- luminance = (GLfloat *) malloc(n * sizeof(GLfloat));
+ luminance = malloc(n * sizeof(GLfloat));
if (!luminance) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
return;
{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
* Extract image data and convert to RGBA floats
*/
if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
GLboolean intFormat = _mesa_is_enum_format_integer(srcFormat);
if (!rgba) {
* Extract image data and convert to RGBA floats
*/
if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking)
{
- GLuint (*rgba)[4] = (GLuint (*)[4]) malloc(n * 4 * sizeof(GLfloat));
+ GLuint (*rgba)[4] = malloc(n * 4 * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
GLint dstComponents;
GLbyte *dst = dest;
GLuint i;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
/*
* general solution
*/
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
const struct gl_pixelstore_attrib *dstPacking,
GLbitfield transferOps )
{
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
/*
* general solution
*/
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil unpacking");
GLenum dstType, GLvoid *dest, const GLubyte *source,
const struct gl_pixelstore_attrib *dstPacking )
{
- GLubyte *stencil = (GLubyte *) malloc(n * sizeof(GLubyte));
+ GLubyte *stencil = malloc(n * sizeof(GLubyte));
if (!stencil) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing");
depthValues = (GLfloat *) dest;
}
else {
- depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
+ depthTemp = malloc(n * sizeof(GLfloat));
if (!depthTemp) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
return;
GLenum dstType, const GLfloat *depthSpan,
const struct gl_pixelstore_attrib *dstPacking )
{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
+ GLfloat *depthCopy = malloc(n * sizeof(GLfloat));
if (!depthCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
return;
const GLubyte *stencilVals,
const struct gl_pixelstore_attrib *dstPacking)
{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
- GLubyte *stencilCopy = (GLubyte *) malloc(n * sizeof(GLubyte));
+ GLfloat *depthCopy = malloc(n * sizeof(GLfloat));
+ GLubyte *stencilCopy = malloc(n * sizeof(GLubyte));
GLuint i;
if (!depthCopy || !stencilCopy) {
{
GLubyte *destBuffer
- = (GLubyte *) malloc(bytesPerRow * height * depth);
+ = malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)
return;
}
- depthValues = (GLfloat *) malloc(width * sizeof(GLfloat));
+ depthValues = malloc(width * sizeof(GLfloat));
if (depthValues) {
/* General case (slower) */
return;
}
- stencil = (GLubyte *) malloc(width * sizeof(GLubyte));
+ stencil = malloc(width * sizeof(GLubyte));
if (stencil) {
/* process image row by row */
return GL_TRUE; /* don't bother trying the slow path */
}
- stencilVals = (GLubyte *) malloc(width * sizeof(GLubyte));
+ stencilVals = malloc(width * sizeof(GLubyte));
if (stencilVals) {
for (j = 0; j < height; j++) {
stencilStride = depthStride;
}
- stencilVals = (GLubyte *) malloc(width * sizeof(GLubyte));
- depthVals = (GLfloat *) malloc(width * sizeof(GLfloat));
+ stencilVals = malloc(width * sizeof(GLubyte));
+ depthVals = malloc(width * sizeof(GLfloat));
if (stencilVals && depthVals) {
for (j = 0; j < height; j++) {
_mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);
/* alloc new, smaller array */
- newList = (struct gl_shader **)
+ newList =
malloc((n - 1) * sizeof(struct gl_shader *));
if (!newList) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
return NULL;
}
- buffer = (char *) malloc(max);
+ buffer = malloc(max);
len = fread(buffer, 1, max, f);
buffer[len] = 0;
* This array holds offsets of where the appropriate string ends, thus the
* last element will be set to the total length of the source code.
*/
- offsets = (GLint *) malloc(count * sizeof(GLint));
+ offsets = malloc(count * sizeof(GLint));
if (offsets == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
return;
* valgrind warnings in the parser/grammer code.
*/
totalLength = offsets[count - 1] + 2;
- source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB));
+ source = malloc(totalLength * sizeof(GLcharARB));
if (source == NULL) {
free((GLvoid *) offsets);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
/* allocate and fill dest image buffer */
if (palette) {
- image = (GLubyte *) malloc(num_texels * info->size);
+ image = malloc(num_texels * info->size);
paletted_to_color(info, palette, indices, num_texels, image);
}
const GLint height = texImage->Height;
const GLint depth = texImage->Depth;
GLint img, row;
- GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat));
+ GLfloat *depthRow = malloc(width * sizeof(GLfloat));
if (!depthRow) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
GLuint row;
/* Decompress into temp float buffer, then pack into user buffer */
- tempImage = (GLfloat *) malloc(width * height * depth
+ tempImage = malloc(width * height * depth
* 4 * sizeof(GLfloat));
if (!tempImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
GLboolean tex_is_uint = _mesa_is_format_unsigned(texImage->TexFormat);
/* Allocate buffer for one row of texels */
- rgba = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+ rgba = malloc(4 * width * sizeof(GLfloat));
rgba_uint = (GLuint (*)[4]) rgba;
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
textureBaseFormat == GL_INTENSITY ||
textureBaseFormat == GL_DEPTH_COMPONENT);
- tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
+ tempImage = malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLfloat));
if (!tempImage)
return NULL;
*/
ASSERT(texComponents >= logComponents);
- newImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
+ newImage = malloc(srcWidth * srcHeight * srcDepth
* texComponents * sizeof(GLfloat));
if (!newImage) {
free(tempImage);
textureBaseFormat == GL_INTENSITY ||
textureBaseFormat == GL_ALPHA);
- tempImage = (GLuint *) malloc(srcWidth * srcHeight * srcDepth
+ tempImage = malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLuint));
if (!tempImage)
return NULL;
*/
ASSERT(texComponents >= logComponents);
- newImage = (GLuint *) malloc(srcWidth * srcHeight * srcDepth
+ newImage = malloc(srcWidth * srcHeight * srcDepth
* texComponents * sizeof(GLuint));
if (!newImage) {
free(tempImage);
textureBaseFormat == GL_INTENSITY);
/* unpack and transfer the source image */
- tempImage = (GLubyte *) malloc(srcWidth * srcHeight * srcDepth
+ tempImage = malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLubyte));
if (!tempImage) {
return NULL;
*/
ASSERT(texComponents >= logComponents);
- newImage = (GLubyte *) malloc(srcWidth * srcHeight * srcDepth
+ newImage = malloc(srcWidth * srcHeight * srcDepth
* texComponents * sizeof(GLubyte));
if (!newImage) {
free(tempImage);
GLbyte *tempImage, *dst, *src;
GLint row;
- tempImage = (GLbyte *) malloc(srcWidth * srcHeight * srcDepth
+ tempImage = malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLbyte));
if (!tempImage)
return GL_FALSE;
}
else if (srcFormat == GL_DEPTH_COMPONENT ||
srcFormat == GL_STENCIL_INDEX) {
- GLuint *depth = (GLuint *) malloc(srcWidth * sizeof(GLuint));
- GLubyte *stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
+ GLuint *depth = malloc(srcWidth * sizeof(GLuint));
+ GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte));
if (!depth || !stencil) {
free(depth);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
srcType == GL_UNSIGNED_INT_24_8_EXT);
- depth = (GLuint *) malloc(srcWidth * sizeof(GLuint));
- stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
+ depth = malloc(srcWidth * sizeof(GLuint));
+ stencil = malloc(srcWidth * sizeof(GLubyte));
if (!depth || !stencil) {
free(depth);
const GLint srcRowStride
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
GLint img, row;
- GLubyte *stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
+ GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte));
if (!stencil)
return GL_FALSE;
/* allocate new memory for varying names */
shProg->TransformFeedback.VaryingNames =
- (GLchar **) malloc(count * sizeof(GLchar *));
+ malloc(count * sizeof(GLchar *));
if (!shProg->TransformFeedback.VaryingNames) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTransformFeedbackVaryings()");
enum gl_uniform_driver_format format,
void *data)
{
- uni->driver_storage = (struct gl_uniform_driver_storage*)
+ uni->driver_storage =
realloc(uni->driver_storage,
sizeof(struct gl_uniform_driver_storage)
* (uni->num_driver_storage + 1));
override_version(ctx);
- ctx->VersionString = (char *) malloc(max);
+ ctx->VersionString = malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"%u.%u Mesa " MESA_VERSION_STRING
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
}
- ctx->VersionString = (char *) malloc(max);
+ ctx->VersionString = malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"OpenGL ES-CM 1.%d Mesa " MESA_VERSION_STRING
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
}
- ctx->VersionString = (char *) malloc(max);
+ ctx->VersionString = malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"OpenGL ES 2.0 Mesa " MESA_VERSION_STRING
return NULL;
if (pgsize == 0)
pgsize = getpagesize();
- curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2);
+ curobj = malloc(n + EXTRABYTES + pgsize * 2);
if (curobj == NULL)
return NULL;
e = curobj + n + EXTRABYTES;
(void) cycles;
- mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
+ mat->m = _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
mat->inv = m = mat->m;
init_matrix( m );
return 0;
}
- mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
+ mat->m = _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
mat->type = mtypes[mtype];
m = mat->m;
void
_math_matrix_ctr( GLmatrix *m )
{
- m->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
+ m->m = _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
if (m->m)
memcpy( m->m, Identity, sizeof(Identity) );
- m->inv = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
+ m->inv = _mesa_align_malloc( 16 * sizeof(GLfloat), 16 );
if (m->inv)
memcpy( m->inv, Identity, sizeof(Identity) );
m->type = MATRIX_IDENTITY;
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
+ msg = malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) malloc(len + 1);
+ programString = malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
+ msg = malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) malloc(len + 1);
+ programString = malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
cache->last = NULL;
size = cache->size * 3;
- items = (struct cache_item**) malloc(size * sizeof(*items));
+ items = malloc(size * sizeof(*items));
memset(items, 0, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
struct gl_program_cache *cache = CALLOC_STRUCT(gl_program_cache);
if (cache) {
cache->size = 17;
- cache->items = (struct cache_item **)
+ cache->items =
calloc(1, cache->size * sizeof(struct cache_item));
if (!cache->items) {
free(cache);
struct prog_instruction *
_mesa_alloc_instructions(GLuint numInst)
{
- return (struct prog_instruction *)
+ return
calloc(1, numInst * sizeof(struct prog_instruction));
}
/*_mesa_print_program(prog);*/
}
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/* Determine which temps are read and written */
GLboolean *removeInst;
GLuint i, arg, rem = 0;
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
for (i = 0; i < prog->NumInstructions; i++) {
_mesa_print_program(prog);
}
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/*
while (*p != 0 && *p != '\n')
p++;
len = p - lineStart;
- s = (GLubyte *) malloc(len + 1);
+ s = malloc(len + 1);
memcpy(s, lineStart, len);
s[len] = 0;
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
- sValues = (GLubyte *) malloc(width * sizeof(GLubyte));
- zValues = (GLuint *) malloc(width * sizeof(GLuint));
+ sValues = malloc(width * sizeof(GLubyte));
+ zValues = malloc(width * sizeof(GLuint));
if (sValues && zValues) {
GLint row;
/* copy image from ptRead surface to ptTex surface */
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
- GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ GLfloat *buf = malloc(width * height * 4 * sizeof(GLfloat));
enum pipe_format readFormat, drawFormat;
readFormat = util_format_linear(rbRead->texture->format);
drawFormat = util_format_linear(pt->format);
}
else {
/* GL_DEPTH */
- GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
+ GLuint *buf = malloc(width * height * sizeof(GLuint));
pipe_get_tile_z(pipe, ptRead, 0, 0, readW, readH, buf);
pipe_put_tile_z(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
readW, readH, buf);
enum pipe_format pformat = util_format_linear(dst_texture->format);
GLfloat *rgba;
- rgba = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
+ rgba = malloc(width * 4 * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
goto end;
yStep = 1;
}
- data = (uint *) malloc(width * sizeof(uint));
+ data = malloc(width * sizeof(uint));
if (data) {
/* To avoid a large temp memory allocation, do copy row by row */
else {
/* RGBA format */
GLfloat *tempSrc =
- (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ malloc(width * height * 4 * sizeof(GLfloat));
if (tempSrc && texDest) {
const GLint dims = 2;
_swrast_CreateContext( struct gl_context *ctx )
{
GLuint i;
- SWcontext *swrast = (SWcontext *) calloc(1, sizeof(SWcontext));
+ SWcontext *swrast = calloc(1, sizeof(SWcontext));
#ifdef _OPENMP
const GLuint maxThreads = omp_get_max_threads();
#else
* using multiple threads, it is necessary to have one SpanArrays instance
* per thread.
*/
- swrast->SpanArrays = (SWspanarrays *) malloc(maxThreads * sizeof(SWspanarrays));
+ swrast->SpanArrays = malloc(maxThreads * sizeof(SWspanarrays));
if (!swrast->SpanArrays) {
free(swrast);
return GL_FALSE;
ctx->swrast_context = swrast;
- swrast->stencil_temp.buf1 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf2 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf3 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf4 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf1 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf2 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf3 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf4 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
if (!swrast->stencil_temp.buf1 ||
!swrast->stencil_temp.buf2 ||
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
- tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
+ tmpImage = malloc(width * height * sizeof(GLfloat) * 4);
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat));
+ tmpImage = malloc(width * height * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
p = NULL;
}
- depth = (GLfloat *) malloc(width * sizeof(GLfloat));
+ depth = malloc(width * sizeof(GLfloat));
if (!depth) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels()");
goto end;
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLubyte *) malloc(width * height * sizeof(GLubyte));
+ tmpImage = malloc(width * height * sizeof(GLubyte));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
p = NULL;
}
- stencil = (GLubyte *) malloc(width * sizeof(GLubyte));
+ stencil = malloc(width * sizeof(GLubyte));
if (!stencil) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels()");
goto end;
}
else {
/* copy Z buffer values into temp buffer (32-bit Z values) */
- zBufferTemp = (GLuint *) malloc(count * sizeof(GLuint));
+ zBufferTemp = malloc(count * sizeof(GLuint));
if (!zBufferTemp)
return 0;
GLuint *zBufferTemp;
const GLuint *zBufferVals;
- zBufferTemp = (GLuint *) malloc(count * sizeof(GLuint));
+ zBufferTemp = malloc(count * sizeof(GLuint));
if (!zBufferTemp) {
/* don't generate a stream of OUT_OF_MEMORY errors here */
return GL_FALSE;
GLint row;
GLubyte *values;
- values = (GLubyte *) malloc(width * sizeof(GLubyte));
+ values = malloc(width * sizeof(GLubyte));
if (!values) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
GLuint *zValues; /* 32-bit Z values */
GLint i;
- zValues = (GLuint *) malloc(width * sizeof(GLuint));
+ zValues = malloc(width * sizeof(GLuint));
if (!zValues) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
GLchan (*rgbaChan)[4] = span->array->rgba;
/* alloc temp pixel buffers */
- rgba = (float4_array) malloc(4 * n * sizeof(GLfloat));
+ rgba = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
return;
}
for (i = 0; i < numArgsRGB || i < numArgsA; i++) {
- ccolor[i] = (float4_array) malloc(4 * n * sizeof(GLfloat));
+ ccolor[i] = malloc(4 * n * sizeof(GLfloat));
if (!ccolor[i]) {
while (i) {
free(ccolor[i]);
* thread.
*/
swrast->TexelBuffer =
- (GLfloat *) malloc(ctx->Const.MaxTextureImageUnits * maxThreads *
+ malloc(ctx->Const.MaxTextureImageUnits * maxThreads *
SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
if (!swrast->TexelBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
}
}
- primary_rgba = (float4_array) malloc(span->end * 4 * sizeof(GLfloat));
+ primary_rgba = malloc(span->end * 4 * sizeof(GLfloat));
if (!primary_rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_span");
{
GLuint i;
if (!weightLut) {
- weightLut = (GLfloat *) malloc(WEIGHT_LUT_SIZE * sizeof(GLfloat));
+ weightLut = malloc(WEIGHT_LUT_SIZE * sizeof(GLfloat));
for (i = 0; i < WEIGHT_LUT_SIZE; ++i) {
GLfloat alpha = 2;
* We allocate the array for 1D/2D textures too in order to avoid special-
* case code in the texstore routines.
*/
- swImg->ImageOffsets = (GLuint *) malloc(texImage->Depth * sizeof(GLuint));
+ swImg->ImageOffsets = malloc(texImage->Depth * sizeof(GLuint));
if (!swImg->ImageOffsets)
return GL_FALSE;
ASSERT(zoomedWidth > 0);
ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
- zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte));
+ zoomedVals = malloc(zoomedWidth * sizeof(GLubyte));
if (!zoomedVals)
return;
ASSERT(zoomedWidth > 0);
ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
- zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint));
+ zoomedVals = malloc(zoomedWidth * sizeof(GLuint));
if (!zoomedVals)
return;
GLboolean
_swsetup_CreateContext( struct gl_context *ctx )
{
- SScontext *swsetup = (SScontext *) calloc(1, sizeof(SScontext));
+ SScontext *swsetup = calloc(1, sizeof(SScontext));
if (!swsetup)
return GL_FALSE;
/* Create the TNLcontext structure
*/
- ctx->swtnl_context = tnl = (TNLcontext *) calloc(1, sizeof(TNLcontext));
+ ctx->swtnl_context = tnl = calloc(1, sizeof(TNLcontext));
if (!tnl) {
return GL_FALSE;
/* a few other misc allocations */
_mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 );
- store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 );
+ store->clipmask = _mesa_align_malloc(sizeof(GLubyte)*size, 32 );
return GL_TRUE;
}
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
- store->tmp_f = (GLfloat (*)[3]) malloc(VB->Size * sizeof(GLfloat) * 3);
- store->tmp_m = (GLfloat *) malloc(VB->Size * sizeof(GLfloat));
+ store->tmp_f = malloc(VB->Size * sizeof(GLfloat) * 3);
+ store->tmp_m = malloc(VB->Size * sizeof(GLfloat));
return GL_TRUE;
}
_mesa_vector4f_alloc( &store->clip, 0, size, 32 );
_mesa_vector4f_alloc( &store->proj, 0, size, 32 );
- store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 );
+ store->clipmask = _mesa_align_malloc(sizeof(GLubyte)*size, 32 );
if (!store->clipmask ||
!store->eye.data ||
fastpath->attr_count = vtx->attr_count;
fastpath->match_strides = match_strides;
fastpath->func = vtx->emit;
- fastpath->attr = (struct tnl_attr_type *)
+ fastpath->attr =
malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
for (i = 0; i < vtx->attr_count; i++) {
if (max_vertex_size > vtx->max_vertex_size) {
_tnl_free_vertices( ctx );
vtx->max_vertex_size = max_vertex_size;
- vtx->vertex_buf = (GLubyte *)_mesa_align_calloc(vb_size * max_vertex_size, 32 );
+ vtx->vertex_buf = _mesa_align_calloc(vb_size * max_vertex_size, 32 );
invalidate_funcs(vtx);
}
ctx->Shared->NullBufferObj);
ASSERT(!exec->vtx.buffer_map);
- exec->vtx.buffer_map = (GLfloat *)_mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64);
+ exec->vtx.buffer_map = _mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
vbo_exec_vtxfmt_init( exec );
GLuint scan_index;
unsigned scan_num;
- sub_prims = (struct sub_primitive *)
+ sub_prims =
malloc(max_prims * sizeof(struct sub_primitive));
if (!sub_prims) {
/* If we can just tell the hardware or the TNL to interpret our
* indices with a different base, do so.
*/
- tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
+ tmp_prims = malloc(sizeof(*prim) * nr_prims);
for (i = 0; i < nr_prims; i++) {
tmp_prims[i] = prim[i];
else {
/* Otherwise the primitives need adjustment.
*/
- tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
+ tmp_prims = malloc(sizeof(*prim) * nr_prims);
for (i = 0; i < nr_prims; i++) {
/* If this fails, it could indicate an application error: