MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / write

Function write

Source/3rdParty/bx/src/string.cpp:756–835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754 };
755
756 static int32_t write(WriterI* _writer, const char* _str, int32_t _len, const Param& _param, Error* _err)
757 {
758 int32_t size = 0;
759 int32_t len = (int32_t)strLen(_str, _len);
760
761 if (_param.width > 0)
762 {
763 len = min(_param.width, len);
764 }
765
766 const bool hasMinus = (NULL != _str && '-' == _str[0]);
767 const bool hasSign = _param.sign || hasMinus;
768 char sign = hasSign ? hasMinus ? '-' : '+' : '\0';
769
770 const char* str = _str;
771 if (hasMinus)
772 {
773 str++;
774 len--;
775 }
776
777 const int32_t padding = _param.width > len ? _param.width - len - hasSign: 0;
778
779 if (!_param.left)
780 {
781 if (' ' != _param.fill
782 && '\0' != sign)
783 {
784 size += write(_writer, sign, _err);
785 sign = '\0';
786 }
787
788 if (_param.width < _param.prec)
789 {
790 size += writeRep(_writer, _param.fill, max(0, padding), _err);
791 }
792 else
793 {
794 const int32_t maxPrec = max(_param.prec, len);
795 const int32_t fillLen = max(0, _param.width - maxPrec - hasSign);
796 size += writeRep(_writer, _param.fill, fillLen, _err);
797
798 if ('\0' != sign)
799 {
800 size += write(_writer, sign, _err);
801 sign = '\0';
802 }
803
804 size += writeRep(_writer, '0', max(0, padding-fillLen), _err);
805 }
806 }
807
808 if ('\0' != sign)
809 {
810 size += write(_writer, sign, _err);
811 }
812
813 if (NULL == _str)

Callers 15

writeMethod · 0.70
normalizeFilePathFunction · 0.70
printfFunction · 0.70
writeCallstackFunction · 0.70
defaultAssertHandlerFunction · 0.70
vsnprintfFunction · 0.70
vprintfFunction · 0.70
imageWriteTgaFunction · 0.50
imageWritePngFunction · 0.50
imageWriteExrFunction · 0.50
imageWriteHdrFunction · 0.50
imageWriteDdsHeaderFunction · 0.50

Calls 11

strLenFunction · 0.85
toUpperFunction · 0.85
strFindFunction · 0.85
memMoveFunction · 0.85
isUpperFunction · 0.85
toStringFunction · 0.70
readFunction · 0.70
isNumericFunction · 0.70
minFunction · 0.50
maxFunction · 0.50
getLengthMethod · 0.45

Tested by

no test coverage detected