File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 11build
2+ projects /build *
3+ projects /qt-creator /* .user
Original file line number Diff line number Diff line change @@ -112,25 +112,21 @@ namespace HttpClient
112112 cur_pos += sizeof (uint32_t );
113113 }
114114
115- const uint8_t align = (recv_size - cur_pos) % sizeof (uint32_t );
116-
117- frame.reserve (recv_size - cur_pos + align);
115+ frame.reserve (recv_size - cur_pos);
118116
119117 frame.assign (buf.cbegin () + cur_pos, buf.cbegin () + recv_size);
120118
121119 if (is_mask_set) {
122- if (align) {
123- frame.insert (frame.cend (), align, 0 );
124- }
120+ const size_t aligned = frame.size () - (frame.size () % sizeof (mask));
125121
126- uint32_t *addr = reinterpret_cast <uint32_t *>(frame.data () );
122+ uint32_t * const addr = reinterpret_cast <uint32_t *>(frame.data () );
127123
128- for (size_t i = 0 ; i < frame. size () / sizeof (uint32_t ); ++i) {
124+ for (size_t i = 0 ; i < aligned / sizeof (uint32_t ); ++i) {
129125 addr[i] ^= mask;
130126 }
131127
132- if (align ) {
133- frame. erase (frame. cend () - align, frame. cend () ) ;
128+ for ( size_t i = aligned; i < frame. size (); ++i ) {
129+ frame[i] ^= reinterpret_cast < char *>(&mask)[i % sizeof (mask)] ;
134130 }
135131 }
136132
You can’t perform that action at this time.
0 commit comments