<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum BestPig ToolBox - ASM / C / C++ et autres.]]></title>
		<link>http://www.bestpig.fr/forum/index.php</link>
		<description><![CDATA[Les discussions les plus récentes dans Forum BestPig ToolBox.]]></description>
		<lastBuildDate>Fri, 29 Mar 2013 12:55:48 +0000</lastBuildDate>
		<generator>FireBB</generator>
		<item>
			<title><![CDATA[petite info]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=199#p199</link>
			<description><![CDATA[Bonjour a tous<br />
<br />
j'aurai une petite question sur le smc <br />
je me suis modifier les sources fsd2.1 pour me faire un petit truc perso ,<br />
mais je rencontre une difficute avec le smc, je ne comprend pas pourquoi il ne fonctionne pas avec les slims ou les jasper <br />
je ne peut regler la vitesse des ventilos ,l'a<br />
<br />
j ai chercher un peu sur le net de doc ou autre la dessus mais rien ou aucune reponse sur d'autre forum mise a part de passer a fsd3<br />
<br />
mon but etant d'apprendre un peu comment sa marche j'ai pas envie de passer a fsd3 <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/big_smile.png" width="15" height="15" alt="big_smile" /><br />
<br />
je suis en cours d'apprentissage du language C++ <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/tongue.png" width="15" height="15" alt="tongue" /><br />
<br />
en vous remerciant]]></description>
			<author><![CDATA[dummy@example.com (ytreza)]]></author>
			<pubDate>Fri, 29 Mar 2013 12:55:48 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=199#p199</guid>
		</item>
		<item>
			<title><![CDATA[[c++] Extraire Fcrt]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=191#p191</link>
			<description><![CDATA[Bonjour<br />
<br />
Je sais que je pars de tr&egrave;s loin mais bon, en plus d'apprendre &agrave; programmer j'apprends comment marche les xbox360.<br />
<br />
Je voudrais extraire le fcrt des nand Corona, ceux qui suivent le xkey comprendront pourquoi ^^<br />
<br />
J'ai remarquer en &eacute;tudiant un peut le code source de fcrt-eXtractor-V0.3-by-BestPig<br />
<br />
Un fcrt extrait avec ce log est crypt&eacute;? Un fcrt extrait avec flash Tool comme proscrit par la team Xkey est diff&eacute;rent de celui de bestpig (dans flashTool on rentre la cl&eacute; Cpu pour extraire)<br />
<br />
Je code en c++ avec Qt pour avoir mon interface graphique. J'ai r&eacute;ussi en &eacute;tudiant les sources de 360 Flash Tool a impl&eacute;menter les m&eacute;thode sha1 tous ca. donc avec un keyvault + une cl&eacute; j'arrive a d&eacute;crypter un keyvault.<br />
<br />
Ma question est : j'ai pas compris comment &agrave; partir du pattern &quot;fcrt.bin&quot;, on trouve l'offset de d&eacute;part du fcrt ^^<br />
<br />
Et surtout, est ce que je dois d&eacute;crypter ma nand avant? A ce que j'ai compris je peux pas exploiter le code source de fcrt-eXtractor-V0.3-by-BestPig sauf si je prend une Nand d&eacute;j&agrave; d&eacute;crypter?<br />
<br />
Et es ce que la nand est crypt&eacute; comme un key vault? Je veux dire l'en t&ecirc;te d'une nand est lisible, il me semble avoir lu que la nand est crypt&eacute; &agrave; partir d'un certain offset? C'est ca ? Mais une fois que ca commence a &ecirc;tre crypt&eacute; c'est fait partout pareil?<br />
<br />
Merci]]></description>
			<author><![CDATA[dummy@example.com (deaphroat)]]></author>
			<pubDate>Sun, 12 Aug 2012 11:30:49 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=191#p191</guid>
		</item>
		<item>
			<title><![CDATA[What WinForm Control?]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=41#p41</link>
			<description><![CDATA[Hi there, great app well done. I was just wondering what winform does bestpig use for it's controls and forum? At first i though it was RadControls for winform but it can't be it just look very unique.]]></description>
			<author><![CDATA[dummy@example.com (jnewing)]]></author>
			<pubDate>Sun, 30 May 2010 19:13:49 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=41#p41</guid>
		</item>
		<item>
			<title><![CDATA[Implementation de la fonction strlen]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=25#p25</link>
			<description><![CDATA[Bonsoir a tous,<br />
<br />
Suite a des conversations sur le SdZ et le fclc, on a vu que l'implementation du K&amp;R et de Plauger de la fonction strlen soulevait un probleme de protabilite entre les differentes architectures, voici le code en question :<br />
<br />
<div class="codebox"><cite>Code C : <a onclick="code_select('s9782299478')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s9782299478"><code><br /><span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
&nbsp;
size_t mystrlen<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>s<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>p;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>p <span style="color: #339933;">=</span> s; <span style="color: #339933;">*</span>p; <span style="color: #339933;">++</span>p<span style="color: #009900;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> p <span style="color: #339933;">-</span> s;
<span style="color: #009900;">&#125;</span>
&nbsp;</code></pre></div>
<br />
et voici l'implementation de la GlibC qui utilise globalement le meme principe mais en paliant a ce souci de portabilite :<br />
<br />
<div class="codebox"><cite>Code C : <a onclick="code_select('s9872359533')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s9872359533"><code><br /><span style="color: #808080; font-style: italic;">/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc.
&nbsp; &nbsp;This file is part of the GNU C Library.
&nbsp; &nbsp;Written by Torbjorn Granlund (tege@sics.se),
&nbsp; &nbsp;with help from Dan Sahlin (dan@sics.se);
&nbsp; &nbsp;commentary by Jim Blandy (jimb@ai.mit.edu).
&nbsp;
&nbsp; &nbsp;The GNU C Library is free software; you can redistribute it and/or
&nbsp; &nbsp;modify it under the terms of the GNU Lesser General Public
&nbsp; &nbsp;License as published by the Free Software Foundation; either
&nbsp; &nbsp;version 2.1 of the License, or (at your option) any later version.
&nbsp;
&nbsp; &nbsp;The GNU C Library is distributed in the hope that it will be useful,
&nbsp; &nbsp;but WITHOUT ANY WARRANTY; without even the implied warranty of
&nbsp; &nbsp;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &nbsp;See the GNU
&nbsp; &nbsp;Lesser General Public License for more details.
&nbsp;
&nbsp; &nbsp;You should have received a copy of the GNU Lesser General Public
&nbsp; &nbsp;License along with the GNU C Library; if not, write to the Free
&nbsp; &nbsp;Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
&nbsp; &nbsp;02111-1307 USA. &nbsp;*/</span>
&nbsp;
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
&nbsp;
<span style="color: #339933;">#undef strlen</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Return the length of the null-terminated string STR. &nbsp;Scan for
&nbsp; &nbsp;the null terminator quickly by testing four bytes at a time. &nbsp;*/</span>
size_t
strlen <span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp;<span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>str;
<span style="color: #009900;">&#123;</span>
&nbsp; <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>char_ptr;
&nbsp; <span style="color: #993333;">const</span> <span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span> <span style="color: #339933;">*</span>longword_ptr;
&nbsp; <span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span> longword, magic_bits, himagic, lomagic;
&nbsp;
&nbsp; <span style="color: #808080; font-style: italic;">/* Handle the first few characters by reading one character at a time.
&nbsp; &nbsp; &nbsp;Do this until CHAR_PTR is aligned on a longword boundary. &nbsp;*/</span>
&nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>char_ptr <span style="color: #339933;">=</span> str; <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span> char_ptr
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>longword<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span>;
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">++</span>char_ptr<span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>char_ptr <span style="color: #339933;">==</span> <span style="color: #ff0000;">'x98AnTiSlAsHx980'</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> char_ptr <span style="color: #339933;">-</span> str;
&nbsp;
&nbsp; <span style="color: #808080; font-style: italic;">/* All these elucidatory comments refer to 4-byte longwords,
&nbsp; &nbsp; &nbsp;but the theory applies equally well to 8-byte longwords. &nbsp;*/</span>
&nbsp;
&nbsp; longword_ptr <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> char_ptr;
&nbsp;
&nbsp; <span style="color: #808080; font-style: italic;">/* Bits 31, 24, 16, and 8 of this number are zero. &nbsp;Call these bits
&nbsp; &nbsp; &nbsp;the &quot;holes.&quot; &nbsp;Note that there is a hole just to the left of
&nbsp; &nbsp; &nbsp;each byte, with an extra at the end:
&nbsp;
&nbsp; &nbsp; &nbsp;bits: &nbsp;01111110 11111110 11111110 11111111
&nbsp; &nbsp; &nbsp;bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
&nbsp;
&nbsp; &nbsp; &nbsp;The 1-bits make sure that carries propagate to the next 0-bit.
&nbsp; &nbsp; &nbsp;The 0-bits provide holes for carries to fall into. &nbsp;*/</span>
&nbsp; magic_bits <span style="color: #339933;">=</span> 0x7efefeffL;
&nbsp; himagic <span style="color: #339933;">=</span> 0x80808080L;
&nbsp; lomagic <span style="color: #339933;">=</span> 0x01010101L;
&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>longword<span style="color: #009900;">&#41;</span> &gt; <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* 64-bit version of the magic. &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Do the shift in two steps to avoid a warning if long has 32 bits. &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; magic_bits <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>0x7efefefeL &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> | 0xfefefeffL;
&nbsp; &nbsp; &nbsp; himagic <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>himagic &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> | himagic;
&nbsp; &nbsp; &nbsp; lomagic <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>lomagic &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> &lt;&lt; <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> | lomagic;
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span>
&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>longword<span style="color: #009900;">&#41;</span> &gt; <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; abort <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
&nbsp; <span style="color: #808080; font-style: italic;">/* Instead of the traditional loop which tests each character,
&nbsp; &nbsp; &nbsp;we will test a longword at a time. &nbsp;The tricky part is testing
&nbsp; &nbsp; &nbsp;if *any of the four* bytes in the longword in question are zero. &nbsp;*/</span>
&nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>;;<span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* We tentatively exit the loop if adding MAGIC_BITS to
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LONGWORD fails to change any of the hole bits of LONGWORD.
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1) Is this safe? &nbsp;Will it catch all the zero bytes?
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Suppose there is a byte with all zeros. &nbsp;Any carry bits
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;propagating from its left will fall into the hole at its
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;least significant bit and stop. &nbsp;Since there will be no
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;carry from its most significant bit, the LSB of the
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;byte to the left will be unchanged, and the zero will be
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;detected.
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2) Is this worthwhile? &nbsp;Will it ignore everything except
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zero bytes? &nbsp;Suppose every byte of LONGWORD has a bit set
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;somewhere. &nbsp;There will be a carry into bit 8. &nbsp;If bit 8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is set, this will carry into bit 16. &nbsp;If bit 8 is clear,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;one of bits 9-15 must be set, so there will be a carry
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;into bit 16. &nbsp;Similarly, there will be a carry into bit
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;24. &nbsp;If one of bits 24-30 is set, there will be a carry
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;into bit 31, so all of the hole bits will be changed.
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The one misfire occurs when bits 24-30 are clear and bit
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;31 is set; in this case, the hole at bit 31 is not
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;changed. &nbsp;If we had access to the processor carry flag,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;we could close this loophole by putting the fourth hole
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;at bit 32!
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;So it ignores everything except 128's, when they're aligned
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;properly. &nbsp;*/</span>
&nbsp;
&nbsp; &nbsp; &nbsp; longword <span style="color: #339933;">=</span> <span style="color: #339933;">*</span>longword_ptr<span style="color: #339933;">++</span>;
&nbsp;
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>
<span style="color: #339933;">#if 0</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Add MAGIC_BITS to LONGWORD. &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>longword <span style="color: #339933;">+</span> magic_bits<span style="color: #009900;">&#41;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Set those bits that were unchanged by the addition. &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">^</span> ~longword<span style="color: #009900;">&#41;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">/* Look at only the hole bits. &nbsp;If any of the hole bits
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; are unchanged, most likely one of the bytes was a
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zero. &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">&amp;</span> ~magic_bits<span style="color: #009900;">&#41;</span>
<span style="color: #339933;">#else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>longword <span style="color: #339933;">-</span> lomagic<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> himagic<span style="color: #009900;">&#41;</span>
<span style="color: #339933;">#endif</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Which of the bytes was the zero? &nbsp;If none of them were, it was
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a misfire; continue the search. &nbsp;*/</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>cp <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>longword_ptr <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>longword<span style="color: #009900;">&#41;</span> &gt; <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">4</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">6</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>cp<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> cp <span style="color: #339933;">-</span> str <span style="color: #339933;">+</span> <span style="color: #cc66cc;">7</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span>
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
libc_hidden_builtin_def <span style="color: #009900;">&#40;</span>strlen<span style="color: #009900;">&#41;</span>
&nbsp;</code></pre></div>
<br />
Ma question est donc la suivante : Comment est il possible que Plauger et le K&amp;R aient diffuse ce code tout en sachant qu'il ne fonctionnerait pas correctement partout? Tandis que la GNU libC elle a repondu a ce probleme?<br />
<br />
Ici plauger explique son choix <a href="http://bytes.com/topic/c/answers/458286-plauger-size_t-ptrdiff_t#post1756007" >http://bytes.com/topic/c/answers/458286-plauger-size_t-ptrdiff_t#post1756007</a><br />
<br />
Une implementation exempte des overflows dont il parle aurait ete d'incrementer un compteur jusqu'a ce qu'un caractere NULL BYTE soit rencontre. Il y a toujours risque d'overflow mais la, on y peut plus rien... depasser la capacite d'un size_t ou d'un unsigned long (ou unsigned long long pour le C99) il faut le faire<br />
<br />
Le probleme est explique plus en detail ici : <a href="http://groups.google.fr/group/comp.lang.c/msg/f06bf3ea5893778b?hl=fr" >http://groups.google.fr/group/comp.lang.c/msg/f06bf3ea5893778b?hl=fr</a>]]></description>
			<author><![CDATA[dummy@example.com (Adroneus)]]></author>
			<pubDate>Wed, 21 Apr 2010 20:18:59 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=25#p25</guid>
		</item>
	</channel>
</rss>
