[PATCH] Miscellaneous fixes for compiler warnings

Ray Strode halfline at gmail.com
Mon Jul 1 08:41:02 PDT 2013


Thanks, pushed!


On Fri, Jun 28, 2013 at 6:53 PM, Steve Langasek <
steve.langasek at canonical.com> wrote:

> From a38267d05a9621ef8b1e1a53152338026266b523 Mon Sep 17 00:00:00 2001
> From: Steve Langasek <steve.langasek at canonical.com>
> Date: Fri, 28 Jun 2013 14:29:15 -0700
> Subject: [PATCH] Miscellaneous fixes for compiler warnings
>
> 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                                      | 2 ++
>  src/plugins/splash/script/script-lib-plymouth.c | 1 +
>  src/plugins/splash/script/script-scan.c         | 7 +++++--
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/main.c b/src/main.c
> index 2a9c84d..81584a5 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -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
> diff --git a/src/plugins/splash/script/script-lib-plymouth.c
> b/src/plugins/splash/script/script-lib-plymouth.c
> index 7f143ae..ab2ec44 100644
> --- a/src/plugins/splash/script/script-lib-plymouth.c
> +++ b/src/plugins/splash/script/script-lib-plymouth.c
> @@ -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;
> diff --git a/src/plugins/splash/script/script-scan.c
> b/src/plugins/splash/script/script-scan.c
> index 3efef48..5d1aa64 100644
> --- a/src/plugins/splash/script/script-scan.c
> +++ b/src/plugins/splash/script/script-scan.c
> @@ -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;
> --
> 1.8.3.1
>
> _______________________________________________
> plymouth mailing list
> plymouth at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/plymouth
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20130701/44ed1c7a/attachment.html>


More information about the plymouth mailing list