Changeset 64f018048c04f47d61c05a4ccfeb78755d2705cd

Show
Ignore:
Timestamp:
08/30/06 19:27:38 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1156958858 +0000
git-parent:

[f834305242997bff8e941b4362f147ba2594f4fb]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1156958858 +0000
Message:

*Really* fix base 64 encoding

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_url.h

    r64874cf r64f0180  
    223223           "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 
    224224    size_t len = strlen( src ); 
     225    const uint8_t *in = (const uint8_t *)src; 
    225226 
    226227    char *ret; 
     
    234235    { 
    235236        /* pops (up to) 3 bytes of input, push 4 bytes */ 
    236         uint32_t v = *src++ << 24; // 1/3 
     237        uint32_t v = *in++ << 24; // 1/3 
    237238        *dst++ = b64[v >> 26]; // 1/4 
    238239        v = v << 6; 
    239240 
    240241        if( len >= 2 ) 
    241             v |= *src++ << 16; // 2/3 
     242            v |= *in++ << 22; // 2/3 
    242243        *dst++ = b64[v >> 26]; // 2/4 
    243244        v = v << 6; 
    244245 
    245246        if( len >= 3 ) 
    246             v |= *src++ << 8; // 3/3 
     247            v |= *in++ << 20; // 3/3 
    247248        *dst++ = ( len >= 2 ) ? b64[v >> 26] : '='; // 3/4 
    248249        v = v << 6; 
  • src/test/url.c

    r64874cf r64f0180  
    8383    test_b64 ("", ""); 
    8484    test_b64 ("d", "ZA=="); 
    85     test_b64 ("ab", "YQG="); 
    86     test_b64 ("abc", "YQGI"); 
    87     test_b64 ("abcd", "YQGIZA=="); 
     85    test_b64 ("ab", "YWI="); 
     86    test_b64 ("abc", "YWJj"); 
     87    test_b64 ("abcd", "YWJjZA=="); 
    8888 
    8989    return 0;