Branch: Tag:

2019-03-19

2019-03-19 12:33:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Merge commit '722771973bd' into patches/lyslyskom22891031

* commit '722771973bd': (6177 commits)
Verify that callablep responses are aligned with reality.
...

2019-02-07

2019-02-07 15:02:50 by William Welliver <william@welliver.org>

Merge branch 'grubba/wop-local-variables-debug-info' into bill/debugger-concept

2019-02-02

2019-02-02 17:12:32 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: Use Pike stack for storing on_write cb for call

Gives normal error propagation while freeing us from having to handle
errors ourselves.

2019-02-02 17:12:32 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: Let the GC know again about our on_write callback

Removed in the buffer mode API change commit, but turned out to not do
nothing.

2019-02-02 09:30:19 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio: Buffer mode now uses ->write(Stdio.Buffer()) API

As part of this change, the Stdio.Buffer()->__fd_set_output() API got
replaced by Stdio.Buffer()->__set_on_write(), and users (File and
SSL.File) have been adopted to use it.

2018-11-04

2018-11-04 11:19:35 by Arne Goedeke <el@laramies.com>

Merge branch 'buffer_mode_proposal_wip'

2018-11-04 10:50:40 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.File()->read(): advance buffer if possible

This commit also removed Stdio.Buffer()->advance() because it
is a bad API. It allows one to 'validate' uninitialized memory
inside of Stdio.Buffer objects.

Instead, we now try to advance the write offset in Buffer objects
in Stdio.File()->read(), instead. This is done using a new internal
API which can be extended to advance other buffer types in the future.

2018-11-04 10:03:17 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added allocate() and advance()

2018-11-03

2018-11-03 14:21:37 by Marcus Comstedt <marcus@mc.pp.se>

Merge remote-tracking branch 'origin/8.1' into gobject-introspection

2018-10-10

2018-10-10 10:49:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Added support for escapes to read_cstring().

2018-10-09

2018-10-09 14:47:17 by Jonas Walldén <jonasw@roxen.com>

Fix refdoc typo.

2018-10-09 14:46:30 by Jonas Walldén <jonasw@roxen.com>

Fix refdoc typo.

2018-08-05

2018-08-05 10:33:29 by Martin Nilsson <nilsson@fastmail.com>

Punctuation in error messages.

2018-05-22

2018-05-22 09:20:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Build [Stdio.Buffer]: Fixed a few warnings.

2018-05-19

2018-05-19 18:57:33 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed some compile warnings

2018-05-17

2018-05-17 15:49:53 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Eliminates race condition from read_cstring().

In addition it makes read_cstring():
- Restartable after buffer changes from range_error().
- Call range_error(0) just like sscanf().
- Faster.

The race condition occurred after a pause due to range_error(),
the subsequent io_rewind() at the end could not rewind far enough.

2018-05-17 15:49:53 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Decrease system call overhead.

2018-05-17 15:49:53 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Centralise bufferconstants.

2018-05-17 15:49:53 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Simplify code, centralise locked_move check.

2018-05-17 15:37:00 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Eliminates race condition from read_cstring().

In addition it makes read_cstring():
- Restartable after buffer changes from range_error().
- Call range_error(0) just like sscanf().
- Faster.

The race condition occurred after a pause due to range_error(),
the subsequent io_rewind() at the end could not rewind far enough.

2018-05-17 10:58:42 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Decrease system call overhead.

2018-05-17 10:58:39 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Centralise bufferconstants.

2018-05-17 10:58:23 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Simplify code, centralise locked_move check.

2018-03-17

2018-03-17 20:13:55 by Martin Nilsson <nilsson@fastmail.com>

Remove redundant includes.

2018-03-04

2018-03-04 10:34:08 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added allocate() and advance()

2018-02-03

2018-02-03 09:48:55 by Peter Bortas <bortas@gmail.com>

Merge branch '8.1' into peter/travis

2018-01-19

2018-01-19 16:14:39 by Martin Nilsson <nilsson@fastmail.com>

Use the ALLOC_STRUCT macro when possible.

2018-01-18

2018-01-18 13:21:51 by Martin Nilsson <nilsson@fastmail.com>

Move pike_search.h include from pike_memory.h and made includes implicit where needed.

2017-12-31

2017-12-31 23:19:10 by Peter Bortas <bortas@gmail.com>

Merge remote-tracking branch 'origin/8.1' into peter/travis

2017-12-28

2017-12-28 15:42:27 by Martin Nilsson <nilsson@fastmail.com>

Clena up stack in create

2017-12-02

2017-12-02 12:52:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Support bignums in add_int{8,16,32}().

add_int8() and add_int16() now support getting called
with a bignum.

add_int32() with a bignum now ignores any bits outside
the 32-bit range.

2017-11-05

2017-11-05 15:53:18 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Merge branch 'grubba/rename_lfun_destroy' into 8.1

* grubba/rename_lfun_destroy:
Modules: Fixed logts of warnings.
Testsuite: Updated for LFUN::_destruct().
Compiler: Don't complain about LFUN::destroy() in compat mode.
Fix multiple warnings.
Runtime: LFUN::destroy() has been renamed to _destruct().
Compiler: Rename LFUN::destroy() to LFUN::_destruct().

2017-11-05 15:05:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fix multiple warnings.

LFUN::destroy() has been renamed to _destruct().

2017-11-01

2017-11-01 16:36:59 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Some type and documentation updates.

2017-11-01 15:43:47 by Arne Goedeke <el@laramies.com>

Stdio.Buffer()->trim(): fixed possible memcpy on overlapping regions

trim() will move data inside of the buffer regardless of the number
of wasted bytes. In those cases src and dst of the memcpy() call may
overlap.

2017-11-01 15:40:16 by Arne Goedeke <el@laramies.com>

Stdio.Buffer()->trim(): fixed possible memcpy on overlapping regions

trim() will move data inside of the buffer regardless of the number
of wasted bytes. In those cases src and dst of the memcpy() call may
overlap.

2017-11-01 11:18:29 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed growth strategy

Unless trim() was called manually or unless the buffer was empty,
the growth strategy would never reuse empty space at the beginning
of the buffer. Instead, it would always allocate more space.

The code now works as described in the comment. When at least half of
the buffer space in the beginning of the allocated region is unused,
the data is moved to the front before new memory is being allocated.

2017-11-01 10:59:33 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed growth strategy

Unless trim() was called manually or unless the buffer was empty,
the growth strategy would never reuse empty space at the beginning
of the buffer. Instead, it would always allocate more space.

The code now works as described in the comment. When at least half of
the buffer space in the beginning of the allocated region is unused,
the data is moved to the front before new memory is being allocated.

2017-09-24

2017-09-24 09:14:53 by Arne Goedeke <el@laramies.com>

MsgPack.encode_to(): call fd output function

2017-09-24 09:00:33 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added more missing io_trigger_output calls

add_padding() and add_bignum() did not trigger the fd output callback.

2017-09-24 08:59:11 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added more missing io_trigger_output calls

add_padding() and add_bignum() did not trigger the fd output callback.

2017-09-24 08:54:33 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: trigger fd output in add_int*() and input_from()

The add_int family of methods and input_from() did not trigger a call
to the fd output function, which could result in write() never being
called when using Stdio.File buffer mode.

2017-09-24 08:51:29 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: trigger fd output in add_int*() and input_from()

The add_int family of methods and input_from() did not trigger a call
to the fd output function, which could result in write() never being
called when using Stdio.File buffer mode.

2017-07-30

2017-07-30 09:46:59 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fix unread()

The documentation promises that unread() will always succeed until new
data is added to the buffer. This contract was broken when the new
growth strategy was added by commit 2c4241823. That commit added a
possible trim to every read operation, which would try to shrink the
buffer and make a future unread() fail.

Also, the max_waste check contained a typo, which made it always
succeed.

This issue does not affect rewind keys.

2017-07-30 09:22:26 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fix unread()

The documentation promises that unread() will always succeed until new
data is added to the buffer. This contract was broken when the new
growth strategy was added by commit 2c4241823. That commit added a
possible trim to every read operation, which would try to shrink the
buffer and make a future unread() fail.

Also, the max_waste check contained a typo, which made it always
succeed.

This issue does not affect rewind keys.

2017-07-11

2017-07-11 20:35:13 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: return unsigned integers in _sizeof

On 32bit systems we might encounter buffers larger than INT_MAX.
Use push_ulongest() to make sure that we do not accidentally return
negative length.

2017-06-29

2017-06-29 21:03:44 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed integer overflow in read_json()

If the decoded JSON is larger than INT_MAX, it could not be correctly
decoded from a buffer.

2017-06-29 16:34:54 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed typo in previous commit

2017-06-29 16:32:07 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: fixed integer overflow in read_json()

If the decoded JSON is larger than INT_MAX, it could not be correctly
decoded from a buffer.

2017-06-25

2017-06-25 02:30:21 by Martin Nilsson <nilsson@fastmail.com>

Linewrap

2017-06-25 01:38:13 by Martin Nilsson <nilsson@fastmail.com>

Storage is zeroed by calloc, so no need to memset it.

2017-06-17

2017-06-17 13:52:53 by Martin Nilsson <nilsson@fastmail.com>

Call fast_clone_object instead of low_clone+call_c_initializers

2017-06-16

2017-06-16 19:15:51 by Marcus Agehall <agehall@roxen.com>

Prevent SIGSEGV when attempting to create rewind keys on the buffers returned by read_buffer().

2017-06-16 19:14:46 by Marcus Agehall <agehall@roxen.com>

Prevent SIGSEGV when attempting to create rewind keys on the buffers returned by read_buffer().

2017-05-18

2017-05-18 09:26:22 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed multiple issues with read_le_int().

The threshold for using io_read_number() instead of io_read_bignum()
was off by one (on the safe side).

Fixes broken use of mpz_import() in io_read_bignum().

Fixed typo in documentation.

2017-05-07

2017-05-07 12:25:56 by Martin Nilsson <nilsson@fastmail.com>

Added basic little endian support to reading Stdio.Buffer.

2017-01-25

2017-01-25 15:22:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Break out sprintf-related stuff from stralloc.h to sprintf.h.

Minor header file cleanup.

2016-12-30

2016-12-30 13:40:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Allocate a constant program id.

2016-12-30 13:39:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Allocate a constant program id.

2016-11-05

2016-11-05 13:55:27 by Martin Nilsson <nilsson@fastmail.com>

Return -1 when failing to find a hit with search(Stdio.Buffer).

2016-10-17

2016-10-17 10:51:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer [search]: Support searching for substrings.

2016-10-14

2016-10-14 12:20:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer [search]: _search() now behaves as documented.

Return UNDEFINED instead of -1 on failure (as -1 is a valid result).

2016-10-13

2016-10-13 15:03:09 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer [search]: Support specifying the end position.

It is now possible to inform the Stdio.Buffer lfun::_search() that
it shouldn't scan past a certain position.

Also removes an unused variable.

2016-10-10

2016-10-10 15:38:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Added _search().

2016-06-09

2016-06-09 16:06:48 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Support some bignums in add_int32().

FIXME: Ought not to care about the high order bits of the bignum.

FIXME: Add similar support to the other add_int*() as well.

Thanks to Per Cederqvist <ceder@lysator.liu.se> for the report.

Fixes [bug 7712].

2016-05-27

2016-05-27 14:02:27 by Per Hedbor <ph@opera.com>

(0..255) -> 8bit and similar changes

This means that buffer.cmod now needs a pike 8.0 (or newer)
precompiler.

2016-05-23

2016-05-23 15:05:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Some cosmetic changes.

2016-05-09

2016-05-09 16:28:36 by Martin Nilsson <nilsson@fastmail.com>

LONGEST is just INT64, so use that instead.

2016-01-26

2016-01-26 19:38:42 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_BAD_ARG_ERROR is only kept for compatibility, but we still had 500+ uses of it.

2015-12-12

2015-12-12 16:34:17 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added truncate()

2015-12-12 16:34:17 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: export a minimal C-API

Make a minimal API available to be used from c modules. This allows
writing encoders/decoders which directly operate on Buffer objects.

2015-11-24

2015-11-24 16:15:49 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: export a minimal C-API

Make a minimal API available to be used from c modules. This allows
writing encoders/decoders which directly operate on Buffer objects.

2015-11-24 16:15:49 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added truncate()

2015-11-23

2015-11-23 08:54:37 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: export a minimal C-API

Make a minimal API available to be used from c modules. This allows
writing encoders/decoders which directly operate on Buffer objects.

2015-11-23 08:54:37 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: added truncate()

2015-10-25

2015-10-25 16:48:09 by Martin Nilsson <nilsson@fastmail.com>

Allow read_cstring to have a different end sentinel than null.

2015-08-27

2015-08-27 12:45:42 by Per Hedbor <ph@opera.com>

Backported locked check fix for Stdio.Buffer from 8.1

2015-08-22

2015-08-22 18:35:10 by Per Hedbor <ph@opera.com>

Static:ified a lot of strings.

This is more or less all instances of push_text(static data here).

Left to do: make_shared_X_string(static data here). :)

2015-08-18

2015-08-18 18:07:49 by Per Hedbor <ph@opera.com>

Static:ified a lot of strings.

This is more or less all instances of push_text(static data here).

Left to do: make_shared_X_string(static data here). :)

2015-08-05

2015-08-05 22:53:56 by Per Hedbor <ph@opera.com>

Use the set_unaligned16/32 function

2015-08-03

2015-08-03 14:19:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Avoid unaligned accesses.

Fixes SIGBUS when adding integers to unaligned buffers on non-x86/amd64.

2015-07-27

2015-07-27 18:02:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Modifying read-only buffers is NOT a good idea...

Fixes SSL testsuite failure.

2015-07-27 11:00:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Added some locking to _sprintf().

The buffer could get trimmed during _sprintf() before it was rewound.

2015-07-21

2015-07-21 09:46:28 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: removed C99ism

2015-07-14

2015-07-14 17:42:54 by Per Hedbor <ph@opera.com>

Fixed an issue with output_to to non-files (eg, ssl).

This bug was created by the new code that allows the buffer to shrink.

2015-07-14 17:41:48 by Per Hedbor <ph@opera.com>

Fixed an issue with output_to to non-files (eg, ssl).

This bug was created by the new code that allows the buffer to shrink.

2015-07-13

2015-07-13 15:12:43 by Per Hedbor <ph@opera.com>

Rewrote buffer growth strategy

It is now 1.625x old size instead of 2.0 x old size + bytes_added,
with some exception.

Also added a shrink strategy, by default it's close to the reverse: If
more than 61.5% of the buffer is empty space, shrink it down
(1/1.625).

(cherry picked from commit 917184b64444098f8b84c79cdd1de89ccaa467f6)

Conflicts:
src/modules/_Stdio/buffer.cmod

2015-07-13 14:57:48 by Per Hedbor <ph@opera.com>

Rewrote buffer growth strategy

It is now 1.625x old size instead of 2.0 x old size + bytes_added,
with some exception.

Also added a shrink strategy, by default it's close to the reverse: If
more than 61.5% of the buffer is empty space, shrink it down
(1/1.625).

2015-05-25

2015-05-25 14:56:10 by Martin Nilsson <nilsson@opera.com>

Normalized file ends.

2015-05-16

2015-05-16 13:07:02 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: io_ensure_malloced: use size_t type for 'bytes' input parameter.

Also adds an overflow check.

2015-05-16 13:07:01 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: use round_up*() functions to enlarge buffer.

Fixes an infinity loop due to overflow. Also changed the round_up*() functions
to return 0 on overflow and made 1 the next power of two after 0.

2015-05-16 13:02:23 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: io_ensure_malloced: use size_t type for 'bytes' input parameter.

Also adds an overflow check.

2015-05-16 13:02:23 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: use round_up*() functions to enlarge buffer.

Fixes an infinity loop due to overflow. Also changed the round_up*() functions
to return 0 on overflow and made 1 the next power of two after 0.

2015-05-16 13:02:23 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: xrealloc() now throws on realloc() failure.

2015-05-16 00:24:09 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: undo erroneous change of allocation behaviour

2015-05-16 00:19:22 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: undo erroneous change of allocation behaviour

2015-05-15

2015-05-15 18:43:14 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: throw on realloc() failures

2015-05-15 18:43:13 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer(): Don't allow negative padding to be added.

2015-05-15 18:43:13 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer(): add_padding() now adds padding.

2015-05-15 18:42:37 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: throw on realloc() failures

2015-05-15 18:42:37 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer(): Don't allow negative padding to be added.

2015-05-15 18:42:37 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer(): add_padding() now adds padding.

2015-05-07

2015-05-07 20:52:59 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: less leaking of rewind structs

2015-05-07 20:52:14 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.Buffer: less leaking of rewind structs

2015-05-02

2015-05-02 11:01:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Avoid shift by negative. Fixes [CID 1294563].

2015-04-25

2015-04-25 13:10:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed NULL-deref on UNDEFINED. Fixes [CID 1294611].

2015-04-21

2015-04-21 09:21:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed integer overflow. Fixes [CID 1294563].

2015-04-21 09:20:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed integer overflow. Fixes [CID 1294563].

2015-04-07

2015-04-07 09:13:00 by Henrik Grubbström (Grubba) <grubba@grubba.org>

[portability] Replaced use of MAX with MAXIMUM.

The macro MAX is apparently available on Linux, but not on Solaris 10.

2015-04-02

2015-04-02 10:04:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Build [NT]: <arpa/inet.h> is not available on all platforms.

Restored some #ifdef guards.

2015-02-23

2015-02-23 15:23:41 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: trigger write cb when adding to empty buffer

When the buffer was empty and a new string was added to it,
the write callback was not triggered.

2015-02-23 14:25:49 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: trigger write cb when adding to empty buffer

When the buffer was empty and a new string was added to it,
the write callback was not triggered.

2014-12-06

2014-12-06 20:59:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Use ptrdiff_t instead of ssize_t.

ptrdiff_t is C89, while ssize_t is POSIX. As we support some
non-POSIX architectures, use the more portable type.

2014-12-06 20:56:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Use ptrdiff_t instead of ssize_t.

ptrdiff_t is C89, while ssize_t is POSIX. As we support some
non-POSIX architectures, use the more portable type.

2014-12-06 19:14:31 by Bill Welliver <bill@welliver.org>

build: help build on Windows

2014-12-06 18:05:48 by Marcus Comstedt <marcus@mc.pp.se>

Stdio.Buffer: Fix alignment problem in io_append_{short,int}_uc

2014-12-01

2014-12-01 13:46:16 by Martin Nilsson <nilsson@opera.com>

Make cast() protected.

2014-12-01 13:23:53 by Martin Nilsson <nilsson@opera.com>

Make cast() protected.

2014-11-26

2014-11-26 21:24:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: LFUN::_sprintf() must not have side effects!

sprintf("%s", buf) and sprintf("%q", buf) had the side effect
of emptying the buffer (which is not what you expect when you
use them for debug output...).

2014-11-26 21:22:02 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: LFUN::_sprintf() must not have side effects!

sprintf("%s", buf) and sprintf("%q", buf) had the side effect
of emptying the buffer (which is not what you expect when you
use them for debug output...).

2014-11-24

2014-11-24 16:15:23 by Per Hedbor <ph@opera.com>

The buffer_error_program only takes one argument.

This could probably be handled better.

2014-11-24 16:10:25 by Per Hedbor <ph@opera.com>

The buffer_error_program only takes one argument.

This could probably be handled better.

2014-11-20

2014-11-20 14:36:50 by Martin Nilsson <nilsson@opera.com>

Work around precompiler type issue.

2014-11-10

2014-11-10 13:51:21 by Stephen R. van den Berg <srb@cuci.nl>

Fix docs.

2014-11-10 13:50:46 by Stephen R. van den Berg <srb@cuci.nl>

Fix docs.

2014-11-09

2014-11-09 22:05:08 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Support all types for add_hstring.

2014-11-09 22:05:08 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Support offset parameter for add_hstring/read_hstring.

2014-10-30

2014-10-30 02:50:38 by Martin Nilsson <nilsson@opera.com>

Removed stray undef.

2014-10-30 02:41:13 by Martin Nilsson <nilsson@opera.com>

Don't include gmp.h directly. Use bignum.h

2014-10-29

2014-10-29 19:25:26 by Stephen R. van den Berg <srb@cuci.nl>

Simplify code.

2014-10-29 19:25:26 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Support offset parameter for add_hstring/read_hstring.

2014-10-29 19:25:26 by Stephen R. van den Berg <srb@cuci.nl>

Stdio.Buffer: Support all types for add_hstring.

2014-10-29 19:25:25 by Stephen R. van den Berg <srb@cuci.nl>

Simplify code.

2014-10-29 17:55:47 by Martin Nilsson <nilsson@opera.com>

Access bignum_program directly.

2014-10-20

2014-10-20 16:49:15 by Per Hedbor <ph@opera.com>

Use the feature flag instead of api_version.

2014-10-20 16:34:45 by Per Hedbor <ph@opera.com>

Fixed the name of the rewind_on_error and rewind_key functions

2014-10-19

2014-10-19 12:18:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed some documentation typos.

2014-10-19 12:17:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed some documentation typos.

2014-10-17

2014-10-17 19:15:01 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Use the correct macro...

2014-10-12

2014-10-12 17:54:00 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed return type for sprintf().

2014-10-12 17:53:01 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed return type for sprintf().

2014-10-11

2014-10-11 10:35:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Added try_output().

2014-10-11 10:34:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Added try_output().

2014-10-09

2014-10-09 11:49:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Handle UNDEFINED nbytes in input_from().

The nbytes argument may be UNDEFINED (typically when the once argument
has been specified). Handle it as if nbytes hasn't been specified.

Thanks to Stephen R. van den Berg <srb@cuci.nl> for the report.

Fixes some of [LysLysKOM 20998397]/[Pike mailinglist 14064].

2014-10-09 11:49:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Handle UNDEFINED nbytes in input_from().

The nbytes argument may be UNDEFINED (typically when the once argument
has been specified). Handle it as if nbytes hasn't been specified.

Thanks to Stephen R. van den Berg <srb@cuci.nl> for the report.

Fixes some of [LysLysKOM 20998397]/[Pike mailinglist 14064].

2014-10-08

2014-10-08 16:43:31 by Martin Nilsson <nilsson@opera.com>

Fixed warning.

2014-10-05

2014-10-05 21:12:29 by Martin Nilsson <nilsson@opera.com>

Removed compat flags from sprintf and sscanf.

2014-10-05 19:02:12 by Martin Nilsson <nilsson@opera.com>

Fixed warning.

2014-10-05 11:59:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: output_to() et al now support functions.

This reduces the need for proxy objects in higher level code
using Stdio.Buffer internally.

Also adds support for subtyped objects and multiple inheritance
of Stdio.Fd et al.

2014-10-05 11:24:16 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: output_to() et al now support functions.

This reduces the need for proxy objects in higher level code
using Stdio.Buffer internally.

Also adds support for subtyped objects and multiple inheritance
of Stdio.Fd et al.

2014-10-02

2014-10-02 21:31:40 by Martin Nilsson <nilsson@opera.com>

Re-add early exit if not a full write was accepted. This is most often an optimazation.

2014-10-02 20:05:00 by Martin Nilsson <nilsson@opera.com>

While any data can be sent, continue sending.

2014-10-02 19:57:52 by Martin Nilsson <nilsson@opera.com>

Fixed output_to nbytes feature for non-file objects.

2014-10-02 19:48:52 by Martin Nilsson <nilsson@opera.com>

io_rewind is already applied in io_call_write. Don't do it again in output_to.

2014-10-02 18:17:53 by Per Hedbor <ph@opera.com>

Stdio.Buffer now works on 32bit systems

2014-10-02 14:20:33 by Per Hedbor <ph@opera.com>

Whitespace changes only

2014-10-01

2014-10-01 14:38:48 by Martin Nilsson <nilsson@opera.com>

Stdio.IOBuffer -> Stdio.Buffer (part 2)

2014-10-01 14:34:26 by Martin Nilsson <nilsson@opera.com>

Stdio.IOBuffer -> Stdio.Buffer (part 1)

2014-10-01 06:57:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Propagate read errors in input_from().

input_from() now returns -1 on read error.

Also minor optimization to avoid extra read(2) call when
reading a multiple of 4096 bytes.

2014-09-30

2014-09-30 19:14:45 by Per Hedbor <ph@opera.com>

Stricter types in buffer.cmod

2014-09-25

2014-09-25 15:48:08 by Per Hedbor <ph@opera.com>

Added rewind_key, much like rewind_on_error, but not automatic.

Also speed up read_cstring about a factor of two.

2014-09-25 15:26:16 by Per Hedbor <ph@opera.com>

Added read_hint and add_hint

They read and add integers encoded like hstrings, first a length then the number.

2014-09-25 14:06:40 by Tobias S. Josefowitz <tobij@tobij.de>

Stdio.IOBuffer.UnwindKey: allow explicit ->rewind()

2014-09-25 12:20:42 by Per Hedbor <ph@opera.com>

Added Stdio.IOBuffer::rewind_on_error.

Use this function to cause the buffer to be rewound to the location
it was at when the function was called if the object it returs
goes out of scope.

2014-09-25 07:23:55 by Arne Goedeke <el@laramies.com>

Stdio.IOBuffer: bad return type of add_int32()

2014-09-23

2014-09-23 17:39:32 by Martin Nilsson <nilsson@opera.com>

Removed debug.

2014-09-18

2014-09-18 17:01:45 by Per Hedbor <ph@opera.com>

Added read_sint for read signed integer.

The reverse might be more obvious (read_int for signed, read_uint for
unsigned), but at least it exists now.

Also fixed so that add_int works for all negative numbers, and
optimized it rather significantly for bignums (it no longer creates a
string copy of the bignum value).

Also added a simple add_padding() function to add a few bytes of data
set to a specific value (basically memset)

2014-09-18 15:39:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Use add_ref().

2014-09-15

2014-09-15 16:30:36 by Per Hedbor <ph@opera.com>

Fixed signed/unsigned warning

2014-09-15 16:30:06 by Per Hedbor <ph@opera.com>

Allow adding chunks bigger than 2^32 at a time using add() and friends.

Also, instead of saying you are trying to read too much when reading -<whatever> bytes
using read or try_read you will now get an error indicating you are reading a negative number of bytes, which is hard.

I guess it might unread(), but that would be highly unexpected.

2014-09-15 13:46:56 by Per Hedbor <ph@opera.com>

No, actually, it is not reached.

This saves a few bytes of binary size. :)

2014-09-15 13:44:56 by Per Hedbor <ph@opera.com>

Do not trigger the write callback again when nothing is written

This saves the user from checking sizeof(buffer) before doing buffer->output_to(...)

2014-09-15 10:43:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Added try_read().

This is an analogue to Stdio.File()->read().

2014-09-14

2014-09-14 13:40:56 by Stephen R. van den Berg <srb@cuci.nl>

Simplify code, speed up fast path.

2014-09-14 11:55:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Fixed fatal "Invalid io_rewind_on_error nesting".

The value in io->locked_move was off by one.

2014-09-14 09:25:51 by Per Hedbor <ph@opera.com>

Revert "IOBuffer: Optimise and fix range checks."

This reverts commit 91460a41b2b68b9d745827a07b6762adc99e3ed9.

This introduced several errors, including some that causes buffer overruns.
It also made the code biger on average (just check using size).

Please do not change the math unless you are very certain it will
work.

Also, please trust the compiler, both to unroll loops even if it does
not make sense and to optimize obvious comparisons, yes?

Obvious example: check_avail_mul suddenly is pointless.

The whole idea with that function is to _safely_ check if A*B is bigger than the buffer.

Consider A*B >being > NATIVE_INT_MAX.

2014-09-14 09:16:55 by Stephen R. van den Berg <srb@cuci.nl>

IOBuffer.cstring to parse \0 terminated C-strings.

2014-09-14 09:16:55 by Stephen R. van den Berg <srb@cuci.nl>

IOBuffer: Optimise and fix range checks.

Eliminates some of the recursions.

2014-09-14 08:41:35 by Per Hedbor <ph@opera.com>

Also removed add_short

2014-09-14 00:48:26 by Martin Nilsson <nilsson@opera.com>

Removed add_byte. We have add_int8.

2014-09-12

2014-09-12 23:52:21 by Martin Nilsson <nilsson@opera.com>

Unused local variable.

2014-09-12 13:09:59 by Marcus Cromnow <marcusc@opera.com>

Workaround for precompiler issue in IOBuffer.

The precompiler generates invalid code and fails to compile
when PRECOMPILE_API_VERSION < 5. Generated code ends up inside
the #ifdef-clause.

2014-09-12 11:48:38 by Per Hedbor <ph@opera.com>

Improved performance in output_to noticeably

Also, do not crash if other threads use the buffer while output_to has
been called.

It was very very intentionally not threaded. If we _need_ thread
support (say, we want to support writing to blocking files in the
background) the buffer class has to be rewritten quite a lot.

Most importantly it can not allow anyone to touch it while the other
thread is using the memory, which in turn means that it has to be
refcounted, and operations on it while refs > 1 will have to be a big
no-no, or copy all data.

It is rather hard to use the buffer if it behaves like that, mainly
when it is used as an output buffer for a file (it is assumed that the
add functions are called to add output then, and if the writing is
done in a thread it will be likely to cause issues)

Hence the total lack of THREADS_ALLOW in the buffer object. The
alternative is to locking to all buffer functions.

Or, I guess, we could just leave it as is and hope nobody does
antything "mean".

Alternatively, use the kernel async_write code on linux, that would
make output_to nonblocking even for blocking files on that platform,
and hopefully the memory will be copied when the system call returns,
and it is thus safe to change it.

The main issue with output_to + write + threads is that the threads
are enabled before the system call has copied the data, and you will
thus get a spurious error if the buffer is reallocated in another
thread.

2014-09-12 11:42:43 by Per Hedbor <ph@opera.com>

When we know the types we can optimize pop and friends. Use that.

2014-09-12 11:40:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Improved support for threading in output_to().

2014-09-11

2014-09-11 16:26:15 by Per Hedbor <ph@opera.com>

As it turns out io_trigger_output is inlined in every location using io_append.

Fixed that.

2014-09-11 16:18:39 by Per Hedbor <ph@opera.com>

Saved 200 bytes binary size and made the code faster.

One lesson learned: pop_n_elems is rather big.

2014-09-11 15:59:07 by Per Hedbor <ph@opera.com>

Use the get-memobj-pointer function and some other cleanups.

The compiled code is now 20% smaller.

2014-09-11 08:49:30 by Arne Goedeke <el@laramies.com>

Stdio.IOBuffer: wrong return type of read_int32

2014-09-11 08:30:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Support file objects with overloaded write().

FIXME: Support subtyped file objects?

2014-09-11 07:49:27 by Stephen R. van den Berg <srb@cuci.nl>

Fix typos.

2014-09-11 07:49:27 by Stephen R. van den Berg <srb@cuci.nl>

The compiler will do this implicitly.

2014-09-10

2014-09-10 22:22:22 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Use ptrdiff_t instead of ssize_t.

ptrdiff_t is C89, while ssize_t is POSIX. As we support some
non-POSIX architectures, use the more portable type.

2014-09-10 20:03:17 by Per Hedbor <ph@opera.com>

Added a few read_int<size>() functions for common int sizes.

2014-09-10 16:27:02 by Per Hedbor <ph@opera.com>

Moved some common code to functions.

Also use the new "map variable from structures" support to remove
two getters.

2014-09-10 08:14:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Fixed string leak.

Also fixes some potential related leaks.

2014-09-09

2014-09-09 08:15:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Propagate errno to the file object on error.

2014-09-09 07:58:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Return -1 from output_to() on write error.

2014-09-08

2014-09-08 16:24:17 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Fixed some AutoDoc markup issues.

2014-09-08 16:20:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Survive cyclic arrays.

2014-09-08 16:19:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Fixed warning.

2014-09-08 16:17:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Fixed compilation error --with-rtldebug.

2014-09-08 15:11:53 by Per Hedbor <ph@opera.com>

Fixed autodoc error

2014-09-08 14:46:40 by Per Hedbor <ph@opera.com>

IOBuffer: Added some more tests and fixed errors found

At least almost all functions in IOBuffer have some basic tests now..

2014-09-08 14:25:38 by Per Hedbor <ph@opera.com>

Fixed IOBuffer.add_int

2014-09-08 14:13:11 by Per Hedbor <ph@opera.com>

IOBuffer: Cleanup of some code.

2014-09-08 12:30:17 by Per Hedbor <ph@opera.com>

Some IOBuffer work

o Made all (I think) functions atomic. Either they work or they do
nothing (except throw an error or return 0).

o One minor optimization to avoid copies when strings/system.memory
object etc are added to an empty buffer. Unless you add more data
the buffer is just moved to point to the object that was just added.
The malloced buffer is still kept around, however.

o Added a very very basic testsuite for IOBuffer. More to come.

2014-09-07

2014-09-07 13:58:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Some documentation fixes.

2014-09-05

2014-09-05 15:13:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Improved error recovery for read_h{string,buffer}().

Don't advance the buffer pointers if there's not enough data.

NB: Not a 100% robust. It will fail if io_avail() throws errors,
or if the holerith length is negative or too large.

2014-09-04

2014-09-04 15:57:43 by Arne Goedeke <el@laramies.com>

Merge remote-tracking branch 'origin/8.0' into string_alloc

Conflicts:
src/stralloc.c

2014-09-04 15:41:34 by Per Hedbor <ph@opera.com>

Allow "read only once" more for input_from in IOBuffer.

2014-09-03

2014-09-03 22:13:57 by Martin Nilsson <nilsson@opera.com>

port.h is included by global.h

2014-09-03 18:30:32 by Per Hedbor <ph@opera.com>

Added buffered asynchronous I/O mode to Stdio.File

In this mode the input and output is kept in buffers in the file object.
Adding data to the output buffer will write it to the filedescriptor, and
the read callback will receive the input buffer as its argument.

The write callback will have the output buffer as a second argument,
but most of the time this can be ignored since you keep the buffer
object around.

The write callback will only be called if the buffer needs more data,
so if you implement a range_error function in the buffer that refills
the buffer it will only be called once that callback returns 0.

2014-09-03 15:45:13 by Per Hedbor <ph@opera.com>

Correctly update the box events when reading/writing from files

2014-09-03 15:09:09 by Per Hedbor <ph@opera.com>

Stdio.IOBuffer.intput/output from fd can now take the amount to process

This is better for SSL files, where you can write any amount of data.

2014-09-02

2014-09-02 14:33:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

IOBuffer: Use apply_current() to call range_error().

This gets rid of a dynamic lookup and a reference on the
string "range_error".

It also improves the odds that IOBuffer will support being
inherited multiple times, as well as private inherit.

2014-09-02 14:02:08 by Per Hedbor <ph@opera.com>

Added add_ints() method to IOBuffer.

2014-09-02 13:05:49 by Per Hedbor <ph@opera.com>

Some tweaks to Stdio.IOBuffer:

o The various functions that add data now return the buffer
o It is now possible to overload the range_error method.
This can be used to fill the buffer on demand.

2014-09-01

2014-09-01 17:02:43 by Per Hedbor <ph@opera.com>

Added _encode and _decode to Stdio.IOBuffer

2014-09-01 16:52:12 by Per Hedbor <ph@opera.com>

Some changes to Stdio.IOBuffer:

o Set error mode now accepts a program to throw on error
o Relaxed argument types (for now)

2014-09-01 15:48:34 by Per Hedbor <ph@opera.com>

Correctly throw buffer error in error mode

2014-09-01 15:19:37 by Per Hedbor <ph@opera.com>

Added some more functionality to Stdio.IOBuffer

o input_from(file), output_to(file) -- async or sync file-IO.
o add and crete now supports the other buffer objects

2014-09-01 10:23:43 by Per Hedbor <ph@opera.com>

Added Stdio.IOBuffer.write_to(Stdio.Stream).

2014-08-28

2014-08-28 15:01:10 by Per Hedbor <ph@opera.com>

Added read_json method.

It will read the first json value on the stream and return it.

2014-08-28 12:08:51 by Per Hedbor <ph@opera.com>

The IOBuffer documentation now extracts

2014-08-28 12:03:12 by Per Hedbor <ph@opera.com>

Moved __builtin.IOBuffer to Stdio.IOBuffer (for now)