From 690c2dd4eeaf7b55186b4fd84e03e2f65c787cf0 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Fri, 14 Dec 2001 21:03:03 +0000 Subject: Move [PATH/NAME]_MAX into compat.h. CVS patchset: 1246 CVS date: 2001/12/14 21:03:03 --- src/input/input_cda.c | 19 ++++++------------- src/input/input_file.c | 38 +++++++++++++++----------------------- src/xine-utils/compat.h | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/input/input_cda.c b/src/input/input_cda.c index 5a942ec20..e11413ea4 100644 --- a/src/input/input_cda.c +++ b/src/input/input_cda.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_cda.c,v 1.11 2001/12/11 00:04:09 f1rmb Exp $ + * $Id: input_cda.c,v 1.12 2001/12/14 21:03:03 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -83,13 +83,6 @@ #define _LEAVE_FUNC() #endif -#ifndef NAME_MAX -#define NAME_MAX 256 -#endif -#ifndef PATH_MAX -#define PATH_MAX 768 -#endif - #if defined(__sun) #define CDROM "/vol/dev/aliases/cdrom0" #else @@ -227,8 +220,8 @@ static void _cda_mkdir_safe(char *path) { */ static void _cda_mkdir_recursive_safe(char *path) { char *p, *pp; - char buf[PATH_MAX + NAME_MAX + 1]; - char buf2[PATH_MAX + NAME_MAX + 1]; + char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; + char buf2[XINE_PATH_MAX + XINE_NAME_MAX + 1]; if(path == NULL) return; @@ -284,7 +277,7 @@ static char *_cda_get_hostname_safe(void) { * */ static char *_cda_cddb_get_default_location(void) { - static char buf[PATH_MAX + NAME_MAX + 1]; + static char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; memset(&buf, 0, sizeof(buf)); sprintf(buf, "%s/.xine/cddbcache", (xine_get_homedir())); @@ -419,7 +412,7 @@ static int _cda_cddb_handle_code(char *buf) { * Try to load cached cddb infos */ static int _cda_load_cached_cddb_infos(cda_input_plugin_t *this) { - char cdir[PATH_MAX + NAME_MAX + 1]; + char cdir[XINE_PATH_MAX + XINE_NAME_MAX + 1]; DIR *dir; if(this == NULL) @@ -484,7 +477,7 @@ static int _cda_load_cached_cddb_infos(cda_input_plugin_t *this) { * Save cddb grabbed infos. */ static void _cda_save_cached_cddb_infos(cda_input_plugin_t *this, char *filecontent) { - char cfile[PATH_MAX + NAME_MAX + 1]; + char cfile[XINE_PATH_MAX + XINE_NAME_MAX + 1]; FILE *fd; if((this == NULL) || (filecontent == NULL)) diff --git a/src/input/input_file.c b/src/input/input_file.c index c34a54df4..2003cd546 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.34 2001/12/14 17:39:29 jkeil Exp $ + * $Id: input_file.c,v 1.35 2001/12/14 21:03:03 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -33,7 +33,6 @@ #include #include #include -#include /*PATH_MAX*/ #include "xine_internal.h" #include "xineutils.h" @@ -44,13 +43,6 @@ extern int errno; #define MAXFILES 65535 -#ifndef NAME_MAX -#define NAME_MAX 256 -#endif -#ifndef PATH_MAX -#define PATH_MAX 768 -#endif - #ifndef S_ISLNK #define S_ISLNK(mode) 0 #endif @@ -187,7 +179,7 @@ static uint32_t get_file_type(char *filepathname, char *origin) { struct stat pstat; int mode; uint32_t file_type = 0; - char buf[PATH_MAX + NAME_MAX + 1]; + char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; if((lstat(filepathname, &pstat)) < 0) { sprintf(buf, "%s/%s", origin, filepathname); @@ -233,7 +225,7 @@ static uint32_t get_file_type(char *filepathname, char *origin) { */ static off_t get_file_size(char *filepathname, char *origin) { struct stat pstat; - char buf[PATH_MAX + NAME_MAX + 1]; + char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; if((lstat(filepathname, &pstat)) < 0) { sprintf(buf, "%s/%s", origin, filepathname); @@ -410,9 +402,9 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, struct dirent *pdirent; DIR *pdir; mrl_t *hide_files, *dir_files, *norm_files; - char current_dir[PATH_MAX + 1]; - char current_dir_slashed[PATH_MAX + 1]; - char fullfilename[PATH_MAX + NAME_MAX + 1]; + char current_dir[XINE_PATH_MAX + 1]; + char current_dir_slashed[XINE_PATH_MAX + 1]; + char fullfilename[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int num_hide_files = 0; int num_dir_files = 0; int num_norm_files = 0; @@ -426,14 +418,14 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, * No origin location, so got the content of the current directory */ if(!filename) { - snprintf(current_dir, PATH_MAX, "%s", this->origin_path); + snprintf(current_dir, XINE_PATH_MAX, "%s", this->origin_path); } else { /* Remove exceed '/' */ while((filename[strlen(filename) - 1] == '/') && strlen(filename) > 1) filename[strlen(filename) - 1] = '\0'; - snprintf(current_dir, PATH_MAX, "%s", filename); + snprintf(current_dir, XINE_PATH_MAX, "%s", filename); } @@ -482,11 +474,11 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, /* The file is a link, follow it */ if(dir_files[num_dir_files].type & mrl_file_symlink) { - char linkbuf[PATH_MAX + NAME_MAX + 1]; + char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; memset(linkbuf, 0, sizeof(linkbuf)); - linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX); + linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { fprintf(stderr, "%s(%d): readlink() failed: %s\n", @@ -521,11 +513,11 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, /* The file is a link, follow it */ if(hide_files[num_hide_files].type & mrl_file_symlink) { - char linkbuf[PATH_MAX + NAME_MAX + 1]; + char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; memset(linkbuf, 0, sizeof(linkbuf)); - linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX); + linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { fprintf(stderr, "%s(%d): readlink() failed: %s\n", @@ -557,11 +549,11 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, /* The file is a link, follow it */ if(norm_files[num_norm_files].type & mrl_file_symlink) { - char linkbuf[PATH_MAX + NAME_MAX + 1]; + char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; memset(linkbuf, 0, sizeof(linkbuf)); - linksize = readlink(fullfilename, linkbuf, PATH_MAX + NAME_MAX); + linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { fprintf(stderr, "%s(%d): readlink() failed: %s\n", @@ -839,7 +831,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->mrls_allocated_entries = 0; { - char current_dir[PATH_MAX + 1]; + char current_dir[XINE_PATH_MAX + 1]; if(getcwd(current_dir, sizeof(current_dir)) == NULL) strcpy(current_dir, "."); diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h index 1eac305b7..c18e8b442 100644 --- a/src/xine-utils/compat.h +++ b/src/xine-utils/compat.h @@ -17,13 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: compat.h,v 1.1 2001/11/30 00:53:51 f1rmb Exp $ + * $Id: compat.h,v 1.2 2001/12/14 21:03:03 f1rmb Exp $ * */ #ifndef XINE_COMPAT_H #define XINE_COMPAT_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -34,6 +36,18 @@ extern "C" { #define __XINE_FUNCTION__ __FUNCTION__ #endif +#ifndef NAME_MAX +#define XINE_NAME_MAX 256 +#else +#define XINE_NAME_MAX NAME_MAX +#endif + +#ifndef PATH_MAX +#define XINE_PATH_MAX 768 +#else +#define XINE_PATH_MAX PATH_MAX +#endif + #ifdef __cplusplus } -- cgit v1.2.3