summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-main.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-main.h')
-rw-r--r--xdelta3/xdelta3-main.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 6be82dc..23133a3 100644
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -1138,7 +1138,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1138 1138
1139 while (stream->inst_sect.buf < stream->inst_sect.buf_max) 1139 while (stream->inst_sect.buf < stream->inst_sect.buf_max)
1140 { 1140 {
1141 uint code = stream->inst_sect.buf[0]; 1141 uint code = stream->inst_sect.buf[0];
1142 const uint8_t *addr_before = stream->addr_sect.buf;
1143 const uint8_t *inst_before = stream->inst_sect.buf;
1144 usize_t addr_bytes;
1145 usize_t inst_bytes;
1146 usize_t size_before = size;
1142 1147
1143 if ((ret = xd3_decode_instruction (stream))) 1148 if ((ret = xd3_decode_instruction (stream)))
1144 { 1149 {
@@ -1147,13 +1152,15 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1147 return ret; 1152 return ret;
1148 } 1153 }
1149 1154
1155 addr_bytes = stream->addr_sect.buf - addr_before;
1156 inst_bytes = stream->inst_sect.buf - inst_before;
1157
1150 VC(UT " %06"Q"u %03u %s %3u", stream->dec_winstart + size, code, 1158 VC(UT " %06"Q"u %03u %s %3u", stream->dec_winstart + size, code,
1151 xd3_rtype_to_string (stream->dec_current1.type, option_print_cpymode), 1159 xd3_rtype_to_string (stream->dec_current1.type, option_print_cpymode),
1152 (usize_t) stream->dec_current1.size)VE; 1160 (usize_t) stream->dec_current1.size)VE;
1153 1161
1154 if (stream->dec_current1.type != XD3_NOOP) 1162 if (stream->dec_current1.type != XD3_NOOP)
1155 { 1163 {
1156 size += stream->dec_current1.size;
1157 if (stream->dec_current1.type >= XD3_CPY) 1164 if (stream->dec_current1.type >= XD3_CPY)
1158 { 1165 {
1159 VC(UT " @%-6u", (usize_t)stream->dec_current1.addr)VE; 1166 VC(UT " @%-6u", (usize_t)stream->dec_current1.addr)VE;
@@ -1162,11 +1169,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1162 { 1169 {
1163 VC(UT " ")VE; 1170 VC(UT " ")VE;
1164 } 1171 }
1172
1173 size += stream->dec_current1.size;
1165 } 1174 }
1166 1175
1167 if (stream->dec_current2.type != XD3_NOOP) 1176 if (stream->dec_current2.type != XD3_NOOP)
1168 { 1177 {
1169 size += stream->dec_current2.size;
1170 VC(UT " %s %3u", 1178 VC(UT " %s %3u",
1171 xd3_rtype_to_string (stream->dec_current2.type, 1179 xd3_rtype_to_string (stream->dec_current2.type,
1172 option_print_cpymode), 1180 option_print_cpymode),
@@ -1176,9 +1184,22 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1176 { 1184 {
1177 VC(UT " @%-6u", (usize_t)stream->dec_current2.addr)VE; 1185 VC(UT " @%-6u", (usize_t)stream->dec_current2.addr)VE;
1178 } 1186 }
1187
1188 size += stream->dec_current2.size;
1179 } 1189 }
1180 1190
1181 VC(UT "\n")VE; 1191 VC(UT "\n")VE;
1192
1193 if (option_verbose &&
1194 addr_bytes + inst_bytes >= (size - size_before) &&
1195 (stream->dec_current1.type >= XD3_CPY ||
1196 stream->dec_current2.type >= XD3_CPY))
1197 {
1198 VC(UT " %06"Q"u (inefficiency) %u encoded as %u bytes\n",
1199 stream->dec_winstart + size_before,
1200 size - size_before,
1201 addr_bytes + inst_bytes)VE;
1202 }
1182 } 1203 }
1183 1204
1184 if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0) 1205 if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0)