remove cdio_malloc and replace with calloc which does functionally

exactly the same thing (but is standard). In some drivers _data -> p_data.
This commit is contained in:
rocky
2005-02-03 07:35:14 +00:00
parent c54e370157
commit f1d3b190ba
15 changed files with 88 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.c,v 1.14 2005/01/27 04:54:27 rocky Exp $
$Id: freebsd.c,v 1.15 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.14 2005/01/27 04:54:27 rocky Exp $";
static const char _rcsid[] = "$Id: freebsd.c,v 1.15 2005/02/03 07:35:15 rocky Exp $";
#include "freebsd.h"
@@ -612,7 +612,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
.set_speed = set_speed_freebsd,
};
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc(1, sizeof (_img_private_t));
_data->access_mode = str_to_access_mode_freebsd(psz_access_mode);
_data->gen.init = false;
_data->gen.fd = -1;

View File

@@ -1,5 +1,5 @@
/*
$Id: win32.c,v 1.14 2005/01/27 11:08:55 rocky Exp $
$Id: win32.c,v 1.15 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32.c,v 1.14 2005/01/27 11:08:55 rocky Exp $";
static const char _rcsid[] = "$Id: win32.c,v 1.15 2005/02/03 07:35:15 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -768,7 +768,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
_funcs.set_blocksize = set_blocksize_mmc;
_funcs.set_speed = set_speed_mmc;
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc(1, sizeof (_img_private_t));
_data->access_mode = str_to_access_mode_win32(psz_access_mode);
_data->gen.init = false;
_data->gen.fd = -1;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_aix.c,v 1.8 2005/01/24 17:36:56 rocky Exp $
$Id: _cdio_aix.c,v 1.9 2005/02/03 07:35:14 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -37,7 +37,7 @@
#ifdef HAVE_AIX_CDROM
static const char _rcsid[] = "$Id: _cdio_aix.c,v 1.8 2005/01/24 17:36:56 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_aix.c,v 1.9 2005/02/03 07:35:14 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -963,7 +963,7 @@ cdio_open_am_aix (const char *psz_orig_source, const char *access_mode)
_funcs.run_scsi_mmc_cmd = run_scsi_cmd_aix;
_funcs.set_arg = _set_arg_aix;
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc (1, sizeof (_img_private_t));
_data->access_mode = _AM_CTRL_SCSI;
_data->gen.init = false;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_bsdi.c,v 1.10 2005/01/24 00:13:22 rocky Exp $
$Id: _cdio_bsdi.c,v 1.11 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_bsdi.c,v 1.10 2005/01/24 00:13:22 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_bsdi.c,v 1.11 2005/02/03 07:35:15 rocky Exp $";
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -788,7 +788,7 @@ cdio_open_bsdi (const char *psz_orig_source)
.set_arg = _set_arg_bsdi,
};
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc (1, sizeof (_img_private_t));
_data->access_mode = _AM_IOCTL;
_data->gen.init = false;
_data->gen.fd = -1;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_linux.c,v 1.19 2005/01/24 00:06:31 rocky Exp $
$Id: _cdio_linux.c,v 1.20 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.19 2005/01/24 00:06:31 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.20 2005/02/03 07:35:15 rocky Exp $";
#include <string.h>
@@ -1171,7 +1171,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
.set_speed = set_speed_linux,
};
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc (1, sizeof (_img_private_t));
_data->access_mode = str_to_access_mode_linux(access_mode);
_data->gen.init = false;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_osx.c,v 1.13 2005/01/27 23:23:22 rocky Exp $
$Id: _cdio_osx.c,v 1.14 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
from vcdimager code:
@@ -34,7 +34,7 @@
#include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.13 2005/01/27 23:23:22 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.14 2005/02/03 07:35:15 rocky Exp $";
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -1694,7 +1694,7 @@ cdio_open_osx (const char *psz_orig_source)
.set_speed = set_speed_osx,
};
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc (1, sizeof (_img_private_t));
_data->access_mode = _AM_OSX;
_data->MediaClass_service = 0;
_data->gen.init = false;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_stdio.c,v 1.2 2005/01/20 01:00:52 rocky Exp $
$Id: _cdio_stdio.c,v 1.3 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -39,7 +39,7 @@
#include "_cdio_stream.h"
#include "_cdio_stdio.h"
static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.2 2005/01/20 01:00:52 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.3 2005/02/03 07:35:15 rocky Exp $";
#define CDIO_STDIO_BUFSIZE (128*1024)
@@ -57,7 +57,7 @@ _stdio_open (void *user_data)
if ((ud->fd = fopen (ud->pathname, "rb")))
{
ud->fd_buf = _cdio_malloc (CDIO_STDIO_BUFSIZE);
ud->fd_buf = calloc (1, CDIO_STDIO_BUFSIZE);
setvbuf (ud->fd, ud->fd_buf, _IOFBF, CDIO_STDIO_BUFSIZE);
}
@@ -199,7 +199,7 @@ cdio_stdio_new(const char pathname[])
return NULL;
}
ud = _cdio_malloc (sizeof (_UserData));
ud = calloc (1, sizeof (_UserData));
ud->pathname = strdup(pathname);
ud->st_size = statbuf.st_size; /* let's hope it doesn't change... */

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_stream.c,v 1.4 2005/01/22 11:22:00 rocky Exp $
$Id: _cdio_stream.c,v 1.5 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2000, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -35,7 +35,7 @@
#include <cdio/util.h>
#include "_cdio_stream.h"
static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.4 2005/01/22 11:22:00 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.5 2005/02/03 07:35:15 rocky Exp $";
/*
* DataSource implementations
@@ -114,7 +114,7 @@ cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs)
{
CdioDataSource_t *new_obj;
new_obj = _cdio_malloc (sizeof (CdioDataSource_t));
new_obj = calloc (1, sizeof (CdioDataSource_t));
new_obj->user_data = user_data;
memcpy(&(new_obj->op), funcs, sizeof(cdio_stream_io_functions));

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_sunos.c,v 1.17 2005/01/24 00:10:46 rocky Exp $
$Id: _cdio_sunos.c,v 1.18 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.17 2005/01/24 00:10:46 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.18 2005/02/03 07:35:15 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -473,22 +473,6 @@ eject_media_solaris (void *p_user_data) {
return DRIVER_OP_ERROR;
}
static void *
_cdio_malloc_and_zero(size_t size) {
void *ptr;
if( !size ) size++;
if((ptr = malloc(size)) == NULL) {
cdio_warn("malloc() failed: %s", strerror(errno));
return NULL;
}
memset(ptr, 0, size);
return ptr;
}
/*!
Return the value associated with the key "arg".
*/
@@ -529,7 +513,7 @@ cdio_get_default_device_solaris(void)
(volume_action = getenv("VOLUME_ACTION")) != NULL &&
strcmp(volume_action, "insert") == 0) {
device = _cdio_malloc_and_zero(strlen(volume_device)
device = calloc(1, strlen(volume_device)
+ strlen(volume_name) + 2);
if (device == NULL)
return strdup(DEFAULT_CDIO_DEVICE);
@@ -542,7 +526,7 @@ cdio_get_default_device_solaris(void)
}
/* Check if it could be a Solaris media*/
if((stat(DEFAULT_CDIO_DEVICE, &stb) == 0) && S_ISDIR(stb.st_mode)) {
device = _cdio_malloc_and_zero(strlen(DEFAULT_CDIO_DEVICE) + 4);
device = calloc(1, strlen(DEFAULT_CDIO_DEVICE) + 4);
sprintf(device, "%s/s0", DEFAULT_CDIO_DEVICE);
return device;
}
@@ -893,7 +877,7 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
_funcs.set_blocksize = set_blocksize_mmc;
_funcs.set_speed = set_speed_solaris;
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc(1, sizeof (_img_private_t));
_data->access_mode = _AM_SUN_CTRL_SCSI;
_data->gen.init = false;

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio.c,v 1.12 2005/01/27 03:10:06 rocky Exp $
$Id: cdio.c,v 1.13 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -35,7 +35,7 @@
#include <cdio/util.h>
#include "cdio_private.h"
static const char _rcsid[] = "$Id: cdio.c,v 1.12 2005/01/27 03:10:06 rocky Exp $";
static const char _rcsid[] = "$Id: cdio.c,v 1.13 2005/02/03 07:35:15 rocky Exp $";
/*!
@@ -76,7 +76,7 @@ cdio_get_cdtext (CdIo *obj, track_t i_track)
CdIo_t *
cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs)
{
CdIo_t *p_new_cdio = _cdio_malloc (sizeof (CdIo_t));
CdIo_t *p_new_cdio = calloc(1, sizeof (CdIo_t));
if (NULL == p_new_cdio) return NULL;

View File

@@ -1,5 +1,5 @@
/*
$Id: ds.c,v 1.2 2005/01/12 11:34:52 rocky Exp $
$Id: ds.c,v 1.3 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -31,7 +31,7 @@
#include <cdio/types.h>
#include "cdio_assert.h"
static const char _rcsid[] = "$Id: ds.c,v 1.2 2005/01/12 11:34:52 rocky Exp $";
static const char _rcsid[] = "$Id: ds.c,v 1.3 2005/02/03 07:35:15 rocky Exp $";
struct _CdioList
{
@@ -55,7 +55,7 @@ struct _CdioListNode
CdioList_t *
_cdio_list_new (void)
{
CdioList_t *p_new_obj = _cdio_malloc (sizeof (CdioList_t));
CdioList_t *p_new_obj = calloc (1, sizeof (CdioList_t));
return p_new_obj;
}
@@ -84,7 +84,7 @@ _cdio_list_prepend (CdioList_t *p_list, void *p_data)
cdio_assert (p_list != NULL);
p_new_node = _cdio_malloc (sizeof (CdioListNode_t));
p_new_node = calloc (1, sizeof (CdioListNode_t));
p_new_node->list = p_list;
p_new_node->next = p_list->begin;
@@ -108,7 +108,7 @@ _cdio_list_append (CdioList_t *p_list, void *p_data)
}
else
{
CdioListNode_t *p_new_node = _cdio_malloc (sizeof (CdioListNode_t));
CdioListNode_t *p_new_node = calloc (1, sizeof (CdioListNode_t));
p_new_node->list = p_list;
p_new_node->next = NULL;

View File

@@ -1,5 +1,5 @@
/*
$Id: bincue.c,v 1.10 2005/01/30 10:05:37 rocky Exp $
$Id: bincue.c,v 1.11 2005/02/03 07:35:16 rocky Exp $
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -26,7 +26,7 @@
(*.cue).
*/
static const char _rcsid[] = "$Id: bincue.c,v 1.10 2005/01/30 10:05:37 rocky Exp $";
static const char _rcsid[] = "$Id: bincue.c,v 1.11 2005/02/03 07:35:16 rocky Exp $";
#include "image.h"
#include "cdio_assert.h"
@@ -1128,7 +1128,7 @@ CdIo_t *
cdio_open_cue (const char *psz_cue_name)
{
CdIo_t *ret;
_img_private_t *_data;
_img_private_t *p_data;
char *psz_bin_name;
cdio_funcs_t _funcs;
@@ -1166,14 +1166,14 @@ cdio_open_cue (const char *psz_cue_name)
if (NULL == psz_cue_name) return NULL;
_data = _cdio_malloc (sizeof (_img_private_t));
_data->gen.init = false;
_data->psz_cue_name = NULL;
p_data = calloc(1, sizeof (_img_private_t));
p_data->gen.init = false;
p_data->psz_cue_name = NULL;
ret = cdio_new ((void *)_data, &_funcs);
ret = cdio_new ((void *)p_data, &_funcs);
if (ret == NULL) {
free(_data);
free(p_data);
return NULL;
}
@@ -1185,15 +1185,15 @@ cdio_open_cue (const char *psz_cue_name)
psz_cue_name);
}
_set_arg_image (_data, "cue", psz_cue_name);
_set_arg_image (_data, "source", psz_bin_name);
_set_arg_image (_data, "access-mode", "bincue");
_set_arg_image (p_data, "cue", psz_cue_name);
_set_arg_image (p_data, "source", psz_bin_name);
_set_arg_image (p_data, "access-mode", "bincue");
free(psz_bin_name);
if (_init_bincue(_data)) {
if (_init_bincue(p_data)) {
return ret;
} else {
_free_image(_data);
_free_image(p_data);
free(ret);
return NULL;
}

View File

@@ -1,5 +1,5 @@
/*
$Id: cdrdao.c,v 1.11 2005/01/24 00:06:31 rocky Exp $
$Id: cdrdao.c,v 1.12 2005/02/03 07:35:16 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue).
*/
static const char _rcsid[] = "$Id: cdrdao.c,v 1.11 2005/01/24 00:06:31 rocky Exp $";
static const char _rcsid[] = "$Id: cdrdao.c,v 1.12 2005/02/03 07:35:16 rocky Exp $";
#include "image.h"
#include "cdio_assert.h"
@@ -1142,7 +1142,7 @@ cdio_get_default_device_cdrdao(void)
}
static bool
get_hwinfo_cdrdao ( const CdIo *p_cdio, /*out*/ cdio_hwinfo_t *hw_info)
get_hwinfo_cdrdao ( const CdIo_t *p_cdio, /*out*/ cdio_hwinfo_t *hw_info)
{
strcpy(hw_info->psz_vendor, "libcdio");
strcpy(hw_info->psz_model, "cdrdao");
@@ -1238,7 +1238,7 @@ cdio_is_tocfile(const char *psz_cue_name)
get called via a function pointer. In fact *we* are the
ones to set that up.
*/
CdIo *
CdIo_t *
cdio_open_am_cdrdao (const char *psz_source_name, const char *psz_access_mode)
{
if (psz_access_mode != NULL && strcmp(psz_access_mode, "image"))
@@ -1252,11 +1252,11 @@ cdio_open_am_cdrdao (const char *psz_source_name, const char *psz_access_mode)
get called via a function pointer. In fact *we* are the
ones to set that up.
*/
CdIo *
CdIo_t *
cdio_open_cdrdao (const char *psz_cue_name)
{
CdIo *ret;
_img_private_t *_data;
CdIo_t *ret;
_img_private_t *p_data;
cdio_funcs_t _funcs;
@@ -1295,16 +1295,16 @@ cdio_open_cdrdao (const char *psz_cue_name)
if (NULL == psz_cue_name) return NULL;
_data = _cdio_malloc (sizeof (_img_private_t));
_data->gen.init = false;
_data->psz_cue_name = NULL;
_data->gen.data_source = NULL;
_data->gen.source_name = NULL;
p_data = calloc(1, sizeof (_img_private_t));
p_data->gen.init = false;
p_data->psz_cue_name = NULL;
p_data->gen.data_source = NULL;
p_data->gen.source_name = NULL;
ret = cdio_new ((void *)_data, &_funcs);
ret = cdio_new ((void *)p_data, &_funcs);
if (ret == NULL) {
free(_data);
free(p_data);
return NULL;
}
@@ -1315,14 +1315,14 @@ cdio_open_cdrdao (const char *psz_cue_name)
return NULL;
}
_set_arg_image (_data, "cue", psz_cue_name);
_set_arg_image (_data, "source", psz_cue_name);
_set_arg_image (_data, "access-mode", "cdrdao");
_set_arg_image (p_data, "cue", psz_cue_name);
_set_arg_image (p_data, "source", psz_cue_name);
_set_arg_image (p_data, "access-mode", "cdrdao");
if (_init_cdrdao(_data)) {
if (_init_cdrdao(p_data)) {
return ret;
} else {
_free_image(_data);
_free_image(p_data);
free(ret);
return NULL;
}

View File

@@ -1,5 +1,5 @@
/*
$Id: nrg.c,v 1.9 2005/01/24 00:06:31 rocky Exp $
$Id: nrg.c,v 1.10 2005/02/03 07:35:16 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -46,7 +46,7 @@
#include "_cdio_stdio.h"
#include "nrg.h"
static const char _rcsid[] = "$Id: nrg.c,v 1.9 2005/01/24 00:06:31 rocky Exp $";
static const char _rcsid[] = "$Id: nrg.c,v 1.10 2005/02/03 07:35:16 rocky Exp $";
/* reader */
@@ -81,7 +81,7 @@ _register_mapping (_img_private_t *env, lsn_t start_lsn, uint32_t sec_count,
{
const int track_num=env->gen.i_tracks;
track_info_t *this_track=&(env->tocent[env->gen.i_tracks]);
_mapping_t *_map = _cdio_malloc (sizeof (_mapping_t));
_mapping_t *_map = calloc(1, sizeof (_mapping_t));
_map->start_lsn = start_lsn;
_map->sec_count = sec_count;
@@ -208,7 +208,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
cdio_assert (IN ((size - footer_start), 0, 4096));
footer_buf = _cdio_malloc (size - footer_start);
footer_buf = calloc(1, size - footer_start);
cdio_stream_seek (p_env->gen.data_source, footer_start, SEEK_SET);
cdio_stream_read (p_env->gen.data_source, footer_buf,
@@ -372,7 +372,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
int disc_mode;
/* We include an extra 0 byte so these can be used as C strings.*/
p_env->psz_mcn = _cdio_malloc (CDIO_MCN_SIZE+1);
p_env->psz_mcn = calloc(1, CDIO_MCN_SIZE+1);
if (DAOX_ID == opcode) {
_daox_array_t *_entries = (void *) chunk->data;
@@ -517,6 +517,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
track_green = false; /* ?? */
blocksize = CDIO_CD_FRAMESIZE;
p_env->disc_mode = CDIO_DISC_MODE_CD_DATA;
cdio_info ("Format DATA, blocksize %u", CDIO_CD_FRAMESIZE);
break;
case 2:
/* Mode 2 form 1 */
@@ -524,6 +525,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
track_green = false; /* ?? */
blocksize = CDIO_CD_FRAMESIZE;
p_env->disc_mode = CDIO_DISC_MODE_CD_XA;
cdio_info ("Format XA, blocksize %u", CDIO_CD_FRAMESIZE);
break;
case 3:
/* Mode 2 */
@@ -531,6 +533,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
track_green = true;
blocksize = M2RAW_SECTOR_SIZE;
p_env->disc_mode = CDIO_DISC_MODE_CD_XA; /* ?? */
cdio_info ("Format XA, blocksize %u", M2RAW_SECTOR_SIZE);
break;
case 06:
/* Mode2 form mix */
@@ -538,18 +541,21 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name)
track_green = true;
blocksize = M2RAW_SECTOR_SIZE;
p_env->disc_mode = CDIO_DISC_MODE_CD_MIXED;
cdio_info ("Format MIXED CD, blocksize %u", M2RAW_SECTOR_SIZE);
break;
case 0x20: /* ??? Mode2 form 2, Mode2 raw?? */
track_format = TRACK_FORMAT_XA;
track_green = true;
blocksize = M2RAW_SECTOR_SIZE;
p_env->disc_mode = CDIO_DISC_MODE_CD_XA; /* ??. */
cdio_info ("Format MIXED CD, blocksize %u", M2RAW_SECTOR_SIZE);
break;
case 7:
track_format = TRACK_FORMAT_AUDIO;
track_green = false;
blocksize = CDIO_CD_FRAMESIZE_RAW;
p_env->disc_mode = CDIO_DISC_MODE_CD_DA;
cdio_info ("Format CD_DA, blocksize %u", CDIO_CD_FRAMESIZE_RAW);
break;
default:
cdio_log (log_level,
@@ -1238,7 +1244,7 @@ cdio_open_nrg (const char *psz_source)
_funcs.read_mode2_sectors = _read_mode2_sectors_nrg;
_funcs.set_arg = _set_arg_image;
_data = _cdio_malloc (sizeof (_img_private_t));
_data = calloc(1, sizeof (_img_private_t));
_data->gen.init = false;
_data->gen.i_tracks = 0;

View File

@@ -1,8 +1,8 @@
/*
$Id: util.c,v 1.1 2004/12/18 17:29:32 rocky Exp $
$Id: util.c,v 1.2 2005/02/03 07:35:15 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
#include <cdio/types.h>
#include <cdio/util.h>
static const char _rcsid[] = "$Id: util.c,v 1.1 2004/12/18 17:29:32 rocky Exp $";
static const char _rcsid[] = "$Id: util.c,v 1.2 2005/02/03 07:35:15 rocky Exp $";
size_t
_cdio_strlenv(char **str_array)
@@ -81,7 +81,7 @@ _cdio_strjoin (char *strv[], unsigned count, const char delim[])
len++;
new_str = _cdio_malloc (len);
new_str = calloc (1, len);
new_str[0] = '\0';
for (n = 0;n < count;n++)
@@ -115,7 +115,7 @@ _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */
if (*(p++) == delim)
n++;
strv = _cdio_malloc (sizeof (char *) * (n+1));
strv = calloc (1, sizeof (char *) * (n+1));
n = 0;
while((p = strtok(n ? NULL : _str, _delim)) != NULL)
@@ -126,18 +126,6 @@ _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */
return strv;
}
void *
_cdio_malloc (size_t size)
{
void *new_mem = malloc (size);
cdio_assert (new_mem != NULL);
memset (new_mem, 0, size);
return new_mem;
}
void *
_cdio_memdup (const void *mem, size_t count)
{
@@ -145,7 +133,7 @@ _cdio_memdup (const void *mem, size_t count)
if (mem)
{
new_mem = _cdio_malloc (count);
new_mem = calloc (1, count);
memcpy (new_mem, mem, count);
}