1
mirror of https://github.com/mpv-player/mpv synced 2025-03-15 03:14:30 +01:00

rm unnecesary casts from void* - part 2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18883 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reynaldo 2006-07-02 03:59:36 +00:00
parent 1ad9af38b5
commit 9d9a15d185
20 changed files with 55 additions and 55 deletions

View File

@ -690,7 +690,7 @@ mp_input_parse_cmd(char* str) {
ptr2 = e + 1; ptr2 = e + 1;
l--; l--;
} }
cmd->args[i].v.s = (char*)malloc(l+1); cmd->args[i].v.s = malloc(l+1);
strncpy(cmd->args[i].v.s,start,l); strncpy(cmd->args[i].v.s,start,l);
cmd->args[i].v.s[l] = '\0'; cmd->args[i].v.s[l] = '\0';
if(term != ' ') ptr += l+2; if(term != ' ') ptr += l+2;
@ -746,7 +746,7 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
// Allocate the buffer if it doesn't exist // Allocate the buffer if it doesn't exist
if(!mp_fd->buffer) { if(!mp_fd->buffer) {
mp_fd->buffer = (char*)malloc(MP_CMD_MAX_SIZE); mp_fd->buffer = malloc(MP_CMD_MAX_SIZE);
mp_fd->pos = 0; mp_fd->pos = 0;
mp_fd->size = MP_CMD_MAX_SIZE; mp_fd->size = MP_CMD_MAX_SIZE;
} }
@ -802,7 +802,7 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
// Not dropping : put the cmd in ret // Not dropping : put the cmd in ret
if( ! (mp_fd->flags & MP_FD_DROP)) { if( ! (mp_fd->flags & MP_FD_DROP)) {
(*ret) = (char*)malloc(l+1); (*ret) = malloc(l+1);
strncpy((*ret),mp_fd->buffer,l); strncpy((*ret),mp_fd->buffer,l);
(*ret)[l] = '\0'; (*ret)[l] = '\0';
} else { // Remove the dropping flag } else { // Remove the dropping flag
@ -1275,7 +1275,7 @@ mp_cmd_clone(mp_cmd_t* cmd) {
assert(cmd != NULL); assert(cmd != NULL);
#endif #endif
ret = (mp_cmd_t*)malloc(sizeof(mp_cmd_t)); ret = malloc(sizeof(mp_cmd_t));
memcpy(ret,cmd,sizeof(mp_cmd_t)); memcpy(ret,cmd,sizeof(mp_cmd_t));
if(cmd->name) if(cmd->name)
ret->name = strdup(cmd->name); ret->name = strdup(cmd->name);

View File

@ -618,9 +618,9 @@ static int prepare_font(font_desc_t *desc, FT_Face face, float ppem, int pic_idx
desc->faces[pic_idx] = face; desc->faces[pic_idx] = face;
desc->pic_a[pic_idx] = (raw_file*)malloc(sizeof(raw_file)); desc->pic_a[pic_idx] = malloc(sizeof(raw_file));
if (!desc->pic_a[pic_idx]) return -1; if (!desc->pic_a[pic_idx]) return -1;
desc->pic_b[pic_idx] = (raw_file*)malloc(sizeof(raw_file)); desc->pic_b[pic_idx] = malloc(sizeof(raw_file));
if (!desc->pic_b[pic_idx]) return -1; if (!desc->pic_b[pic_idx]) return -1;
desc->pic_a[pic_idx]->bmp = NULL; desc->pic_a[pic_idx]->bmp = NULL;
@ -628,11 +628,11 @@ static int prepare_font(font_desc_t *desc, FT_Face face, float ppem, int pic_idx
desc->pic_b[pic_idx]->bmp = NULL; desc->pic_b[pic_idx]->bmp = NULL;
desc->pic_b[pic_idx]->pal = NULL; desc->pic_b[pic_idx]->pal = NULL;
desc->pic_a[pic_idx]->pal = (unsigned char*)malloc(sizeof(unsigned char)*256*3); desc->pic_a[pic_idx]->pal = malloc(sizeof(unsigned char)*256*3);
if (!desc->pic_a[pic_idx]->pal) return -1; if (!desc->pic_a[pic_idx]->pal) return -1;
for (i = 0; i<768; ++i) desc->pic_a[pic_idx]->pal[i] = i/3; for (i = 0; i<768; ++i) desc->pic_a[pic_idx]->pal[i] = i/3;
desc->pic_b[pic_idx]->pal = (unsigned char*)malloc(sizeof(unsigned char)*256*3); desc->pic_b[pic_idx]->pal = malloc(sizeof(unsigned char)*256*3);
if (!desc->pic_b[pic_idx]->pal) return -1; if (!desc->pic_b[pic_idx]->pal) return -1;
for (i = 0; i<768; ++i) desc->pic_b[pic_idx]->pal[i] = i/3; for (i = 0; i<768; ++i) desc->pic_b[pic_idx]->pal[i] = i/3;
@ -673,13 +673,13 @@ int generate_tables(font_desc_t *desc, double thickness, double radius)
// fprintf(stderr, "o_r = %d\n", desc->tables.o_r); // fprintf(stderr, "o_r = %d\n", desc->tables.o_r);
if (desc->tables.g_r) { if (desc->tables.g_r) {
desc->tables.g = (unsigned*)malloc(desc->tables.g_w * sizeof(unsigned)); desc->tables.g = malloc(desc->tables.g_w * sizeof(unsigned));
desc->tables.gt2 = (unsigned*)malloc(256 * desc->tables.g_w * sizeof(unsigned)); desc->tables.gt2 = malloc(256 * desc->tables.g_w * sizeof(unsigned));
if (desc->tables.g==NULL || desc->tables.gt2==NULL) { if (desc->tables.g==NULL || desc->tables.gt2==NULL) {
return -1; return -1;
} }
} }
desc->tables.om = (unsigned*)malloc(desc->tables.o_w*desc->tables.o_w * sizeof(unsigned)); desc->tables.om = malloc(desc->tables.o_w*desc->tables.o_w * sizeof(unsigned));
desc->tables.omt = malloc(desc->tables.o_size*256); desc->tables.omt = malloc(desc->tables.o_size*256);
omtp = desc->tables.omt; omtp = desc->tables.omt;

View File

@ -298,7 +298,7 @@ static void getFunctions(void *(*getProcAddress)(const GLubyte *),
char *allexts; char *allexts;
if (!extensions) extensions = ""; if (!extensions) extensions = "";
if (!ext2) ext2 = ""; if (!ext2) ext2 = "";
allexts = (char *)malloc(strlen(extensions) + strlen(ext2) + 2); allexts = malloc(strlen(extensions) + strlen(ext2) + 2);
strcpy(allexts, extensions); strcpy(allexts, extensions);
strcat(allexts, " "); strcat(allexts, " ");
strcat(allexts, ext2); strcat(allexts, ext2);
@ -332,7 +332,7 @@ void glCreateClearTex(GLenum target, GLenum fmt, GLint filter,
GLfloat fval = (GLfloat)val / 255.0; GLfloat fval = (GLfloat)val / 255.0;
GLfloat border[4] = {fval, fval, fval, fval}; GLfloat border[4] = {fval, fval, fval, fval};
GLenum clrfmt = (fmt == GL_ALPHA) ? GL_ALPHA : GL_LUMINANCE; GLenum clrfmt = (fmt == GL_ALPHA) ? GL_ALPHA : GL_LUMINANCE;
char *init = (char *)malloc(w * h); char *init = malloc(w * h);
memset(init, val, w * h); memset(init, val, w * h);
glAdjustAlignment(w); glAdjustAlignment(w);
glPixelStorei(GL_UNPACK_ROW_LENGTH, w); glPixelStorei(GL_UNPACK_ROW_LENGTH, w);
@ -400,7 +400,7 @@ int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter,
return 0; return 0;
if (w > MAXDIM || h > MAXDIM) if (w > MAXDIM || h > MAXDIM)
return 0; return 0;
data = (char *)malloc(w * h * 3); data = malloc(w * h * 3);
if (fread(data, w * 3, h, f) != h) if (fread(data, w * 3, h, f) != h)
return 0; return 0;
glCreateClearTex(target, fmt, filter, w, h, 0); glCreateClearTex(target, fmt, filter, w, h, 0);

View File

@ -222,7 +222,7 @@ static int preinit(const char *arg)
{ {
int argc = 2; int argc = 2;
char arg0[10] = "mplayer"; char arg0[10] = "mplayer";
char *arg1 = (char *)malloc(dfb_params.len + 7); char *arg1 = malloc(dfb_params.len + 7);
char* argv[3]; char* argv[3];
char ** a; char ** a;

View File

@ -465,7 +465,7 @@ static void create_osd_texture(int x0, int y0, int w, int h,
glCreateClearTex(gl_target, GL_ALPHA, scale_type, sx, sy, 255); glCreateClearTex(gl_target, GL_ALPHA, scale_type, sx, sy, 255);
{ {
int i; int i;
char *tmp = (char *)malloc(stride * h); char *tmp = malloc(stride * h);
// convert alpha from weird MPlayer scale. // convert alpha from weird MPlayer scale.
// in-place is not possible since it is reused for future OSDs // in-place is not possible since it is reused for future OSDs
for (i = h * stride - 1; i > 0; i--) for (i = h * stride - 1; i > 0; i--)

View File

@ -125,7 +125,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
break; break;
} }
image_bytes = (image_depth + 7) / 8; image_bytes = (image_depth + 7) / 8;
image_data = (unsigned char*)malloc(image_width*image_height*image_bytes); image_data = malloc(image_width*image_height*image_bytes);
if(!shared_buffer) if(!shared_buffer)
{ {

View File

@ -105,7 +105,7 @@ int enable() {
if (v) if (v)
return 1; return 1;
errno = 0; errno = 0;
v = (vga_t *)malloc(sizeof(vga_t)); v = malloc(sizeof(vga_t));
if (v) { if (v) {
if (ioperm(0x3d4, 2, 1) == 0) { if (ioperm(0x3d4, 2, 1) == 0) {
fd = open("/dev/mem", O_RDWR); fd = open("/dev/mem", O_RDWR);

View File

@ -779,7 +779,7 @@ static void init_osd_yuv_pal(){
snum = subpicture.num_palette_entries; snum = subpicture.num_palette_entries;
seb = subpicture.entry_bytes; seb = subpicture.entry_bytes;
palette = (char*)malloc(snum*seb);//check fail palette = malloc(snum*seb);//check fail
if(palette == NULL) return; if(palette == NULL) return;
for(i=0; i<snum; i++){ for(i=0; i<snum; i++){
// 0-black max-white the other are gradients // 0-black max-white the other are gradients

View File

@ -282,7 +282,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName,
MSACM_hHeap = GetProcessHeap(); MSACM_hHeap = GetProcessHeap();
#endif #endif
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
padid->pszFileName = (char*)malloc(strlen(pszFileName)+1); padid->pszFileName = malloc(strlen(pszFileName)+1);
strcpy(padid->pszFileName, pszFileName); strcpy(padid->pszFileName, pszFileName);
// 1~strdup(pszDriverAlias); // 1~strdup(pszDriverAlias);
padid->wFormatTag = wFormatTag; padid->wFormatTag = wFormatTag;

View File

@ -119,7 +119,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE
bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
sizeof(BITMAPINFOHEADER) : format->biSize; sizeof(BITMAPINFOHEADER) : format->biSize;
this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); this->iv.m_bh = malloc(bihs);
memcpy(this->iv.m_bh, format, bihs); memcpy(this->iv.m_bh, format, bihs);
this->iv.m_State = STOP; this->iv.m_State = STOP;
@ -131,7 +131,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE
this->iv.m_bCapable16b = true; this->iv.m_bCapable16b = true;
bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs); this->m_sVhdr = malloc(bihs);
memset(this->m_sVhdr, 0, bihs); memset(this->m_sVhdr, 0, bihs);
memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize); memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0; this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;

View File

@ -114,7 +114,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD
bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
sizeof(BITMAPINFOHEADER) : format->biSize; sizeof(BITMAPINFOHEADER) : format->biSize;
this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); this->iv.m_bh = malloc(bihs);
memcpy(this->iv.m_bh, format, bihs); memcpy(this->iv.m_bh, format, bihs);
this->iv.m_State = STOP; this->iv.m_State = STOP;
@ -126,7 +126,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD
this->iv.m_bCapable16b = true; this->iv.m_bCapable16b = true;
bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs); this->m_sVhdr = malloc(bihs);
memset(this->m_sVhdr, 0, bihs); memset(this->m_sVhdr, 0, bihs);
memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize); memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0; this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;

View File

@ -178,9 +178,9 @@ static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This,
t = &((CMediaSample*)This)->media_type; t = &((CMediaSample*)This)->media_type;
// if(t.pbFormat)free(t.pbFormat); // if(t.pbFormat)free(t.pbFormat);
(*ppMediaType) = (AM_MEDIA_TYPE*)malloc(sizeof(AM_MEDIA_TYPE)); (*ppMediaType) = malloc(sizeof(AM_MEDIA_TYPE));
**ppMediaType = *t; **ppMediaType = *t;
(*ppMediaType)->pbFormat = (char*)malloc(t->cbFormat); (*ppMediaType)->pbFormat = malloc(t->cbFormat);
memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat);
// *ppMediaType=0; //media type was not changed // *ppMediaType=0; //media type was not changed
return 0; return 0;
@ -199,7 +199,7 @@ static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
t = pMediaType; t = pMediaType;
if (t->cbFormat) if (t->cbFormat)
{ {
t->pbFormat = (char*)malloc(t->cbFormat); t->pbFormat = malloc(t->cbFormat);
memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat); memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat);
} }
else else

View File

@ -179,7 +179,7 @@ static long STDCALL CInputPin_ConnectionMediaType(IPin* This,
*pmt=((CInputPin*)This)->type; *pmt=((CInputPin*)This)->type;
if (pmt->cbFormat > 0) if (pmt->cbFormat > 0)
{ {
pmt->pbFormat=(char *)malloc(pmt->cbFormat); pmt->pbFormat=malloc(pmt->cbFormat);
memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat); memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
} }
return 0; return 0;

View File

@ -56,12 +56,12 @@ static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
if (pcFetched) if (pcFetched)
*pcFetched=1; *pcFetched=1;
ppMediaTypes[0] = (AM_MEDIA_TYPE *)malloc(sizeof(AM_MEDIA_TYPE)); ppMediaTypes[0] = malloc(sizeof(AM_MEDIA_TYPE));
// copy structures - C can handle this... // copy structures - C can handle this...
**ppMediaTypes = *type; **ppMediaTypes = *type;
if (ppMediaTypes[0]->pbFormat) if (ppMediaTypes[0]->pbFormat)
{ {
ppMediaTypes[0]->pbFormat=(char *)malloc(ppMediaTypes[0]->cbFormat); ppMediaTypes[0]->pbFormat=malloc(ppMediaTypes[0]->cbFormat);
memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat); memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat);
} }
if (cMediaTypes == 1) if (cMediaTypes == 1)
@ -219,7 +219,7 @@ static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
*pmt = ((COutputPin*)This)->type; *pmt = ((COutputPin*)This)->type;
if (pmt->cbFormat>0) if (pmt->cbFormat>0)
{ {
pmt->pbFormat=(char *)malloc(pmt->cbFormat); pmt->pbFormat=malloc(pmt->cbFormat);
memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat); memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
} }
return 0; return 0;

View File

@ -20,7 +20,7 @@ int main(int argc,char* argv[]){
fread(&bih,sizeof(BITMAPINFOHEADER),1,f); fread(&bih,sizeof(BITMAPINFOHEADER),1,f);
printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight); printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight);
src=(char*)malloc(512000); src=malloc(512000);
len=fread(src,1,512000,f); len=fread(src,1,512000,f);
printf("frame len = %d\n",len); printf("frame len = %d\n",len);

View File

@ -272,7 +272,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
Setup_FS_Segment(); Setup_FS_Segment();
ldt_fs->prev_struct = (char*)malloc(8); ldt_fs->prev_struct = malloc(8);
*(void**)array.base_addr = ldt_fs->prev_struct; *(void**)array.base_addr = ldt_fs->prev_struct;
return ldt_fs; return ldt_fs;

View File

@ -242,7 +242,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
} }
else else
{ {
local_wm = (modref_list*)malloc(sizeof(modref_list)); local_wm = malloc(sizeof(modref_list));
local_wm->next=local_wm->prev=NULL; local_wm->next=local_wm->prev=NULL;
local_wm->wm=wm; local_wm->wm=wm;
} }

View File

@ -66,11 +66,11 @@ static void create_registry(void){
save_registry(); save_registry();
return; return;
} }
regs=(struct reg_value*)malloc(3*sizeof(struct reg_value)); regs=malloc(3*sizeof(struct reg_value));
regs[0].type=regs[1].type=DIR; regs[0].type=regs[1].type=DIR;
regs[0].name=(char*)malloc(5); regs[0].name=malloc(5);
strcpy(regs[0].name, "HKLM"); strcpy(regs[0].name, "HKLM");
regs[1].name=(char*)malloc(5); regs[1].name=malloc(5);
strcpy(regs[1].name, "HKCU"); strcpy(regs[1].name, "HKCU");
regs[0].value=regs[1].value=NULL; regs[0].value=regs[1].value=NULL;
regs[0].len=regs[1].len=0; regs[0].len=regs[1].len=0;
@ -97,13 +97,13 @@ static void open_registry(void)
return; return;
} }
read(fd, &reg_size, 4); read(fd, &reg_size, 4);
regs=(struct reg_value*)malloc(reg_size*sizeof(struct reg_value)); regs=malloc(reg_size*sizeof(struct reg_value));
head = 0; head = 0;
for(i=0; i<reg_size; i++) for(i=0; i<reg_size; i++)
{ {
read(fd,&regs[i].type,4); read(fd,&regs[i].type,4);
read(fd,&len,4); read(fd,&len,4);
regs[i].name=(char*)malloc(len+1); regs[i].name=malloc(len+1);
if(regs[i].name==0) if(regs[i].name==0)
{ {
reg_size=i+1; reg_size=i+1;
@ -112,7 +112,7 @@ static void open_registry(void)
read(fd, regs[i].name, len); read(fd, regs[i].name, len);
regs[i].name[len]=0; regs[i].name[len]=0;
read(fd,&regs[i].len,4); read(fd,&regs[i].len,4);
regs[i].value=(char*)malloc(regs[i].len+1); regs[i].value=malloc(regs[i].len+1);
if(regs[i].value==0) if(regs[i].value==0)
{ {
free(regs[i].name); free(regs[i].name);
@ -226,7 +226,7 @@ static int generate_handle()
static reg_handle_t* insert_handle(long handle, const char* name) static reg_handle_t* insert_handle(long handle, const char* name)
{ {
reg_handle_t* t; reg_handle_t* t;
t=(reg_handle_t*)malloc(sizeof(reg_handle_t)); t=malloc(sizeof(reg_handle_t));
if(head==0) if(head==0)
{ {
t->prev=0; t->prev=0;
@ -237,7 +237,7 @@ static reg_handle_t* insert_handle(long handle, const char* name)
t->prev=head; t->prev=head;
} }
t->next=0; t->next=0;
t->name=(char*)malloc(strlen(name)+1); t->name=malloc(strlen(name)+1);
strcpy(t->name, name); strcpy(t->name, name);
t->handle=handle; t->handle=handle;
head=t; head=t;
@ -254,7 +254,7 @@ static char* build_keyname(long key, const char* subkey)
} }
if(subkey==NULL) if(subkey==NULL)
subkey="<default>"; subkey="<default>";
full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10); full_name=malloc(strlen(t->name)+strlen(subkey)+10);
strcpy(full_name, t->name); strcpy(full_name, t->name);
strcat(full_name, "\\"); strcat(full_name, "\\");
strcat(full_name, subkey); strcat(full_name, subkey);
@ -290,9 +290,9 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type
TRACE("RegInsert '%s' %p v:%d len:%d\n", name, value, *(int*)value, len); TRACE("RegInsert '%s' %p v:%d len:%d\n", name, value, *(int*)value, len);
v->type=type; v->type=type;
v->len=len; v->len=len;
v->value=(char*)malloc(len); v->value=malloc(len);
memcpy(v->value, value, len); memcpy(v->value, value, len);
v->name=(char*)malloc(strlen(fullname)+1); v->name=malloc(strlen(fullname)+1);
strcpy(v->name, fullname); strcpy(v->name, fullname);
free(fullname); free(fullname);
save_registry(); save_registry();
@ -325,7 +325,7 @@ static void init_registry(void)
pthn = pwent->pw_dir; pthn = pwent->pw_dir;
} }
localregpathname = (char*)malloc(strlen(pthn)+20); localregpathname = malloc(strlen(pthn)+20);
strcpy(localregpathname, pthn); strcpy(localregpathname, pthn);
strcat(localregpathname, "/.registry"); strcat(localregpathname, "/.registry");
} }
@ -347,7 +347,7 @@ static reg_handle_t* find_handle_2(long key, const char* subkey)
} }
if(subkey==NULL) if(subkey==NULL)
return t; return t;
full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10); full_name=malloc(strlen(t->name)+strlen(subkey)+10);
strcpy(full_name, t->name); strcpy(full_name, t->name);
strcat(full_name, "\\"); strcat(full_name, "\\");
strcat(full_name, subkey); strcat(full_name, subkey);

View File

@ -78,7 +78,7 @@ ICOpen(long filename,long fccHandler,unsigned int wMode) {
/* FIXME: do we need to fill out the rest too? */ /* FIXME: do we need to fill out the rest too? */
hdrv=OpenDriverA((long)&icopen); hdrv=OpenDriverA((long)&icopen);
if (!hdrv) return 0; if (!hdrv) return 0;
whic = (WINE_HIC*)malloc(sizeof(WINE_HIC)); whic = malloc(sizeof(WINE_HIC));
whic->hdrv = hdrv; whic->hdrv = hdrv;
whic->driverproc= ((DRVR*)hdrv)->DriverProc; whic->driverproc= ((DRVR*)hdrv)->DriverProc;
// whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen); // whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);

View File

@ -2759,7 +2759,7 @@ static int WINAPI expGetPrivateProfileIntA(const char* appname,
dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value ); dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value );
return default_value; return default_value;
} }
fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
strcpy(fullname, "Software\\IniFileMapping\\"); strcpy(fullname, "Software\\IniFileMapping\\");
strcat(fullname, appname); strcat(fullname, appname);
strcat(fullname, "\\"); strcat(fullname, "\\");
@ -2797,7 +2797,7 @@ static int WINAPI expGetPrivateProfileStringA(const char* appname,
char* fullname; char* fullname;
dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename ); dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename );
if(!(appname && keyname && filename) ) return 0; if(!(appname && keyname && filename) ) return 0;
fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
strcpy(fullname, "Software\\IniFileMapping\\"); strcpy(fullname, "Software\\IniFileMapping\\");
strcat(fullname, appname); strcat(fullname, appname);
strcat(fullname, "\\"); strcat(fullname, "\\");
@ -2828,7 +2828,7 @@ static int WINAPI expWritePrivateProfileStringA(const char* appname,
dbgprintf(" => -1\n"); dbgprintf(" => -1\n");
return -1; return -1;
} }
fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
strcpy(fullname, "Software\\IniFileMapping\\"); strcpy(fullname, "Software\\IniFileMapping\\");
strcat(fullname, appname); strcat(fullname, appname);
strcat(fullname, "\\"); strcat(fullname, "\\");
@ -3542,7 +3542,7 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strstr(cs1, "QuickTime.qts")) if(strstr(cs1, "QuickTime.qts"))
{ {
int result; int result;
char* tmp=(char*)malloc(strlen(def_path)+50); char* tmp=malloc(strlen(def_path)+50);
strcpy(tmp, def_path); strcpy(tmp, def_path);
strcat(tmp, "/"); strcat(tmp, "/");
strcat(tmp, "QuickTime.qts"); strcat(tmp, "QuickTime.qts");
@ -3553,7 +3553,7 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strstr(cs1, ".qtx")) if(strstr(cs1, ".qtx"))
{ {
int result; int result;
char* tmp=(char*)malloc(strlen(def_path)+250); char* tmp=malloc(strlen(def_path)+250);
char* x=strrchr(cs1,'\\'); char* x=strrchr(cs1,'\\');
sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1); sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
// printf("### Open: %s -> %s\n",cs1,tmp); // printf("### Open: %s -> %s\n",cs1,tmp);
@ -3566,7 +3566,7 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
if(strncmp(cs1, "AP", 2) == 0) if(strncmp(cs1, "AP", 2) == 0)
{ {
int result; int result;
char* tmp=(char*)malloc(strlen(def_path)+50); char* tmp=malloc(strlen(def_path)+50);
strcpy(tmp, def_path); strcpy(tmp, def_path);
strcat(tmp, "/"); strcat(tmp, "/");
strcat(tmp, "APmpg4v1.apl"); strcat(tmp, "APmpg4v1.apl");
@ -3578,7 +3578,7 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
{ {
int r; int r;
int flg = 0; int flg = 0;
char* tmp=(char*)malloc(20 + strlen(cs1)); char* tmp=malloc(20 + strlen(cs1));
strcpy(tmp, "/tmp/"); strcpy(tmp, "/tmp/");
strcat(tmp, cs1); strcat(tmp, cs1);
r = 4; r = 4;