Skip to content

Commit ddf3183

Browse files
committed
fixed uninitialized variable
1 parent cb485a4 commit ddf3183

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

libc/src/__support/wchar/mbstate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct mbstate {
2525
Increases with each push(...) until it reaches total_bytes
2626
Decreases with each pop(...) until it reaches 0
2727
*/
28-
uint8_t bytes_stored;
28+
uint8_t bytes_stored = 0;
2929

3030
// Total number of bytes that will be needed to represent this character
3131
uint8_t total_bytes = 0;

libc/src/__support/wchar/wcrtomb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ErrorOr<size_t> wcrtomb(char *__restrict s, wchar_t wc,
3434
return Error(status);
3535

3636
size_t count = 0;
37-
while (!cr.isComplete()) {
37+
while (!cr.isEmpty()) {
3838
auto utf8 = cr.pop_utf8(); // can never fail as long as the push succeeded
3939
LIBC_ASSERT(utf8.has_value());
4040

libc/src/wchar/wcrtomb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "src/wchar/wcrtomb.h"
1010

1111
#include "hdr/types/mbstate_t.h"
12+
#include "hdr/types/wchar_t.h"
1213
#include "src/__support/common.h"
1314
#include "src/__support/libc_errno.h"
1415
#include "src/__support/macros/config.h"

0 commit comments

Comments
 (0)