Skip to contentSkip to conversation

spice: fix compile error on 32bit system

PATCH In review [email protected] 2 participants 5 messages Sep 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spice: fix compile error on 32bit system

From: Changqing Li <[email protected]>

Fix below compile error on 32bit system, since input argument is uLong, but use format %d:
format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Werror=format=]

---
 .../0001-spice-fix-compile-fail-problem.patch      | 36 ++++++++++++++++++++++
 meta-networking/recipes-support/spice/spice_git.bb |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +36 -0
new file mode 100644
index 0000000..1f9d5fd
@@ -0,0 +1,36 @@
+From 7023732c65b4dc509c46a54fb7715da275b5597f Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 13 Sep 2018 12:39:44 +0800
+Subject: [PATCH] spice: fix compile fail problem
+
+compile error:
+format '%d' expects argument of type 'int', but argument 6 has 
+type 'long unsigned int' [-Werror=format=]
+
+spice compile failed on 32bit system, since upstream commit
+9541cd2fe(in V0.14.1) change %ld to %PRIdPTR, %PRIdPTR is %d, but argument
+strm.total_out is uLong.
+
+Upstream-Status: Submitted[https://github.com/freedesktop/spice/pull/1]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ server/red-replay-qxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 1fce76c..bd33b58 100644
+--- a/server/red-replay-qxl.c
++++ b/server/red-replay-qxl.c
+@@ -266,7 +266,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) {
+-            spice_error("inflate error %d (disc: %" PRIdPTR ")", ret, *size - strm.total_out);
++            spice_error("inflate error %d (disc: %ld)", ret, *size - strm.total_out);
+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+                  * in red_worker, when there is a shutdown from the vcpu/io thread
+-- 
+2.7.4
+
meta-networking/recipes-support/spice/spice_git.bb +1 -0
index 871bb0f..c7e4b03 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
     git://anongit.freedesktop.org/spice/spice;name=spice \
     git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
     file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-spice-fix-compile-fail-problem.patch \
 "
 
 FOO = "\
Signature · 1 line
2.7.4
#1 lore raw
Quoted 41 lines · On Wed, Sep 12, 2018 at 10:38 PM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix below compile error on 32bit system, since input argument is uLong, but use format %d:
format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Werror=format=]

---
 .../0001-spice-fix-compile-fail-problem.patch      | 36 ++++++++++++++++++++++
 meta-networking/recipes-support/spice/spice_git.bb |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +20 -0
new file mode 100644
index 0000000..1f9d5fd
@@ -0,0 +1,36 @@
+From 7023732c65b4dc509c46a54fb7715da275b5597f Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 13 Sep 2018 12:39:44 +0800
+Subject: [PATCH] spice: fix compile fail problem
+
+compile error:
+format '%d' expects argument of type 'int', but argument 6 has
+type 'long unsigned int' [-Werror=format=]
+
+spice compile failed on 32bit system, since upstream commit
+9541cd2fe(in V0.14.1) change %ld to %PRIdPTR, %PRIdPTR is %d, but argument
+strm.total_out is uLong.
+
+Upstream-Status: Submitted[https://github.com/freedesktop/spice/pull/1]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ server/red-replay-qxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch line 30

Quoted 10 lines
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +10 -0
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 1fce76c..bd33b58 100644
+--- a/server/red-replay-qxl.c
++++ b/server/red-replay-qxl.c
+@@ -266,7 +266,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) {
+-            spice_error("inflate error %d (disc: %" PRIdPTR ")", ret, *size - strm.total_out);
++            spice_error("inflate error %d (disc: %ld)", ret, *size - strm.total_out);

these values seem to be size_t types so please use PRIuPTR instead of PRIdPTR

Quoted 26 lines
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +6 -0
+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+                  * in red_worker, when there is a shutdown from the vcpu/io thread
+--
+2.7.4
+
meta-networking/recipes-support/spice/spice_git.bb +1 -1
index 871bb0f..c7e4b03 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
     git://anongit.freedesktop.org/spice/spice;name=spice \
     git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
     file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-spice-fix-compile-fail-problem.patch \
 "
 
 FOO = "\
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#2 lore raw
Quoted 44 lines · Khem Raj
Quoted 43 lines · On Wed, Sep 12, 2018 at 10:38 PM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix below compile error on 32bit system, since input argument is uLong, but use format %d:
format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Werror=format=]

---
  .../0001-spice-fix-compile-fail-problem.patch      | 36 ++++++++++++++++++++++
  meta-networking/recipes-support/spice/spice_git.bb |  1 +
  2 files changed, 37 insertions(+)

create mode 100644 meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +23 -0
new file mode 100644
index 0000000..1f9d5fd
@@ -0,0 +1,36 @@
+From 7023732c65b4dc509c46a54fb7715da275b5597f Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 13 Sep 2018 12:39:44 +0800
+Subject: [PATCH] spice: fix compile fail problem
+
+compile error:
+format '%d' expects argument of type 'int', but argument 6 has
+type 'long unsigned int' [-Werror=format=]
+
+spice compile failed on 32bit system, since upstream commit
+9541cd2fe(in V0.14.1) change %ld to %PRIdPTR, %PRIdPTR is %d, but argument
+strm.total_out is uLong.
+
+Upstream-Status: Submitted[https://github.com/freedesktop/spice/pull/1]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ server/red-replay-qxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 1fce76c..bd33b58 100644
+--- a/server/red-replay-qxl.c
Quoted 8 lines

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch line 30

Quoted 7 lines
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +7 -0
++++ b/server/red-replay-qxl.c
+@@ -266,7 +266,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) {
+-            spice_error("inflate error %d (disc: %" PRIdPTR ")", ret, *size - strm.total_out);
++            spice_error("inflate error %d (disc: %ld)", ret, *size - strm.total_out);

these values seem to be size_t types so please use PRIuPTR instead of PRIdPTR

the format %ld is for "*size - strm.total_out",   and strm.total_out is defined in zlib.h, is uLong. if use PRIuPTR(%u), we will still met compile error:
format '%u' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Werror=format=]

Besides,  "*size - strm.total_out" ,   size is unsigned int,  and strm.total_out is uLong,  but I think here we should use %ld, and need to convert unsigned to signed, to get the diff of these two value,  maybe unsigned in meaningless to read the reported error.

spice_error("inflate error %d (disc: %ld)", ret,(long int)(*size - strm.total_out));

How do you think?

//Sandy

Quoted 27 lines
Quoted 27 lines
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +6 -0
+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+                  * in red_worker, when there is a shutdown from the vcpu/io thread
+--
+2.7.4
+
meta-networking/recipes-support/spice/spice_git.bb +1 -1
index 871bb0f..c7e4b03 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
      git://anongit.freedesktop.org/spice/spice;name=spice \
      git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
      file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-spice-fix-compile-fail-problem.patch \
  "
 
  FOO = "\
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Signature · 4 lines
BRs

Sandy(Li Changqing)
Wind River Linux
#3 lore raw
Quoted 70 lines · Changqing Li
Quoted 52 lines · Khem Raj
Quoted 51 lines · On Wed, Sep 12, 2018 at 10:38 PM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix below compile error on 32bit system,  since input argument is uLong, but use format %d:
format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Werror=format=]

---
  .../0001-spice-fix-compile-fail-problem.patch      | 36
++++++++++++++++++++++
  meta-networking/recipes-support/spice/spice_git.bb |  1 +

  2 files changed, 37 insertions(+)

  create mode 100644 meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch +0 -0

new file mode 100644
index 0000000..1f9d5fd
--- /dev/null
+++
b/meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch +11 -0
@@ -0,0 +1,36 @@
+From 7023732c65b4dc509c46a54fb7715da275b5597f Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 13 Sep 2018 12:39:44 +0800
+Subject: [PATCH] spice: fix compile fail problem
+
+compile error:
+format '%d' expects argument of type 'int', but argument 6 has
+type 'long unsigned int' [-Werror=format=]
+
+spice compile failed on 32bit system, since upstream commit
+9541cd2fe(in V0.14.1) change %ld to %PRIdPTR, %PRIdPTR is %d, but 

argument

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch +3 -0
+strm.total_out is uLong.
+
+Upstream-Status: 

Submitted[https://github.com/freedesktop/spice/pull/1]

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch +11 -0
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ server/red-replay-qxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 1fce76c..bd33b58 100644
+--- a/server/red-replay-qxl.c
++++ b/server/red-replay-qxl.c
+@@ -266,7 +266,7 @@ static replay_t read_binary(SpiceReplay 

*replay, const char *prefix, size_t *siz

Quoted 8 lines
Quoted 7 lines

+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) { +-            spice_error("inflate error %d (disc: %" PRIdPTR ")", ret, *size - strm.total_out);
++            spice_error("inflate error %d (disc: %ld)", ret, *size
- strm.total_out);

these values seem to be size_t types so please use PRIuPTR instead of PRIdPTR

the format %ld is for "*size - strm.total_out",   and strm.total_out is defined in zlib.h, is uLong. if use PRIuPTR(%u), we will still met compile error:
format '%u' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Werror=format=]

Quoted 6 lines

Besides,  "*size - strm.total_out" ,   size is unsigned int,  and strm.total_out is uLong,  but I think here we should use %ld, and need to convert unsigned to signed, to get the diff of these two value,  maybe unsigned in meaningless to read the reported error.

spice_error("inflate error %d (disc: %ld)", ret,(long int)(*size - strm.total_out));

How do you think?

Please ignore this part,  don't need convert obviously. just use %ld is ok.

Quoted 34 lines

//Sandy

Quoted 29 lines
Quoted 29 lines

+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+                  * in red_worker, when there is a shutdown from the vcpu/io thread
+--
+2.7.4

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch +1 -0
+
meta-networking/recipes-support/spice/spice_git.bb +1 -0
index 871bb0f..c7e4b03 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
       git://anongit.freedesktop.org/spice/spice;name=spice \
 git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
       file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-spice-fix-compile-fail-problem.patch \

  "

  FOO = "\

Signature · 7 lines
2.7.4

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 4 lines
BRs

Sandy(Li Changqing)
Wind River Linux
#4 lore raw
In reply to Changqing Li
Quoted 58 lines · Changqing Li

On 09/13/2018 01:58 PM, Khem Raj wrote:

On Wed, Sep 12, 2018 at 10:38 PM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix below compile error on 32bit system, since input argument is uLong, but use format %d:
format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Werror=format=]

---
 .../0001-spice-fix-compile-fail-problem.patch      | 36 ++++++++++++++++++++++
 meta-networking/recipes-support/spice/spice_git.bb |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch
meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +30 -0
new file mode 100644
index 0000000..1f9d5fd
@@ -0,0 +1,36 @@
+From 7023732c65b4dc509c46a54fb7715da275b5597f Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 13 Sep 2018 12:39:44 +0800
+Subject: [PATCH] spice: fix compile fail problem
+
+compile error:
+format '%d' expects argument of type 'int', but argument 6 has
+type 'long unsigned int' [-Werror=format=]
+
+spice compile failed on 32bit system, since upstream commit
+9541cd2fe(in V0.14.1) change %ld to %PRIdPTR, %PRIdPTR is %d, but argument
+strm.total_out is uLong.
+
+Upstream-Status: Submitted[https://github.com/freedesktop/spice/pull/1]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ server/red-replay-qxl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
+index 1fce76c..bd33b58 100644
+--- a/server/red-replay-qxl.c
++++ b/server/red-replay-qxl.c
+@@ -266,7 +266,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
+             exit(1);
+         }
+         if ((ret = inflate(&strm, Z_NO_FLUSH)) != Z_STREAM_END) {
+-            spice_error("inflate error %d (disc: %" PRIdPTR ")", ret, *size - strm.total_out);
++            spice_error("inflate error %d (disc: %ld)", ret, *size - strm.total_out);
Quoted 6 lines

these values seem to be size_t types so please use PRIuPTR instead of PRIdPTR

the format %ld is for "*size - strm.total_out", and strm.total_out is defined in zlib.h, is uLong.
if use PRIuPTR(%u), we will still met compile error:
format '%u' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Werror=format=]

hmmm yes if its uLong then this might be fine.

Quoted 43 lines

Besides, "*size - strm.total_out" , size is unsigned int, and strm.total_out is uLong, but I think here we should use %ld,
and need to convert unsigned to signed, to get the diff of these two value, maybe unsigned in meaningless to read the reported error.

spice_error("inflate error %d (disc: %ld)", ret, (long int)(*size - strm.total_out));

How do you think?

//Sandy

meta-networking/recipes-support/spice/spice/0001-spice-fix-compile-fail-problem.patch new file +6 -0
+             if (ret == Z_DATA_ERROR) {
+                 /* last operation may be wrong. since we do the recording
+                  * in red_worker, when there is a shutdown from the vcpu/io thread
+--
+2.7.4
+
meta-networking/recipes-support/spice/spice_git.bb +1 -1
index 871bb0f..c7e4b03 100644
@@ -24,6 +24,7 @@ SRC_URI = " \
     git://anongit.freedesktop.org/spice/spice;name=spice \
     git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/subprojects/spice-common;name=spice-common \
     file://0001-Convert-pthread_t-to-be-numeric.patch \
+    file://0001-spice-fix-compile-fail-problem.patch \
 "
 
 FOO = "\
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
BRs

Sandy(Li Changqing)
Wind River Linux