--- parser3/src/main/pa_dir.C 2001/06/28 07:44:17 1.5 +++ parser3/src/main/pa_dir.C 2003/01/31 12:34:36 1.14.2.2 @@ -1,18 +1,19 @@ /** @file Parser: directory scanning for different OS-es. - Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com) - - Author: Alexander Petrosyan (http://design.ru/paf) + Copyright (c) 2000,2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char *RCSId="$Id: pa_dir.C,v 1.5 2001/06/28 07:44:17 parser Exp $"; -#include "pa_dir.h" +static const char* IDENT_DIR_C="$Date: 2003/01/31 12:34:36 $"; + #include "pa_common.h" +#include "pa_dir.h" +#include "pa_value_includes.h" #ifdef WIN32 -bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib) { +bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib) { char mask[MAXPATH]; snprintf(mask, MAXPATH, "%s/*.*", _pathname); @@ -29,8 +30,8 @@ void findclose(struct ffblk *_ffblk) { #else -bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib) { - strncpy(_ffblk->filePath, _pathname, MAXPATH); +bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib) { + strncpy(_ffblk->filePath, _pathname, MAXPATH-1); _ffblk->filePath[MAXPATH-1]=0; if(!(_ffblk->dir=opendir(_ffblk->filePath))) return true; @@ -44,8 +45,7 @@ bool findnext(struct ffblk *_ffblk) { return true; int maxsize=sizeof(_ffblk->ff_name)-1; - strncpy(_ffblk->ff_name, entry->d_name, maxsize); - _ffblk->ff_name[maxsize]=0; + strncpy(_ffblk->ff_name, entry->d_name, maxsize-1); _ffblk->ff_name[maxsize]=0; char fileSpec[MAXPATH]; snprintf(fileSpec, MAXPATH, "%s/%s",