[Bug 37118] New: PVS-Studio Error: Typos
https://bugs.winehq.org/show_bug.cgi?id=37118 Bug ID: 37118 Summary: PVS-Studio Error: Typos Product: Wine Version: 1.7.22 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs(a)winehq.org Reporter: lukebenes(a)hotmail.com V501 There are identical sub-expressions '!lpScaleWindowExtEx->xNum' to the left and to the right of the '||' operator. enhmetafile.c 1418 ... if (!lpScaleWindowExtEx->xNum || !lpScaleWindowExtEx->xDenom || !lpScaleWindowExtEx->xNum || !lpScaleWindowExtEx->yDenom) break; ... The lpScaleWindowExtEx->xNum condition is checked twice. Instead of one of the checks, the statement lpScaleWindowExtEx->yNum was most likely meant to be used. The corresponding field is found in the structure declaration: typedef struct { EMR emr; LONG xNum; //<== LONG xDenom; LONG yNum; //<== LONG yDenom; } EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX, EMRSCALEWINDOWEXTEX, *PEMRSCALEWINDOWEXTEX; V501 There are identical sub-expressions '!(types[i + 1] & PathPointTypeBezier)' to the left and to the right of the '||' operator. graphics.c 1751 ... for(i = 1; i < count; i++){ .... if((i + 2 >= count) || !(types[i + 1] & PathPointTypeBezier) || !(types[i + 1] & PathPointTypeBezier)){ .... } i += 2; } ... Another similar issue: V501 There are identical sub-expressions to the left and to the right of the '|' operator: VT_ARRAY | VT_ARRAY vartest.c 2161 details on the V501 error here:http://www.viva64.com/en/d/0090/ ... This fragment was discovered by the same diagnostic V501, but this time it doesn't show the reason for identical conditions that clearly. Most likely, one of them should contain types[i + 2] because the programmer has checked before if the array item with the index larger than 'i' by 2 can be addressed. V593 Consider reviewing the expression of the 'A = B != C' kind. The expression is calculated as following: 'A = (B != C)'. request.c 3354 if ((hr = SafeArrayAccessData( sa, (void **)&ptr )) != S_OK) return hr; if ((hr = SafeArrayGetUBound( sa, 1, &size ) != S_OK)) //<== { SafeArrayUnaccessData( sa ); return hr; } The precedence of the != operator is higher than that of the assignment operator =. And you can see clearly well from the condition above that the assignment should also be enclosed in another pair of parentheses as hr would otherwise get value 0 or 1. details on the V593 error here:http://www.viva64.com/en/d/0197/ -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37118 Luke <lukebenes(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |www.viva64.com/en/b/0272/ -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37118 Luke <lukebenes(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- URL|www.viva64.com/en/b/0272/ |http://www.viva64.com/en/b/ | |0272/ -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37118 --- Comment #1 from Nikolay Sivov <bunglehead(a)gmail.com> ---
V501 There are identical sub-expressions to the left and to the right of the '|' operator: VT_ARRAY | VT_ARRAY vartest.c 2161
I have a patch for that one and some others.
if ((hr = SafeArrayAccessData( sa, (void **)&ptr )) != S_OK) return hr; if ((hr = SafeArrayGetUBound( sa, 1, &size ) != S_OK)) //<== { SafeArrayUnaccessData( sa ); return hr; }
That's a valid one too. Looking at it now. Please don't mix separate problems in a same report, stick to the rule of 1 problem per bug report. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37118 Bruno Jesus <00cpxxx(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |88e8102570f46826c089415a72f | |6d9fb8feffce2 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #2 from Bruno Jesus <00cpxxx(a)gmail.com> --- Fixed by: http://source.winehq.org/git/wine.git/commitdiff/f1ed09fdd961cd3bde36e2cfd96... http://source.winehq.org/git/wine.git/commitdiff/88e8102570f46826c089415a72f... -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37118 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #3 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 1.7.30. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
wine-bugs@winehq.org