zcat.cc (zutils-1.9.tar.lz) | : | zcat.cc (zutils-1.10.tar.lz) | ||
---|---|---|---|---|
/* Zcat - decompress and concatenate files to standard output | /* Zcat - decompress and concatenate files to standard output | |||
Copyright (C) 2010-2020 Antonio Diaz Diaz. | Copyright (C) 2010-2021 Antonio Diaz Diaz. | |||
This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation, either version 2 of the License, or | the Free Software Foundation, either version 2 of the License, or | |||
(at your option) any later version. | (at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | GNU General Public License for more details. | |||
skipping to change at line 76 | skipping to change at line 76 | |||
Line_number() : str( " 0\t" ), first_digit_pos( 5 ) {} | Line_number() : str( " 0\t" ), first_digit_pos( 5 ) {} | |||
void next() | void next() | |||
{ | { | |||
for( unsigned i = str.size() - 1; i > first_digit_pos; ) | for( unsigned i = str.size() - 1; i > first_digit_pos; ) | |||
{ | { | |||
if( str[--i] < '9' ) { ++str[i]; return; } | if( str[--i] < '9' ) { ++str[i]; return; } | |||
str[i] = '0'; | str[i] = '0'; | |||
} | } | |||
if( first_digit_pos > 0 ) str[--first_digit_pos] = '1'; | if( first_digit_pos > 0 ) str[--first_digit_pos] = '1'; | |||
else str.insert( first_digit_pos, 1, '1' ); | else str.insert( str.begin() + first_digit_pos, '1' ); | |||
} | } | |||
int sprint( uint8_t * const buf ) | int sprint( uint8_t * const buf ) | |||
{ | { | |||
std::memcpy( buf, str.c_str(), str.size() ); | std::memcpy( buf, str.c_str(), str.size() ); | |||
return str.size(); | return str.size(); | |||
} | } | |||
}; | }; | |||
Line_number line_number; | Line_number line_number; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |