View Issue Details

IDProjectCategoryView StatusLast Update
0032920Open CASCADEOCCT:Codingpublic2022-05-01 15:15
Reporterddzama Assigned Toddzama  
PrioritynormalSeverityminor 
Status verifiedResolutionfixed 
PlatformWindowsOSVC++ 2019 
Product Version7.6.0 
Target Version7.7.0 
Summary0032920: Coding - fix checking of std::stringstream buffer size on VS2019/C++20
DescriptionMicrosoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Replace `strange` method of defining available character count by simple one.
    
test bugs fclasses bug31189 fails because of method
std::stringstream::rdbuf::in_avail() returned 0 for not empty string.
When test on gcc/c++20, some case has next result:
     - For string "123456789012345" it gets 1.
     - For string "1234567890123456" it gets 16.
On MSVS 2019/c++20 for string "Sender message 2" it gets 0 for particular case.
This is the reason of test failure.

Description of `in_avail` method is some misty, so
change it to convenient one std::string::empty().
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberbugs/fclasses/bug31189

Relationships

child of 0032887 assignedddzama Coding - Problem of compilation on VS2019/C++20 

Activities

kgv

2022-04-07 12:09

developer   ~0107678

The objective of this 'strange' method is to check if buffer is empty or not and to avoid extra steps in this case.

As far as I understand, std::stringstream::str() will create a new string each time, and Message buffer is trying to skip it when it is not necessary.
std::stringstream is further passed to the messenger, which also calls std::stringstream::str() under the hood, but might skip this call if message has too low gravity.

While fixing this method, it is desired to update further calls as well (for instance, it doesn't make sense calling str() multiple times; it is still desired to consider avoiding string builder if it is not going to pass gravity filter).

git

2022-04-07 14:21

administrator   ~0107682

Branch CR32920 has been created by ddzama.

SHA-1: f6e99870f762305dfd2c8253580989c9ae2a2335


Detailed log of new commits:

Author: Dmitry DZAMA
Date: Mon Apr 4 07:29:42 2022 +0300

    0032920: Fix an error of incorrect checking of std::stringstream buffer size, available for reading
    
    Microsoft Visual Studio Professional 2019
    Version 16.11.11
    std=c++20
    
    Replace `strange` method of defining available character count by simple one.
    
    test bugs fclasses bug31189 fails because of method
    std::stringstream::rdbuf::in_avail() returned 0 for not empty string.
    When test on gcc/c++20, some case has next result:
         - For string "123456789012345" it gets 1.
         - For string "1234567890123456" it gets 16.
    On MSVS 2019/c++20 for string "Sender message 2" it gets 0 for particular case.
    This is the reason of test failure.
    
    Description of `in_avail` method is some misty, so
    change it to convenient one std::string::empty().

git

2022-04-07 14:42

administrator   ~0107705

Branch CR32920 has been updated forcibly by ddzama.

SHA-1: a1dba52279b5eebd79cc09c334ae553bcad24450

git

2022-04-07 14:57

administrator   ~0107708

Branch CR32920 has been updated forcibly by ddzama.

SHA-1: d42c6aa9193e38d195405e9db0ae5b0a08702e50

git

2022-04-20 11:15

administrator   ~0108039

Branch CR32920 has been updated forcibly by ddzama.

SHA-1: 19287a6e4f0bf530ad03515d2ee5c9b0a05415e4

git

2022-04-26 02:10

administrator   ~0108177

Branch CR32920 has been updated forcibly by ddzama.

SHA-1: 00935d078240b77954613aa0cc1b75a686b5682e

kgv

2022-04-26 22:11

developer   ~0108203

@ddzama,

> Kirill's Gavrilov review comment:
> The objective of this 'strange' method is to check if buffer is
> empty or not and to avoid extra steps in this case.

Git commit description is not a personal notebook, it should provide meaningful description to the change, not the history of discussions from a bug tracker.

git

2022-04-26 22:47

administrator   ~0108204

Branch CR32920_1 has been created by kgv.

SHA-1: 2f08e204b8fe9bdedf932780ef09af85ad841419


Detailed log of new commits:

Author: Dmitry DZAMA
Date: Mon Apr 4 07:29:42 2022 +0300

    0032920: Coding - fix checking of std::stringstream buffer size on VS2019/C++20
    
    Use tellp() instead of in_avail() for testing non-empty std::stringstream state.

kgv

2022-04-27 08:25

developer   ~0108207

@ddzama, please check if patch in branch CR32920_1 solves the problem.

smoskvin

2022-05-01 13:28

administrator   ~0108271

Combination -
OCCT branch : IR-2022-04-29
master SHA - e976df232941aae838b8c3dcf4b9f79f79bea705
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2022-04-29 SHA - d8a13f7f0c119514dcb0285266e54f3994f65e57
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18668.100000000675 / 18636.43000000061 [+0.17%]
Products
Total CPU difference: 11742.710000000114 / 11717.180000000135 [+0.22%]
Windows-64-VC14:
OCCT
Total CPU difference: 20733.796875 / 20693.28125 [+0.20%]
Products
Total CPU difference: 13272.875 / 13248.015625 [+0.19%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2022-05-01 15:15

administrator   ~0108277

Branch CR32920 has been deleted by mnt.

SHA-1: 00935d078240b77954613aa0cc1b75a686b5682e

git

2022-05-01 15:15

administrator   ~0108278

Branch CR32920_1 has been deleted by mnt.

SHA-1: 2f08e204b8fe9bdedf932780ef09af85ad841419

Related Changesets

occt: master e976df23

2022-04-04 07:29:42

ddzama


Committer: smoskvin Details Diff
0032920: Coding - fix checking of std::stringstream buffer size on VS2019/C++20

Use tellp() instead of in_avail() for testing non-empty std::stringstream state.
Affected Issues
0032920
mod - src/Message/Message_Messenger.hxx Diff File

Issue History

Date Modified Username Field Change
2022-04-07 10:56 ddzama New Issue
2022-04-07 10:56 ddzama Assigned To => ddzama
2022-04-07 12:03 kgv Product Version 7.7.0 => 7.6.0
2022-04-07 12:03 kgv Summary Fix an error of incorrect checking of std::stringstream buffer size, available for reading => Coding - fix checking of std::stringstream buffer size on Visual Studio 2019
2022-04-07 12:09 kgv Note Added: 0107678
2022-04-07 12:10 kgv Relationship added child of 0032887
2022-04-07 12:34 kgv Summary Coding - fix checking of std::stringstream buffer size on Visual Studio 2019 => Coding - fix checking of std::stringstream buffer size on VS2019
2022-04-07 12:35 kgv Summary Coding - fix checking of std::stringstream buffer size on VS2019 => Coding - fix checking of std::stringstream buffer size on VS2019/C++20
2022-04-07 14:21 git Note Added: 0107682
2022-04-07 14:42 git Note Added: 0107705
2022-04-07 14:51 ddzama Relationship deleted child of 0032887
2022-04-07 14:54 ddzama Relationship added child of 0032887
2022-04-07 14:57 git Note Added: 0107708
2022-04-20 11:15 git Note Added: 0108039
2022-04-26 02:10 git Note Added: 0108177
2022-04-26 11:29 ddzama Assigned To ddzama => kgv
2022-04-26 11:29 ddzama Status new => resolved
2022-04-26 11:29 ddzama Steps to Reproduce Updated
2022-04-26 22:11 kgv Note Added: 0108203
2022-04-26 22:47 git Note Added: 0108204
2022-04-27 08:25 kgv Assigned To kgv => ddzama
2022-04-27 08:25 kgv Status resolved => feedback
2022-04-27 08:25 kgv Note Added: 0108207
2022-04-27 08:26 kgv Test case number => bugs/fclasses/bug31189
2022-04-28 15:58 kgv Assigned To ddzama => bugmaster
2022-04-28 15:58 kgv Status feedback => reviewed
2022-05-01 13:28 smoskvin Status reviewed => tested
2022-05-01 13:28 smoskvin Note Added: 0108271
2022-05-01 14:32 smoskvin Changeset attached => occt master e976df23
2022-05-01 14:32 ddzama Assigned To bugmaster => ddzama
2022-05-01 14:32 ddzama Status tested => verified
2022-05-01 14:32 ddzama Resolution open => fixed
2022-05-01 15:15 git Note Added: 0108277
2022-05-01 15:15 git Note Added: 0108278