mirror of
https://github.com/vim/vim.git
synced 2025-10-05 05:34:07 -04:00
patch 9.0.1383: xxd: combination of little endian and cols fails
Problem: xxd: combination of little endian and cols fails. (Aapo Rantalainen) Solution: Round up the space taken by the hex output. (closes #12097)
This commit is contained in:
@@ -401,4 +401,18 @@ func Test_xxd_plain_one_line()
|
|||||||
endfor
|
endfor
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_xxd_little_endian_with_cols()
|
||||||
|
enew!
|
||||||
|
call writefile(["ABCDEF"], 'Xxdin', 'D')
|
||||||
|
exe 'r! ' .. s:xxd_cmd .. ' -e -c6 ' .. ' Xxdin'
|
||||||
|
call assert_equal('00000000: 44434241 4645 ABCDEF', getline(2))
|
||||||
|
|
||||||
|
enew!
|
||||||
|
call writefile(["ABCDEFGHI"], 'Xxdin', 'D')
|
||||||
|
exe 'r! ' .. s:xxd_cmd .. ' -e -c9 ' .. ' Xxdin'
|
||||||
|
call assert_equal('00000000: 44434241 48474645 49 ABCDEFGHI', getline(2))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1383,
|
||||||
/**/
|
/**/
|
||||||
1382,
|
1382,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -837,7 +837,8 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
addrlen = sprintf(l, decimal_offset ? "%08ld:" : "%08lx:",
|
addrlen = sprintf(l, decimal_offset ? "%08ld:" : "%08lx:",
|
||||||
((unsigned long)(n + seekoff + displayoff)));
|
((unsigned long)(n + seekoff + displayoff)));
|
||||||
for (c = addrlen; c < LLEN; l[c++] = ' ');
|
for (c = addrlen; c < LLEN; l[c++] = ' ')
|
||||||
|
;
|
||||||
}
|
}
|
||||||
x = hextype == HEX_LITTLEENDIAN ? p ^ (octspergrp-1) : p;
|
x = hextype == HEX_LITTLEENDIAN ? p ^ (octspergrp-1) : p;
|
||||||
c = addrlen + 1 + (grplen * x) / octspergrp;
|
c = addrlen + 1 + (grplen * x) / octspergrp;
|
||||||
@@ -857,7 +858,12 @@ main(int argc, char *argv[])
|
|||||||
if (ebcdic)
|
if (ebcdic)
|
||||||
e = (e < 64) ? '.' : etoa64[e-64];
|
e = (e < 64) ? '.' : etoa64[e-64];
|
||||||
/* When changing this update definition of LLEN above. */
|
/* When changing this update definition of LLEN above. */
|
||||||
c = addrlen + 3 + (grplen * cols - 1)/octspergrp + p;
|
if (hextype == HEX_LITTLEENDIAN)
|
||||||
|
/* last group will be fully used, round up */
|
||||||
|
c = grplen * ((cols + octspergrp - 1) / octspergrp);
|
||||||
|
else
|
||||||
|
c = (grplen * cols - 1) / octspergrp;
|
||||||
|
c += addrlen + 3 + p;
|
||||||
l[c++] =
|
l[c++] =
|
||||||
#ifdef __MVS__
|
#ifdef __MVS__
|
||||||
(e >= 64)
|
(e >= 64)
|
||||||
|
Reference in New Issue
Block a user