]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Miscellaneous fixes for compiler warnings
authorSteve Langasek <steve.langasek@canonical.com>
Fri, 28 Jun 2013 22:53:40 +0000 (15:53 -0700)
committerRay Strode <rstrode@redhat.com>
Sun, 30 Jun 2013 18:44:47 +0000 (14:44 -0400)
Fix various warnings turned up with -Wall.  After fixing these remaining
issues, plymouth now builds successfully with gcc 4.8 using
"-Werror -Wno-error=unused-result -Wno-error=sign-compare".

src/main.c
src/plugins/splash/script/script-lib-plymouth.c
src/plugins/splash/script/script-scan.c

index 2a9c84daca731d31e7c3a0caaf3a4af46f051148..81584a5ef2c2df048c861dc0e7d184e30c65c852 100644 (file)
@@ -150,8 +150,10 @@ static void check_for_consoles (state_t    *state,
                                 const char *default_tty,
                                 bool        should_add_displays);
 static void toggle_between_splash_and_details (state_t *state);
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
 static void tell_systemd_to_print_details (state_t *state);
 static void tell_systemd_to_stop_printing_details (state_t *state);
+#endif
 static const char * get_cache_file_for_mode (ply_mode_t mode);
 
 static void
index 7f143aed7bad1f8368e71e78b303fc158b3004fb..ab2ec4439a7ea443fe180adfa3a6d57226d557ef 100644 (file)
@@ -64,6 +64,7 @@ static script_return_t plymouth_get_mode (script_state_t *state,
       case PLY_BOOT_SPLASH_MODE_UPDATES:
         obj = script_obj_new_string ("updates");
         break;
+      case PLY_BOOT_SPLASH_MODE_INVALID:
       default:
         obj = script_obj_new_string ("unknown");
         break;
index 3efef48a17a0b86f1a8e933b2afc5ce74a7ac23f..5d1aa64a0946c5bda8abe8e94264aab28b38b91c 100644 (file)
@@ -30,6 +30,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <string.h>
+#include <limits.h>
 
 #include "ply-bitarray.h"
 #include "script-scan.h"
@@ -371,11 +372,13 @@ static script_scan_token_t *script_scan_peek_token (script_scan_t *scan,
 {
   int i;
 
-  if (scan->tokencount <= n)
+  /* we're screwed long before we ever actually hit INT_MAX; but at least
+   * we shouldn't get ourselves stuck in an infinite loop. */
+  if (scan->tokencount <= n && n < INT_MAX)
     {
       scan->tokens =
         realloc (scan->tokens, (n + 1) * sizeof (script_scan_token_t *));
-      for (i = scan->tokencount; i <= n; i++)                                   /* FIXME warning about possibely inifnite loop */
+      for (i = scan->tokencount; i <= n; i++)
         {
           scan->tokens[i] = malloc (sizeof (script_scan_token_t));
           scan->tokens[i]->type = SCRIPT_SCAN_TOKEN_TYPE_EMPTY;