]> git.donarmstrong.com Git - lilypond.git/commitdiff
Get rid of some compiler warnings; Fix chdir handling of errors
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 7 Aug 2011 17:13:04 +0000 (19:13 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 14 Aug 2011 14:30:16 +0000 (16:30 +0200)
-) Some "unused parameter" warnings
-) Some "ignoring return value" are a bit trickier. They are bad coding style:
    o) the file-name.cc one returns a string with undefined contents if getcwd
       fails, which might either crash guile or lead to other bugs.
    o) the lily-parser-scheme.cc warning was also a programming error (if you
       used --output=dir/file, and dir/ had the wrong permissions, then
       lilypond would not print an error, but simply put the output file into
       the current directory without telling the user!).
       In this case (output dir explicitly requested, but not possible
       to change there), I think it's best to exit lilypond with an
       error.
-) signed/unsigned warning in glissando-engraver.cc, where we already
   had a check for negative values, so explicitly casting to unsigned
   shuts up the compiler.
-) Remove unneccessary #(set-paper-size "a6") in the regtests
-) fix bad texinfo code in function documentation

flower/file-name.cc
input/regression/completion-heads-factor.ly
input/regression/completion-rest.ly
lily/glissando-engraver.cc
lily/lily-parser-scheme.cc
lily/lyric-combine-music-iterator.cc
lily/skyline.cc
ly/music-functions-init.ly
ly/predefined-fretboards-init.ly
scripts/build/extract_texi_filenames.py

index 14812a034c39b87363c64d08372b0838750f6e8a..27ce6df6f8ef799193866636c6fceed86607fb54 100644 (file)
@@ -97,9 +97,8 @@ string
 get_working_directory ()
 {
   char cwd[PATH_MAX];
-  getcwd (cwd, PATH_MAX);
-
-  return string (cwd);
+  // getcwd returns NULL upon a failure, contents of cwd would be undefined!
+  return string (getcwd (cwd, PATH_MAX));
 }
 
 /* Join components to full file_name. */
index a36da3accdb9b276c4c312d3b47c0e5ee9fe5856..2f10a44c9182f9c889e3b37ac7f261987c4f10a5 100644 (file)
@@ -9,8 +9,6 @@ notes with a duration factor still keep their requested appearance.
 "
 }
 
-#(set-paper-size "a6")
-
 \layout { ragged-right= ##t }
 
 
index 63aa5b37e08c359590158f05eb9d50b209df3733..034c3053c2725f8998318a5c58dbc0ba01922297 100644 (file)
@@ -9,8 +9,6 @@ rests with a duration factor still keep their requested appearance.
 "
 }
 
-#(set-paper-size "a6")
-
 \layout { ragged-right= ##t }
 
 
index 38270f446f79f0571021b11ff99683185f1e6ba6..0248c8fe789ff326f7a474869099bdb45be721c5 100644 (file)
@@ -121,7 +121,7 @@ Glissando_engraver::acknowledge_note_column (Grob_info info)
               continue;
             int n1 = robust_scm2int (scm_car (candidate), -1);
             int n2 = robust_scm2int (scm_cdr (candidate), -1);
-            if (n1 < 0 || n2 < 0 || n1 >= note_heads.size ())
+            if ((n1 < 0) || (n2 < 0) || (size_t(n1) >= note_heads.size ()))
               continue;
             note_column_1.push_back (vsize (n1));
             note_column_2.push_back (vsize (n2));
index ceefa6b0387626e2395fe190673ce714af237675..1107af999592991478f479aa8e2db8d3a46441ba 100644 (file)
@@ -70,19 +70,18 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
       else
         {
           File_name out (output_name);
-          if (is_dir (out.dir_part ()))
-            {
-              dir = out.dir_part ();
-              out_file_name = out.file_part ();
-            }
+          dir = out.dir_part ();
+          out_file_name = out.file_part ();
         }
 
       if (dir != "" && dir != "." && dir != get_working_directory ())
         {
           global_path.prepend (get_working_directory ());
-          message (_f ("Changing working directory to: `%s'",
-                       dir.c_str ()));
-          chdir (dir.c_str ());
+          message (_f ("Changing working directory to: `%s'", dir));
+          // If we can't change to the output dir (not existing, wrong
+          // permissions), exit lilypond
+          if (chdir (dir.c_str ()) != 0)
+            error (_f ("unable to change directory to: `%s'", dir));
         }
       else
         out_file_name = File_name (output_name);
index a6de96f5d3b8020981bf869962d6a6414e2865ea..3b2ee8548d972d6c6f307015ec1d0baf89947fb1 100644 (file)
@@ -221,7 +221,7 @@ Lyric_combine_music_iterator::construct_children ()
 
 IMPLEMENT_LISTENER (Lyric_combine_music_iterator, check_new_context)
 void
-Lyric_combine_music_iterator::check_new_context (SCM sev)
+Lyric_combine_music_iterator::check_new_context (SCM /*sev*/)
 {
   if (!ok ())
     return;
index b5288e2526816ac5a002f37f4426aff6b3b0c5f2..b6ea6b791bbbfa09aaa28e91da0a619c33085890 100644 (file)
@@ -392,7 +392,7 @@ Skyline::Skyline (Direction sky)
   added to it.
 */
 
-Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis a)
+Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis /*a*/)
 {
   /*
      We extract boxes from the skyline, then build a new skyline from
@@ -406,6 +406,7 @@ Skyline::Skyline (Skyline const &src, Real horizon_padding, Axis a)
   list<Box> boxes;
 
   // establish a baseline box
+  // FIXME: This has hardcoded logic, assuming a == X_AXIS!
   boxes.push_back (Box (Interval (-infinity_f, infinity_f),
                         Interval (0, 0)));
   list<Building>::const_iterator end = src.buildings_.end ();
index f82ac0b4e350c9328efe85784632862cff5ccff7..e6b8a97f58eaf45b88b1496a44bfb80428b8562f 100644 (file)
@@ -891,7 +891,7 @@ scaleDurations =
 shiftDurations =
 #(define-music-function (parser location dur dots arg)
    (integer? integer? ly:music?)
-   (_i "Scale @var{arg} up by a factor of @var{2^dur*(2-(1/2)^dots)}.")
+   (_i "Scale @var{arg} up by a factor of 2^@var{dur}*(2-(1/2)^@var{dots}).")
 
    (music-map
     (lambda (x)
index 996470a1611b78a2f99186938a593948946b33ca..247440561760941a11f7368a49d24b5cddd9d112 100644 (file)
@@ -33,7 +33,7 @@ addChordShape =
 #(define-music-function (parser location key-symbol tuning shape-definition)
    (symbol? pair? string-or-pair?)
    (_i "Add chord shape @var{shape-definition} to the @var{chord-shape-table}
-hash with the key @var{(cons key-symbol tuning)}.")
+hash with the key @code{(cons @var{key-symbol} @var{tuning})}.")
    (hash-set! chord-shape-table
                (cons key-symbol tuning)
                shape-definition)
index 7dd41eeadec97e851683faaeb97b872a830291fd..a3577ae830a77316570b37806ce415eee9180931 100644 (file)
@@ -131,8 +131,8 @@ def expand_includes (m, filename):
                 return extract_sections (filepath)[1]
         if not (include_name in known_missing_files):
             # Not found
-            print 'No such file: ' + include_name
-            print 'Search path: ' + ':'.join (include_path)
+            print 'Warning: No such file: ' + include_name + \
+                  ' (search path: ' + ':'.join (include_path)+')'
         return ''
 
 lang_re = re.compile (r'^@documentlanguage (.+)', re.M)