From 917e9bd0ce88a4c2c5d6f35874cda882179466f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 5 Apr 2006 23:39:11 +0000 Subject: [PATCH] whitespace cleanup git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13563 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/RandomAccessList.h | 2 +- src/support/filename.C | 2 +- src/support/filetools.C | 2 +- src/support/filetools.h | 2 +- src/support/forkedcall.C | 2 +- src/support/forkedcallqueue.h | 12 +++--- src/support/fs_extras.C | 74 +++++++++++++++++----------------- src/support/gzstream.C | 52 ++++++++++++------------ src/support/gzstream.h | 18 ++++----- src/support/mkdir.C | 2 +- src/support/os_win32.C | 2 +- src/support/strerror.c | 4 +- src/support/tempname.C | 4 +- 13 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/support/RandomAccessList.h b/src/support/RandomAccessList.h index 2e419bd700..c26d64668b 100644 --- a/src/support/RandomAccessList.h +++ b/src/support/RandomAccessList.h @@ -31,7 +31,7 @@ keeps the std::list::iterator interface. A typical use would be: typedef RandomAccessList MyContainer; -Then you can use MyContainer as if it was a standard +Then you can use MyContainer as if it was a standard std::vector for operator[] access and as if it was a standard std::list for iterator access. The main difference with std::vector is that insertion of elements is much less costly. Compared diff --git a/src/support/filename.C b/src/support/filename.C index e46b510584..67dde87f72 100644 --- a/src/support/filename.C +++ b/src/support/filename.C @@ -99,7 +99,7 @@ string const FileName::mangledFilename(std::string const & dir) const s << counter++ << mname; mname = s.str(); - // MiKTeX's YAP (version 2.4.1803) crashes if the file name + // MiKTeX's YAP (version 2.4.1803) crashes if the file name // is longer than about 160 characters. MiKTeX's pdflatex // is even pickier. A maximum length of 100 has been proven to work. // If dir.size() > max length, all bets are off for YAP. We truncate diff --git a/src/support/filetools.C b/src/support/filetools.C index 9c51d2aff9..ff8c46b4da 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -607,7 +607,7 @@ string const NormalizePath(string const & path) if (!npath.is_complete()) return "./" + npath.string() + '/'; - + return npath.string() + '/'; } diff --git a/src/support/filetools.h b/src/support/filetools.h index 7c0262cf26..423c4d4743 100644 --- a/src/support/filetools.h +++ b/src/support/filetools.h @@ -180,7 +180,7 @@ std::string const unzippedFileName(std::string const & zipped_file); Will overwrite an already existing unzipped file without warning. */ std::string const unzipFile(std::string const & zipped_file, - std::string const & unzipped_file = std::string()); + std::string const & unzipped_file = std::string()); /// Returns true is path is absolute bool AbsolutePath(std::string const & path); diff --git a/src/support/forkedcall.C b/src/support/forkedcall.C index 66bb45d221..4d4c1ac315 100644 --- a/src/support/forkedcall.C +++ b/src/support/forkedcall.C @@ -365,7 +365,7 @@ int Forkedcall::generateChild() pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND, argv[0], &*argv.begin()); #elif defined (_WIN32) - pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin()); + pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin()); #else // POSIX pid_t const cpid = ::fork(); if (cpid == 0) { diff --git a/src/support/forkedcallqueue.h b/src/support/forkedcallqueue.h index 20b939791b..be9953a881 100644 --- a/src/support/forkedcallqueue.h +++ b/src/support/forkedcallqueue.h @@ -31,13 +31,13 @@ class ForkedCallQueue { public: /// A process in the queue typedef std::pair Process; - /** Add a process to the queue. Processes are forked sequentially - *  only one is running at a time. -         *  Connect to the returned signal and you'll be informed when -         *  the process has ended. -         */ + /** Add a process to the queue. Processes are forked sequentially + * only one is running at a time. + * Connect to the returned signal and you'll be informed when + * the process has ended. + */ Forkedcall::SignalTypePtr add(std::string const & process); - /// Query whether the queue is running a forked process now. + /// Query whether the queue is running a forked process now. bool running() const; /// Get the and only instance of the class static ForkedCallQueue & get(); diff --git a/src/support/fs_extras.C b/src/support/fs_extras.C index 23f794761d..0be6a70811 100644 --- a/src/support/fs_extras.C +++ b/src/support/fs_extras.C @@ -83,8 +83,8 @@ bool is_readonly(path const & ph) #endif #ifdef BOOST_WINDOWS DWORD const attr = ::GetFileAttributes(ph.string().c_str()); - return (attr != INVALID_FILE_ATTRIBUTES - && (attr & FILE_ATTRIBUTE_READONLY)); + return (attr != INVALID_FILE_ATTRIBUTES + && (attr & FILE_ATTRIBUTE_READONLY)); #endif } @@ -94,7 +94,7 @@ void copy_file(path const & source, path const & target, bool noclobber) #ifdef BOOST_POSIX int const infile = ::open(source.string().c_str(), O_RDONLY); - if (infile == -1) { + if (infile == -1) { boost::throw_exception( filesystem_error( "boost::filesystem::copy_file", @@ -102,52 +102,52 @@ void copy_file(path const & source, path const & target, bool noclobber) fs::detail::system_error_code())); } - struct stat source_stat; - int const ret = ::fstat(infile, &source_stat); - if (ret == -1) { - ::close(infile); + struct stat source_stat; + int const ret = ::fstat(infile, &source_stat); + if (ret == -1) { + ::close(infile); boost::throw_exception( filesystem_error( "boost::filesystem::copy_file", source, target, fs::detail::system_error_code())); - } + } - int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC); + int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC); - int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode); - if (outfile == -1) { - ::close(infile); + int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode); + if (outfile == -1) { + ::close(infile); boost::throw_exception( filesystem_error( "boost::filesystem::copy_file", source, target, fs::detail::system_error_code())); - } - - std::size_t const buf_sz = 32768; - char buf[buf_sz]; - ssize_t in = -1; - ssize_t out = -1; - - while (true) { - in = ::read(infile, buf, buf_sz); - if (in == -1) { - break; - } else if (in == 0) { - break; - } else { - out = ::write(outfile, buf, in); - if (out == -1) { - break; - } - } - } - - ::close(infile); - ::close(outfile); - - if (in == -1 || out == -1) + } + + std::size_t const buf_sz = 32768; + char buf[buf_sz]; + ssize_t in = -1; + ssize_t out = -1; + + while (true) { + in = ::read(infile, buf, buf_sz); + if (in == -1) { + break; + } else if (in == 0) { + break; + } else { + out = ::write(outfile, buf, in); + if (out == -1) { + break; + } + } + } + + ::close(infile); + ::close(outfile); + + if (in == -1 || out == -1) boost::throw_exception( filesystem_error( "boost::filesystem::copy_file", diff --git a/src/support/gzstream.C b/src/support/gzstream.C index 13013abdc0..e1fcf5a442 100644 --- a/src/support/gzstream.C +++ b/src/support/gzstream.C @@ -48,57 +48,57 @@ namespace GZSTREAM_NAMESPACE { gzstreambuf* gzstreambuf::open( const char* name, int open_mode) { if ( is_open()) - return (gzstreambuf*)0; + return (gzstreambuf*)0; mode = open_mode; // no append nor read/write mode if ((mode & std::ios::ate) || (mode & std::ios::app) - || ((mode & std::ios::in) && (mode & std::ios::out))) - return (gzstreambuf*)0; + || ((mode & std::ios::in) && (mode & std::ios::out))) + return (gzstreambuf*)0; char fmode[10]; char* fmodeptr = fmode; if ( mode & std::ios::in) - *fmodeptr++ = 'r'; + *fmodeptr++ = 'r'; else if ( mode & std::ios::out) - *fmodeptr++ = 'w'; + *fmodeptr++ = 'w'; *fmodeptr++ = 'b'; *fmodeptr = '\0'; file = gzopen( name, fmode); if (file == 0) - return (gzstreambuf*)0; + return (gzstreambuf*)0; opened = 1; return this; } gzstreambuf * gzstreambuf::close() { if ( is_open()) { - sync(); - opened = 0; - if ( gzclose( file) == Z_OK) - return this; + sync(); + opened = 0; + if ( gzclose( file) == Z_OK) + return this; } return (gzstreambuf*)0; } int gzstreambuf::underflow() { // used for input buffer only if ( gptr() && ( gptr() < egptr())) - return * reinterpret_cast( gptr()); + return * reinterpret_cast( gptr()); if ( ! (mode & std::ios::in) || ! opened) - return EOF; + return EOF; // Josuttis' implementation of inbuf int n_putback = gptr() - eback(); if ( n_putback > 4) - n_putback = 4; + n_putback = 4; memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback); int num = gzread( file, buffer+4, bufferSize-4); if (num <= 0) // ERROR or EOF - return EOF; + return EOF; // reset buffer pointers setg( buffer + (4 - n_putback), // beginning of putback area - buffer + 4, // read position - buffer + 4 + num); // end of buffer + buffer + 4, // read position + buffer + 4 + num); // end of buffer // return next character return * reinterpret_cast( gptr()); @@ -109,20 +109,20 @@ int gzstreambuf::flush_buffer() { // sync() operation. int w = pptr() - pbase(); if ( gzwrite( file, pbase(), w) != w) - return EOF; + return EOF; pbump( -w); return w; } int gzstreambuf::overflow( int c) { // used for output buffer only if ( ! ( mode & std::ios::out) || ! opened) - return EOF; + return EOF; if (c != EOF) { - *pptr() = c; - pbump(1); + *pptr() = c; + pbump(1); } if ( flush_buffer() == EOF) - return EOF; + return EOF; return c; } @@ -131,8 +131,8 @@ int gzstreambuf::sync() { // which caused improper behavior with std::endl and flush(), // bug reported by Vincent Ricard. if ( pptr() && pptr() > pbase()) { - if ( flush_buffer() == EOF) - return -1; + if ( flush_buffer() == EOF) + return -1; } return 0; } @@ -152,13 +152,13 @@ gzstreambase::~gzstreambase() { void gzstreambase::open( const char* name, int open_mode) { if ( ! buf.open( name, open_mode)) - clear( rdstate() | std::ios::badbit); + clear( rdstate() | std::ios::badbit); } void gzstreambase::close() { if ( buf.is_open()) - if ( ! buf.close()) - clear( rdstate() | std::ios::badbit); + if ( ! buf.close()) + clear( rdstate() | std::ios::badbit); } #ifdef GZSTREAM_NAMESPACE diff --git a/src/support/gzstream.h b/src/support/gzstream.h index 0adeb62a99..3c4568d684 100644 --- a/src/support/gzstream.h +++ b/src/support/gzstream.h @@ -60,11 +60,11 @@ private: int flush_buffer(); public: gzstreambuf() : opened(0) { - setp( buffer, buffer + (bufferSize-1)); - setg( buffer + 4, // beginning of putback area - buffer + 4, // read position - buffer + 4); // end position - // ASSERT: both input & output capabilities will not be used together + setp( buffer, buffer + (bufferSize-1)); + setg( buffer + 4, // beginning of putback area + buffer + 4, // read position + buffer + 4); // end position + // ASSERT: both input & output capabilities will not be used together } int is_open() { return opened; } gzstreambuf* open( const char* name, int open_mode); @@ -98,10 +98,10 @@ class igzstream : public gzstreambase, public std::istream { public: igzstream() : std::istream( &buf) {} igzstream( const char* name, int open_mode = std::ios::in) - : gzstreambase( name, open_mode), std::istream( &buf) {} + : gzstreambase( name, open_mode), std::istream( &buf) {} gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } void open( const char* name, int open_mode = std::ios::in) { - gzstreambase::open( name, open_mode); + gzstreambase::open( name, open_mode); } }; @@ -109,10 +109,10 @@ class ogzstream : public gzstreambase, public std::ostream { public: ogzstream() : std::ostream( &buf) {} ogzstream( const char* name, int mode = std::ios::out) - : gzstreambase( name, mode), std::ostream( &buf) {} + : gzstreambase( name, mode), std::ostream( &buf) {} gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); } void open( const char* name, int open_mode = std::ios::out) { - gzstreambase::open( name, open_mode); + gzstreambase::open( name, open_mode); } }; diff --git a/src/support/mkdir.C b/src/support/mkdir.C index 4a068b42bb..5d91b713bb 100644 --- a/src/support/mkdir.C +++ b/src/support/mkdir.C @@ -41,7 +41,7 @@ int lyx::support::mkdir(std::string const & pathname, unsigned long int mode) // plain Windows 32 return CreateDirectory(pathname.c_str(), 0) != 0 ? 0 : -1; #elif HAVE__MKDIR - return ::_mkdir(pathname.c_str()); + return ::_mkdir(pathname.c_str()); #else # error "Don't know how to create a directory on this system." #endif diff --git a/src/support/os_win32.C b/src/support/os_win32.C index 71d2ff5d56..8fad6344d3 100644 --- a/src/support/os_win32.C +++ b/src/support/os_win32.C @@ -310,7 +310,7 @@ GetFolderPath::GetFolderPath() folder_path_func_ = reinterpret_cast(::GetProcAddress(folder_module_, "SHGetFolderPathA")); if (folder_path_func_ == 0) { lyxerr << "Unable to find SHGetFolderPathA in shfolder.dll\n" - "Don't know how to proceed. Sorry." + "Don't know how to proceed. Sorry." << std::endl; bail_out(); } diff --git a/src/support/strerror.c b/src/support/strerror.c index adf217865f..b678ddadcc 100644 --- a/src/support/strerror.c +++ b/src/support/strerror.c @@ -5,13 +5,13 @@ #include -/* $Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $ */ +/* $Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $ */ #if !defined(lint) && !defined(WITH_WARNINGS) static char vcid[] = "$Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $"; #endif /* lint */ -extern int sys_nerr ; +extern int sys_nerr ; extern char * sys_errlist [] ; char * strerror (int errnum) diff --git a/src/support/tempname.C b/src/support/tempname.C index afad6dedcf..601e21b30f 100644 --- a/src/support/tempname.C +++ b/src/support/tempname.C @@ -57,8 +57,8 @@ int make_tempfile(char * templ) return ::open(templ, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); # elif defined (HAVE__OPEN) return ::_open(templ, - _O_RDWR | _O_CREAT | _O_EXCL, - _S_IREAD | _S_IWRITE); + _O_RDWR | _O_CREAT | _O_EXCL, + _S_IREAD | _S_IWRITE); # else # error No open() function. # endif -- 2.39.5