More strcat, sprintf, and strcpy replacements.

This commit is contained in:
rocky
2006-03-18 01:28:13 +00:00
parent df4da91a06
commit bcd670d1c6
5 changed files with 23 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
/* /*
$Id: cdtext.c,v 1.3 2005/11/11 12:26:57 rocky Exp $ $Id: cdtext.c,v 1.4 2006/03/18 01:28:13 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ print_disc_info(CdIo_t *p_cdio, track_t i_tracks, track_t i_first_track) {
print_cdtext_track_info(p_cdio, 0, "\nCD-Text for Disc:"); print_cdtext_track_info(p_cdio, 0, "\nCD-Text for Disc:");
for ( ; i_first_track < i_last_track; i_first_track++ ) { for ( ; i_first_track < i_last_track; i_first_track++ ) {
char psz_msg[50]; char psz_msg[50];
sprintf(psz_msg, "CD-Text for Track %d:", i_first_track); snprintf(psz_msg, sizeof(psz_msg), "CD-Text for Track %d:", i_first_track);
print_cdtext_track_info(p_cdio, i_first_track, psz_msg); print_cdtext_track_info(p_cdio, i_first_track, psz_msg);
} }
} }

View File

@@ -1,7 +1,7 @@
/* /*
$Id: iso2.c,v 1.11 2006/03/02 18:46:30 rocky Exp $ $Id: iso2.c,v 1.12 2006/03/18 01:28:13 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -89,6 +89,7 @@ main(int argc, const char *argv[])
char translated_name[256]; char translated_name[256];
char untranslated_name[256] = ISO9660_PATH; char untranslated_name[256] = ISO9660_PATH;
CdIo_t *p_cdio; CdIo_t *p_cdio;
unsigned int i_fname=sizeof(ISO9660_FILENAME);
if (argc > 3) { if (argc > 3) {
printf("usage %s [CD-ROM-or-image [filename]]\n", argv[0]); printf("usage %s [CD-ROM-or-image [filename]]\n", argv[0]);
@@ -101,12 +102,13 @@ main(int argc, const char *argv[])
else else
psz_image = ISO9660_IMAGE; psz_image = ISO9660_IMAGE;
if (argc > 2) if (argc > 2) {
psz_fname = argv[2]; psz_fname = argv[2];
else i_fname = strlen(psz_fname)+1;
} else
psz_fname = ISO9660_FILENAME; psz_fname = ISO9660_FILENAME;
strcat(untranslated_name, psz_fname); strncat(untranslated_name, psz_fname, i_fname);
p_cdio = cdio_open (psz_image, DRIVER_UNKNOWN); p_cdio = cdio_open (psz_image, DRIVER_UNKNOWN);
if (!p_cdio) { if (!p_cdio) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> * Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -13,8 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/ */
/* Simple program to show using libcdio's version of the CD-DA paranoia. /* Simple program to show using libcdio's version of the CD-DA paranoia.
library. library.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> * Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
/* Simple program to show using libcdio's version of the CD-DA /* Simple program to show using libcdio's version of the CD-DA

View File

@@ -1154,16 +1154,16 @@ main(int argc,char *argv[])
if(file[0]=='\0'){ if(file[0]=='\0'){
switch (output_type) { switch (output_type) {
case 0: /* raw */ case 0: /* raw */
strcat(outfile_name, "cdda.raw"); strncat(outfile_name, "cdda.raw", sizeof("cdda.raw"));
break; break;
case 1: case 1:
strcat(outfile_name, "cdda.wav"); strncat(outfile_name, "cdda.wav", sizeof("cdda.wav"));
break; break;
case 2: case 2:
strcat(outfile_name, "cdda.aifc"); strncat(outfile_name, "cdda.aifc", sizeof("cdda.aifc"));
break; break;
case 3: case 3:
strcat(outfile_name, "cdda.aiff"); strncat(outfile_name, "cdda.aiff", sizeof("cdda.aiff"));
break; break;
} }
} }
@@ -1185,16 +1185,16 @@ main(int argc,char *argv[])
switch(output_type){ switch(output_type){
case 0: /* raw */ case 0: /* raw */
strcat(outfile_name,"cdda.raw"); strncat(outfile_name, "cdda.raw", sizeof("cdda.raw"));
break; break;
case 1: case 1:
strcat(outfile_name,"cdda.wav"); strncat(outfile_name, "cdda.wav", sizeof("cdda.wav"));
break; break;
case 2: case 2:
strcat(outfile_name,"cdda.aifc"); strncat(outfile_name, "cdda.aifc", sizeof("cdda.aifc"));
break; break;
case 3: case 3:
strcat(outfile_name,"cdda.aiff"); strncat(outfile_name, "cdda.aiff", sizeof("cdda.aiff"));
break; break;
} }