git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: "Torsten Bögershausen" <tboegi@web.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Derrick Stolee" <stolee@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC v1 1/1] Use size_t instead of unsigned long
Date: Mon, 19 Nov 2018 19:15:42 +0100	[thread overview]
Message-ID: <0e38e87d-0b8a-054d-1ae0-37a225845e3b@web.de> (raw)
In-Reply-To: <f0c0e2e8-717d-9973-5533-8b806474e119@web.de>

Am 19.11.2018 um 06:33 schrieb Torsten Bögershausen:
> The archive-tar.c is actually a good example, why a step-by-step update
> is not ideal (the code would not work any more on Win64).
> 
> If we look here:
> 
> static int stream_blocked(const struct object_id *oid)
> {
> 	struct git_istream *st;
> 	enum object_type type;
> 	size_t sz;
> 	char buf[BLOCKSIZE];
> 	ssize_t readlen;
> 
> 	st = open_istream(oid, &type, &sz, NULL);
>                                       ^^^^^
> 	if (!st)
> 		return error(_("cannot stream blob %s"), oid_to_hex(oid));
> 	for (;;) {
> 
> The sz variable must follow whatever open_istream() uses, so if we start
> with archive-tar.c, we must use either size_t or ulong, whatever
> open_istream() needs. Otherwise things will break:
> archive-tar.c uses ulong, open_istream() size_t, but we are passing pointers
> around, and here &ulong != &size_t
> 
> If we only update open_istream(), but not archive-tar.c, then
> things are not better:
> &size_t != &ulong.
> 
> I don't have a good idea how to split the patch.

sz is not actually used later in that function; this change can
be done independently of any other ulong/size_t conversion in that
file.

Hmm, looking at that call I wonder why open_istream() doesn't return
type and size in the struct git_istream.  To make it match
read_object_file(), I suppose.  Perhaps it's an opportunity to
improve its interface?

René

  reply	other threads:[~2018-11-19 18:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17 15:11 [PATCH/RFC v1 1/1] Use size_t instead of unsigned long tboegi
2018-11-18 20:18 ` Derrick Stolee
2018-11-18 23:40   ` Junio C Hamano
2018-11-19  5:33     ` Torsten Bögershausen
2018-11-19 18:15       ` René Scharfe [this message]
2018-11-19 16:33   ` Torsten Bögershausen
2018-11-20  1:36     ` Junio C Hamano
2018-11-20  5:04 ` [PATCH v2 1/1] Use size_t instead of 'unsigned long' for data in memory tboegi
2018-11-21 11:55   ` Derrick Stolee
2019-01-16 21:46   ` Thomas Braun
2019-01-19 17:06     ` Torsten Bögershausen
2019-01-22 14:25       ` Thomas Braun
2019-04-13 15:18 ` [PATCH v3 " tboegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e38e87d-0b8a-054d-1ae0-37a225845e3b@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=stolee@gmail.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).