Aetf / kmscon

Linux KMS/DRM based virtual Console Emulator
http://www.freedesktop.org/wiki/Software/kmscon
Other
175 stars 26 forks source link

Build error #68

Open imbillow opened 1 year ago

imbillow commented 1 year ago
../kmscon/src/text_pixman.c:135:7: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (!tp->surf[i]) {
                    ^~~~~~~~~~~~
../kmscon/src/text_pixman.c:160:9: note: uninitialized use occurs here
        return ret;
               ^~~
../kmscon/src/text_pixman.c:135:3: note: remove the 'if' if its condition is always false
                if (!tp->surf[i]) {
                ^~~~~~~~~~~~~~~~~~~
../kmscon/src/text_pixman.c:116:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0
1 error generated.

Maybe some variables needs to be initialized

diff --git a/src/kmscon_conf.c b/src/kmscon_conf.c
index 2f3b151..387b6b0 100644
--- a/src/kmscon_conf.c
+++ b/src/kmscon_conf.c
@@ -732,7 +732,7 @@ int kmscon_conf_new(struct conf_ctx **out)
        /* Video Options */
        CONF_OPTION_BOOL_FULL(0, "drm", aftercheck_drm, NULL, NULL, &conf->drm, true),
        CONF_OPTION_BOOL(0, "hwaccel", &conf->hwaccel, false),
-       CONF_OPTION(0, 0, "gpus", &conf_gpus, NULL, NULL, NULL, &conf->gpus, KMSCON_GPU_ALL),
+       CONF_OPTION(0, 0, "gpus", &conf_gpus, NULL, NULL, NULL, &conf->gpus, (void*)KMSCON_GPU_ALL),
        CONF_OPTION_STRING(0, "render-engine", &conf->render_engine, NULL),

        /* Font Options */
diff --git a/src/text_pixman.c b/src/text_pixman.c
index 060e1f0..d9a054e 100644
--- a/src/text_pixman.c
+++ b/src/text_pixman.c
@@ -113,7 +113,7 @@ static int alloc_indirect(struct kmscon_text *txt,
 {
    struct tp_pixman *tp = txt->data;
    unsigned int s, i, format;
-   int ret;
+   int ret = 0;

    log_info("using blitting engine");

diff --git a/src/uterm_drm3d_video.c b/src/uterm_drm3d_video.c
index 2dd3b5a..4da6ed4 100644
--- a/src/uterm_drm3d_video.c
+++ b/src/uterm_drm3d_video.c
@@ -411,7 +411,7 @@ static int video_init(struct uterm_video *video, const char *node)
    };
    const char *ext;
    int ret;
-   EGLint major, minor, n;
+   EGLint major, minor, n = 0;
    EGLenum api;
    EGLBoolean b;
    struct uterm_drm_video *vdrm;