Commit 56bd3fc
Avoid narrowing conversion by using operator<< for string output
Replace calls to write() with operator<< when writing std::string
to streams.
std::string::size() returns an unsigned value (size_t), while
std::ostream::write() expects a signed std::streamsize, which
introduces a narrowing conversion. Using operator<< is simpler,
idiomatic, and avoids this type mismatch. It also improves
readability without changing behavior.1 parent 002c039 commit 56bd3fc
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
647 | | - | |
| 647 | + | |
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| |||
0 commit comments