From 888becfc902c47c55b9fc28bdf4ef4eee76d3a69 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:51:36 +0000 Subject: [PATCH] lilypond-0.1.9 --- lib/file-storage.cc | 15 +++++++++------ lib/includable-lexer.cc | 16 ++++++++++------ lib/input.cc | 10 ++++++---- lib/simple-file-storage.cc | 5 +++-- lib/source-file.cc | 20 ++++++++++++-------- lib/source.cc | 5 +++-- 6 files changed, 43 insertions(+), 28 deletions(-) diff --git a/lib/file-storage.cc b/lib/file-storage.cc index 16bee29c68..849c27c994 100644 --- a/lib/file-storage.cc +++ b/lib/file-storage.cc @@ -55,10 +55,11 @@ Mapped_file_storage::open(String name_str) { fildes_i_ = ::open( name_str, O_RDONLY ); - if ( fildes_i_ == -1 ) { + if ( fildes_i_ == -1 ) + { warning( String( "can't open: " ) + name_str + String( ": " ) + strerror( errno )); return; - } + } struct stat file_stat; fstat( fildes_i_, &file_stat ); @@ -69,21 +70,23 @@ Mapped_file_storage::open(String name_str) void Mapped_file_storage::unmap() { - if ( data_caddr_ ) { + if ( data_caddr_ ) + { munmap( data_caddr_, size_off_ ); data_caddr_ = 0; size_off_ = 0; - } + } } void Mapped_file_storage::close() { unmap(); - if ( fildes_i_ ) { + if ( fildes_i_ ) + { ::close( fildes_i_ ); fildes_i_ = 0; - } + } } int diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index 6b4348d5f2..73d00498a8 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -24,10 +24,11 @@ void Includable_lexer::new_input(String s, Sources * global_sources) { Source_file * sl = global_sources->get_file_l(s); - if (!sl) { + if (!sl) + { LexerError("Can't find file `" + s+ "'"); return; - } + } char_count_stack_.push(0); @@ -59,12 +60,14 @@ Includable_lexer::close_input() cout << "]"<error_str( defined_ch_C_); - } + } cerr << str << endl; } diff --git a/lib/simple-file-storage.cc b/lib/simple-file-storage.cc index be022cee02..d66c2c2d9b 100644 --- a/lib/simple-file-storage.cc +++ b/lib/simple-file-storage.cc @@ -29,10 +29,11 @@ Simple_file_storage::Simple_file_storage(String s) { data_p_ =0; FILE * f = fopen ( s.ch_C(), "r"); - if ( !f ) { + if ( !f ) + { warning("can't open file\n"); return ; - } + } int ret = fseek( f, 0, SEEK_END); len_i_ = ftell(f); diff --git a/lib/source-file.cc b/lib/source-file.cc index ffc7a341ed..a67b466300 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -32,14 +32,16 @@ Source_file::istream_l() if ( !name_str_.length_i()) return &cin; - if ( !istream_p_ ) { + if ( !istream_p_ ) + { if ( length_i() ) // can-t this be done without such a hack? istream_p_ = new istrstream( ch_C(), length_i() ); - else { + else + { istream_p_ = new istrstream( "", 0 ); istream_p_->set(ios::eofbit); - } - } + } + } return istream_p_; } @@ -74,17 +76,19 @@ Source_file::error_str( char const* pos_ch_C )const pos_ch_C --; char const* begin_ch_C = pos_ch_C; while ( begin_ch_C > data_ch_C ) - if ( *--begin_ch_C == '\n' ) { + if ( *--begin_ch_C == '\n' ) + { begin_ch_C++; break; - } + } char const* end_ch_C = pos_ch_C; while ( end_ch_C < eof_C_ ) - if ( *end_ch_C++ == '\n' ) { + if ( *end_ch_C++ == '\n' ) + { end_ch_C--; break; - } + } // String( char const* p, int length ) is missing!? String line_str( (Byte const*)begin_ch_C, end_ch_C - begin_ch_C ); diff --git a/lib/source.cc b/lib/source.cc index ec490f17e7..e60041553c 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -34,12 +34,13 @@ Sources::set_path(File_path *f_C) Source_file* Sources::get_file_l(String &file_str ) //UGH { - if (path_C_){ + if (path_C_) + { String file_str_o = path_C_->find(file_str); if ( ( file_str_o == "" ) && ( file_str != "" ) ) return 0; file_str = file_str_o; - } + } Source_file * f_p= (!binary_b_) ? new Source_file(file_str) : new Binary_source_file(file_str); add(f_p); -- 2.39.5