Re: What's cooking in git.git (Jun 2010, #02; Wed, 16)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Clément Poulain <clement.poulain@xxxxxxxxxxxxxxx> writes:
>
>> A fix was proposed here:
>> http://mid.gmane.org/1276610328-28532-1-git-send-email-axel.bonnet@xxxxxxxxxxxxxxx
>
> This one changes textconv_object() to take a pointer to ulong*; a caller
> is changed to cast a long* down to that pointer (in
> fill_origin_blob);

Isn't sign-casting safe? If not, then the existing call to
read_sha1_file should be fixed too:

-file->ptr = read_sha1_file(o->blob_sha1, &type,
-   (unsigned long *)(&(file->size)));
[...]
+file->ptr = read_sha1_file(o->blob_sha1, &type,
+   (unsigned long *)(&(file->size)));

(it's been there for a while)

>     The only portable way in C to convert between types is by assignment. So
>     you have to do:
>
>       unsigned long foo;
>       textconv_object(read_from, null_sha1, &buf.buf, &foo);
>       buf.len = foo;

This is what the patch does a little later:

+unsigned long buf_len;
[...]
+if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
+    textconv_object(read_from, null_sha1, &buf.buf, &buf_len))
+buf.len = buf_len;

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]