VirtualBox

Changeset 90850 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Aug 24, 2021 2:20:49 PM (3 years ago)
Author:
vboxsync
Message:

IPRT/log: Tested the odd cases of the LF->CRLF translation. bugref:10086

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r90847 r90850  
    9191
    9292/** The default buffer size. */
    93 #define RTLOG_BUFFER_DEFAULT_SIZE       _64K
     93#ifdef IN_RING0
     94# define RTLOG_BUFFER_DEFAULT_SIZE      _64K
     95#else
     96# define RTLOG_BUFFER_DEFAULT_SIZE      _128K
     97#endif
    9498/** Buffer alignment used RTLogCreateExV.   */
    9599#define RTLOG_BUFFER_ALIGN              64
     
    45874591                cb = cbBuf - offBuf - 1;
    45884592            }
    4589             else if (cb <= 2) /* 2  - Make sure we can write a \r\n and not loop forever. */
     4593            else if (cb <= 2) /* 2 - Make sure we can write a \r\n and not loop forever. */
    45904594            {
    45914595                rtlogFlush(pLoggerInt, true /*fNeedSpace*/);
     
    46014605            if (pszNewLine)
    46024606            {
     4607                cb = pszNewLine - pachChars;
    46034608                if (!(pLoggerInt->fFlags & RTLOGFLAGS_USECRLF))
    46044609                {
    4605                     cb = pszNewLine - pachChars + 1;
     4610                    cb += 1;
    46064611                    memcpy(&pchBuf[offBuf], pachChars, cb);
    46074612                    pLoggerInt->fPendingPrefix = true;
    46084613                }
    4609                 else if ((uintptr_t)(pszNewLine - pachChars) + 2U < cbBuf - offBuf)
     4614                else if (cb + 2U < cbBuf - offBuf)
    46104615                {
    4611                     cb = pszNewLine - pachChars;
    46124616                    memcpy(&pchBuf[offBuf], pachChars, cb);
    46134617                    pchBuf[offBuf + cb++] = '\r';
     
    46214625                {
    46224626                    /* Insufficient buffer space, leave the '\n' for the next iteration. */
    4623                     cb = pszNewLine - pachChars;
    46244627                    memcpy(&pchBuf[offBuf], pachChars, cb);
    46254628                }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette