<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/libbb/get_line_from_file.c, branch cron_changes</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=cron_changes</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=cron_changes'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2023-06-28T14:10:49+00:00</updated>
<entry>
<title>win32: don't assume console CP equals OEM CP</title>
<updated>2023-06-28T14:10:49+00:00</updated>
<author>
<name>Avi Halachmi (:avih)</name>
<email>avihpit@yahoo.com</email>
</author>
<published>2023-06-28T14:10:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=ebe80f3e5c9b612f4d1b6e444c9badc10f9f2745'/>
<id>urn:sha1:ebe80f3e5c9b612f4d1b6e444c9badc10f9f2745</id>
<content type='text'>
Previously, console input was converted to the ANSI codepage using
OemToChar[Buff], and ANSI to console conversion used CharToOem[Buff].

However, while typically true by default, it's not guaranteed that
the console CP is the same as the OEM CP.

Now the code uses the console input/output CP as appropriate instead
of the OEM CP.  It uses full wide-char conversion code, which was
previously limited to FEATURE_EURO, and now may be used also otherwise.

While at it, the code now bypasses the conversion altogether if the
src/dst CPs happen to be identical - which can definitely happen.

Other than saving some CPU cycles, this also happens to fix an issue
with the UTF8 manifest (in both input and output), because apparently
the Oem/Char conversion APIs fail to convert one char at a time (which
is not a complete UTF8 codepoint sequence) even if both the OEM and
the ANSI CPs are UTF8 (as is the case when using UTF8 manifest).

Conversion is also skipped:

- if the converted output would be longer than the input;

- if the input length is 1 and the input is multi-byte.
</content>
</entry>
<entry>
<title>libbb: fix CRLF handling</title>
<updated>2023-01-31T08:22:10+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-01-31T08:22:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=f3aae6b7c256b1d9faff96f957f32886643bbaa8'/>
<id>urn:sha1:f3aae6b7c256b1d9faff96f957f32886643bbaa8</id>
<content type='text'>
Ensure a trailing CR is only removed if it precedes a LF.

The two cases at issue are intended to read complete lines and remove
the line terminator.  In the normal case a trailing LF will be present
so removing the CR unconditionally worked.  However, if the last line
of a file was missing its LF or if a NUL was detected (in the case of
xmalloc_fgetline()) the CR might have been removed without justification.
</content>
</entry>
<entry>
<title>libbb: speed up bb_get_chunk_from_file()</title>
<updated>2022-12-30T20:56:56+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2022-12-30T20:51:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=2b4dbe5fa8dc02d9cf4849fbda3197a522f16002'/>
<id>urn:sha1:2b4dbe5fa8dc02d9cf4849fbda3197a522f16002</id>
<content type='text'>
Use _getc_nolock() in bb_get_chunk_from_file() and perform code
page translation on the resulting string.  This speeds up grep by
another factor of two.

(GitHub issue #278)
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2018-09-10T13:59:33+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2018-09-10T13:37:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=d89ced75b204f0eb5611f522864beb81d1b393f5'/>
<id>urn:sha1:d89ced75b204f0eb5611f522864beb81d1b393f5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libbb: in xmalloc_fgets(), use size_t for bb_get_chunk_from_file()</title>
<updated>2018-09-02T16:48:09+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-09-02T16:48:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=22a99516206b33b7ae124d426319bab03d5c8309'/>
<id>urn:sha1:22a99516206b33b7ae124d426319bab03d5c8309</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Revert "libbb: remove unnecessary variable in xmalloc_fgets"</title>
<updated>2018-09-02T16:35:29+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-09-02T16:35:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0d598ab9f03dbf320f7b81c05e4a94cb303dfbc7'/>
<id>urn:sha1:0d598ab9f03dbf320f7b81c05e4a94cb303dfbc7</id>
<content type='text'>
The variable is in fact necessary.

    commit 2da9724b56169f00bd7fb6b9a11c9409a7620981
    Author: Quentin Rameau &lt;quinq@fifth.space&gt;
    Date:   Sun Apr 1 17:05:35 2018 +0200
        libbb: remove unnecessary variable in xmalloc_fgets

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2018-04-02T08:24:14+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2018-04-02T08:24:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=34a68d327b42c3c700e84cd475496985782290b1'/>
<id>urn:sha1:34a68d327b42c3c700e84cd475496985782290b1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>libbb: new function bb_die_memory_exhausted</title>
<updated>2018-04-01T17:59:37+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-04-01T17:59:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=899ae5337acc2d24edcd64e570adfc5f3c1a8a8a'/>
<id>urn:sha1:899ae5337acc2d24edcd64e570adfc5f3c1a8a8a</id>
<content type='text'>
function                                             old     new   delta
bb_die_memory_exhausted                                -      10     +10
xstrdup                                               28      23      -5
xsetenv                                               27      22      -5
xrealloc                                              32      27      -5
xputenv                                               22      17      -5
xmalloc                                               30      25      -5
xfdopen_helper                                        40      35      -5
xasprintf                                             44      39      -5
wget_main                                           2387    2382      -5
open_socket                                           54      49      -5
glob_brace                                           419     414      -5
bb_get_chunk_from_file                               146     141      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/11 up/down: 10/-55)           Total: -45 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>sed: prevent overflow of length from bb_get_chunk_from_file</title>
<updated>2018-04-01T17:51:14+00:00</updated>
<author>
<name>Quentin Rameau</name>
<email>quinq@fifth.space</email>
</author>
<published>2018-04-01T17:49:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=e2afae6303e871a31a061d03359cfcd5dd86c088'/>
<id>urn:sha1:e2afae6303e871a31a061d03359cfcd5dd86c088</id>
<content type='text'>
This fragment did not work right:

                temp = bb_get_chunk_from_file(fp, &amp;len);
                if (temp) {
                        /* len &gt; 0 here, it's ok to do temp[len-1] */
                        char c = temp[len-1];

With "int len" _sign-extending_, temp[len-1] can refer to a wrong location
if len &gt; 0x7fffffff.

Signed-off-by: Quentin Rameau &lt;quinq@fifth.space&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>libbb: remove unnecessary variable in xmalloc_fgets</title>
<updated>2018-04-01T17:45:36+00:00</updated>
<author>
<name>Quentin Rameau</name>
<email>quinq@fifth.space</email>
</author>
<published>2018-04-01T15:05:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=2da9724b56169f00bd7fb6b9a11c9409a7620981'/>
<id>urn:sha1:2da9724b56169f00bd7fb6b9a11c9409a7620981</id>
<content type='text'>
Signed-off-by: Quentin Rameau &lt;quinq@fifth.space&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
