Closed Bug 449291 Opened 12 years ago Closed 7 years ago

In <TestEncoding.cpp>, multiple "warning C4309: 'initializing' : truncation of constant value"

Categories

(Core :: XPCOM, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.9.1a2

People

(Reporter: sgautherie, Assigned: sgautherie)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(1 file, 1 obsolete file)

[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/2008080519 SeaMonkey/2.0a1pre] (home, optim default) (W2Ksp4)

{{
.../xpcom/tests/TestEncoding.cpp(61) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(61) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(61) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(61) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(105) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(148) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(148) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(148) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(191) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(191) : warning C4309: 'initializing' : truncation of constant value
.../xpcom/tests/TestEncoding.cpp(191) : warning C4309: 'initializing' : truncation of constant value
}}

Clean up the output.
Attached patch (Av1) <TestEncoding.cpp> (obsolete) — Splinter Review
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/2008080519 SeaMonkey/2.0a1pre] (home, optim default) (W2Ksp4)

*Remove an extra space.
*s/0x0/0x00/g
*Add casts.
Assignee: nobody → sgautherie.bz
Status: NEW → ASSIGNED
Attachment #332432 - Flags: review?(bsmedberg)
Av1, with bug 410708 comment 4 suggestion(s) ;-)
Attachment #332432 - Attachment is obsolete: true
Attachment #333054 - Flags: review?(bsmedberg)
Attachment #332432 - Flags: review?(bsmedberg)
Attachment #333054 - Flags: review?(bsmedberg) → review?(benjamin)
Attachment #333054 - Flags: superreview?(benjamin)
Comment on attachment 333054 [details] [diff] [review]
(Av2) <TestEncoding.cpp>

I'm not sure I understand which changes are fixing what.

I understand why you might need '\xEF' instead of 0xEF in a char initializer, because char may be an unsigned type.

Is PRUnichar a signed type on windows (it's a typedef of wchar_t)?

I'm pretty sure (I hope!) that the change to 0x00 is not required, and I think it makes the code less readable... please prove me right.
Attachment #333054 - Flags: superreview?(benjamin)
Attachment #333054 - Flags: review?(benjamin)
Attachment #333054 - Flags: review-
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1b1pre) Gecko/20080927200111 Minefield/3.1b1pre] (home, debug default) (W2Ksp4)

Not sure if the two issues are related,
but, as this is the same test, reporting it here for now:
{
Running TestEncoding
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 718
WARNING: got a high Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 709
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 631
WARNING: got a High Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 619
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 361
WARNING: got a High Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 345
WARNING: got a high Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 709
WARNING: got a High Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 619
WARNING: got a High Surrogate but no low surrogate: ...\include\string\nsUTF8Utils.h, line 345
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 718
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 631
WARNING: got a low Surrogate but no high surrogate: ...\include\string\nsUTF8Utils.h, line 361
Running TestEncoding tests...
}
Whiteboard: [build_warning]
Can this be resolved?

The TestEncoding.cpp warnings were fixed in Bug 552805.

The NS_WARNINGS in nsUTF8Utils.h still seem to be there however...
Flags: needinfo?(sgautherie.bz)
sgautherie, ping...
Since the primary issue this bug was reported against was fixed (see Comment 5), and it has been a month without any reply, I am resolving this bug for now...
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(sgautherie.bz)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.