Ignore:
Timestamp:
Jan 24, 2010, 10:58:17 PM (10 years ago)
Author:
Sam Hocevar
Message:

Fix the source code to reduce testsuite errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/codec/export.c

    r4299 r4300  
    993993static uint8_t _rgb_to_troff_index(uint32_t color)
    994994{
    995         int i;
    996         uint8_t r = 0;
    997         for(i = 0; i < 3; i++)
    998         {
    999                 r += ((color >> (8*i+7))&1) << i;
    1000         }
    1001         return r;
     995    int i;
     996    uint8_t r = 0;
     997    for(i = 0; i < 3; i++)
     998        r += ((color >> (8 * i + 7)) & 1) << i;
     999
     1000    return r;
    10021001}
    10031002
     
    10151014    int started = 0;
    10161015
    1017     /* Each char is at most 
     1016    /* Each char is at most
    10181017     *  2x\mM (2x10)
    10191018     *  + \fB + \fI + \fR (9)
     
    10381037        for(x = 0; x < cv->width; x++)
    10391038        {
    1040             uint32_t fg = _rgb_to_troff_index(_caca_attr_to_rgb24fg(lineattr[x]));
    1041             uint32_t bg = _rgb_to_troff_index(_caca_attr_to_rgb24bg(lineattr[x]));
    1042             uint32_t ch = linechar[x];
    1043 
    1044             if(fg != prevfg || !started)
    1045                 cur += sprintf(cur, "\\m[%s]", colors[fg]);
    1046             if(bg != prevbg || !started)
    1047                 cur += sprintf(cur, "\\M[%s]", colors[bg]);
     1039            uint32_t fg = _rgb_to_troff_index(_caca_attr_to_rgb24fg(lineattr[x]));
     1040            uint32_t bg = _rgb_to_troff_index(_caca_attr_to_rgb24bg(lineattr[x]));
     1041            uint32_t ch = linechar[x];
     1042
     1043            if(fg != prevfg || !started)
     1044                cur += sprintf(cur, "\\m[%s]", colors[fg]);
     1045            if(bg != prevbg || !started)
     1046                cur += sprintf(cur, "\\M[%s]", colors[bg]);
    10481047            if(lineattr[x] & CACA_BOLD)
    10491048                cur += sprintf(cur, "\\fB");
     
    10621061            prevbg = bg;
    10631062            started = 1;
    1064         }
     1063        }
    10651064
    10661065        /* Add unbreakable space at the end of lines, else spaces are dropped */
Note: See TracChangeset for help on using the changeset viewer.