VirtualBox

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


Ignore:
Timestamp:
Feb 10, 2012 1:10:26 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76187
Message:

RTBase64: fix trailing newline suppression in RTBase64EncodedLength, plus testcase

File:
1 edited

Legend:

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

    r33540 r40058  
    424424        cch /= 6;
    425425
    426         cch += (cch / RTBASE64_LINE_LEN) * RTBASE64_EOL_SIZE;
    427         cch -= (cch % RTBASE64_LINE_LEN) == 0;
     426        cch += ((cch - 1) / RTBASE64_LINE_LEN) * RTBASE64_EOL_SIZE;
    428427        return cch;
    429428    }
     
    434433    cch /= 6;
    435434
    436     cch += (cch / RTBASE64_LINE_LEN) * RTBASE64_EOL_SIZE;
    437     cch -= (cch % RTBASE64_LINE_LEN) == 0;
     435    cch += ((cch - 1) / RTBASE64_LINE_LEN) * RTBASE64_EOL_SIZE;
    438436    return cch;
    439437}
Note: See TracChangeset for help on using the changeset viewer.

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