<?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=201#p201</link>
			<description><![CDATA[Merci pour ta reponse <br />
<br />
Oui sa fonctionne avec fsd3  <br />
<br />
J avais jetter un oeil sur la doc M$ mais je n'est rien trouver non plus la dessus donc pour le moment sa reste un mystere pour moi <br />
<br />
J ai deja tenter une demande d info mais toujours rester sans reponse<br />
<br />
<br />
@+]]></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=201#p201</guid>
		</item>
		<item>
			<title><![CDATA[petite info]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=200#p200</link>
			<description><![CDATA[Bonjour,<br />
<br />
Je ne vais pas pouvoir beaucoup t'aider, je n'ai aucune id&eacute;e de comment es-ce que cela fonctionne, mais il est bizzare que cela ne fonctionne pas sur slims / jasper.<br />
Es-tu sur que cela fonctionne sur fsd3 ?<br />
<br />
J'ai regard&eacute; un peu FSD ont y trouve cette fonction SetFanSpeed.<br />
<br />
<div class="codebox"><cite>Code CPP : <a onclick="code_select('s9765421490')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s9765421490"><code><br /><span style="color: #0000ff;">void</span> smc<span style="color: #008080;">::</span><span style="color: #00eeff;">SetFanSpeed</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> fan, <span style="color: #0000ff;">int</span> speed<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; PrepareBuffers<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; m_SMCMessage<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> fan ? 0x94 <span style="color: #008080;">:</span> 0x89;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// Fail safe to keep a speed set above 100 in the xml from</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// &nbsp;stopping the fans.</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>speed <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">100</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; speed <span style="color: #000080;">=</span> <span style="color: #0000dd;">100</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>speed <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">45</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_SMCMessage<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> 0x7F;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_SMCMessage<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">char</span><span style="color: #008000;">&#41;</span>speed <span style="color: #000040;">|</span> 0x80;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; HalSendSMCMessage<span style="color: #008000;">&#40;</span>m_SMCMessage, <span style="color: #0000ff;">NULL</span><span style="color: #008000;">&#41;</span>;
<span style="color: #008000;">&#125;</span>
&nbsp;</code></pre></div>
<br />
La fonction HalSendSMCMessage n'est pas dans le code source de fsd, c'est une librairie externe.<br />
<br />
<div class="codebox"><cite>Code CPP : <a onclick="code_select('s8989837687')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s8989837687"><code><br /><span style="color: #666666;">//Call to SMC message function in xboxkrnl.lib</span>
<span style="color: #0000ff;">extern</span> <span style="color: #FF0000;">&quot;C&quot;</span> <span style="color: #0000ff;">void</span> __stdcall HalSendSMCMessage<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> input, <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> output<span style="color: #008000;">&#41;</span>;</code></pre></div>
<br />
Le probl&egrave;me c'est que c'est une fontion non documenter, donc il est difficile de savoir comment elle fonctionne.<br />
Si c'est fonctionnel sur fsd3, tu peux toujours allez demander aux dev officiel, je pense qu'il sont dispo sur IRC, il seront probablement mieux te r&eacute;pondre que moi.]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Fri, 29 Mar 2013 12:28:18 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=200#p200</guid>
		</item>
		<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>Thu, 28 Mar 2013 17:18:53 +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=196#p196</link>
			<description><![CDATA[Moi c'etait avec plaisir, si je peux aider <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/wink.png" width="15" height="15" alt="wink" />]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Sun, 12 Aug 2012 11:30:49 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=196#p196</guid>
		</item>
		<item>
			<title><![CDATA[[c++] Extraire Fcrt]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=195#p195</link>
			<description><![CDATA[Donc j'ai vu ton post sur Xboxhacker et depuis ben j'avais compris mon erreur, et j'ai finis mon prog pour extraire le FCRT.<br />
<br />
Mais je te remercie pour ton explication pour le fcrt, et oui j'avais vu apr&egrave;s le nom fcrt_ENC.bin j'ai &eacute;t&eacute; con sur ce coup ...<br />
<br />
Enfin bref d'ici quelques jours je pourrais mettre &agrave; jour mon prog sur Gueux ^^]]></description>
			<author><![CDATA[dummy@example.com (deaphroat)]]></author>
			<pubDate>Sun, 12 Aug 2012 06:13:18 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=195#p195</guid>
		</item>
		<item>
			<title><![CDATA[[c++] Extraire Fcrt]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=194#p194</link>
			<description><![CDATA[Je relis mon code, et je vois que j'ai oublie de te dire un petit detail <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/wink.png" width="15" height="15" alt="wink" />.<br />
<br />
<div class="codebox"><cite>Code C : <a onclick="code_select('s5088199236')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s5088199236"><code><br />&nbsp;
offset <span style="color: #339933;">=</span> nand<span style="color: #339933;">-</span>&gt;fcrt_offset <span style="color: #339933;">*</span> <span style="color: #cc66cc;">16896</span>;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>writed &lt; nand<span style="color: #339933;">-</span>&gt;fcrt_len<span style="color: #009900;">&#41;</span>
&nbsp; <span style="color: #009900;">&#123;</span>
&nbsp; &nbsp; fwrite<span style="color: #009900;">&#40;</span>nand<span style="color: #339933;">-</span>&gt;file <span style="color: #339933;">+</span> offset, <span style="color: #cc66cc;">1</span>, 0x200, stream<span style="color: #009900;">&#41;</span>;
&nbsp; &nbsp; writed <span style="color: #339933;">+=</span> 0x200;
&nbsp; &nbsp; offset <span style="color: #339933;">+=</span> 0x210;
&nbsp; <span style="color: #009900;">&#125;</span>
&nbsp;</code></pre></div>
<br />
Je lis bloc par bloc, donc de 200 en 200, mais a la fin de chaque bloc, j'ignore 16 octets (0x10).<br />
Car a chaque fois il y a 16 octets qui sont des infos hors fcrt, c'est pour savoir si il y a des badblocs et ce genre de chose.<br />
Donc normal que tu differes a l'offset 0x200, tu doit sauter 16 octets a chaque fois <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/wink.png" width="15" height="15" alt="wink" />.<br />
<br />
Desole pour ce petit oublie.<br />
<br />
EDIT : Je viens de tenter d'extraire plusieurs fcrt.bin avec 360 Flash Tool et mon logiciel, a chaque fois les fcrt sont identiques.<br />
360 Flash Tool le les dechiffres donc pas, d'ailleur cela parais logique puisque il les nomment fcrt_enc.bin]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Fri, 10 Aug 2012 10:22:40 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=194#p194</guid>
		</item>
		<item>
			<title><![CDATA[[c++] Extraire Fcrt]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=193#p193</link>
			<description><![CDATA[Je te remercie c'est bon &ccedil;a marche ^^<br />
<br />
Je sais comment trouv&eacute; le FCRT, me reste plus voir comment le d&eacute;crypt&eacute;...<br />
<br />
Par contre.  Je prend ton programme fcrt_extractor.exe<br />
<br />
Je glisse ma nand dessus, &ccedil;a me fait un fcrt.bin.<br />
<br />
J'ouvre ma nand en hexa, je me place &agrave; l'offset de d&eacute;part de mon fcrt, je copie colle dans un nouveau fichier mon fcrt, et j'obtiens pas le m&ecirc;me que le tiens, c'est normal? Ou c&rsquo;&eacute;tait juste une erreur? Il me manque la ligne de l'offset 200.<br />
<br />
Sinon ben je te remercie ^^]]></description>
			<author><![CDATA[dummy@example.com (deaphroat)]]></author>
			<pubDate>Wed, 08 Aug 2012 00:12:48 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=193#p193</guid>
		</item>
		<item>
			<title><![CDATA[[c++] Extraire Fcrt]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=192#p192</link>
			<description><![CDATA[Bonjour,<br />
<br />
Le r&eacute;sultat du fcrt.bin est different car celui qu'extrait mon logiciel est chiffr&eacute;.<br />
Alors que 360 flash tool le dechiffre.<br />
<br />
Le .meta est necessaire si on veux injecter le fcrt.bin dans une nouvelle nand sans en connaitre la clef de chiffrage.<br />
<br />
Pour extraire a partir du pattern &quot;fcrt.bin&quot; c'est assez simple.<br />
<br />
Voici ce que l'on retrouve toujours dans la nand.<br />
[nom fichier][offset dans la nand sur 8 octets][taille du fichier sur 4 octets][meta sur 4 octets]<br />
<br />
C'est les donnees que je lis ici :<br />
<div class="codebox"><cite>Code C : <a onclick="code_select('s2982552936')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s2982552936"><code><br />&nbsp;
<span style="color: #993333;">void</span>&nbsp; &nbsp; get_fcrt_info<span style="color: #009900;">&#40;</span>t_file <span style="color: #339933;">*</span>nand, <span style="color: #993333;">int</span> offset<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp; nand<span style="color: #339933;">-</span>&gt;fcrt_offset <span style="color: #339933;">=</span> read_nb<span style="color: #009900;">&#40;</span>nand<span style="color: #339933;">-</span>&gt;file, offset, <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span>;
&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Data start block is at offset %#.4xx98AnTiSlAsHx98n&quot;</span>, nand<span style="color: #339933;">-</span>&gt;fcrt_offset<span style="color: #009900;">&#41;</span>;
&nbsp; offset <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">8</span>;
&nbsp; nand<span style="color: #339933;">-</span>&gt;fcrt_len <span style="color: #339933;">=</span> read_nb<span style="color: #009900;">&#40;</span>nand<span style="color: #339933;">-</span>&gt;file, offset, <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>;
&nbsp; offset <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">4</span>;
&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Fcrt lenght is %dx98AnTiSlAsHx98n&quot;</span>, nand<span style="color: #339933;">-</span>&gt;fcrt_len<span style="color: #009900;">&#41;</span>;
&nbsp; strncpy<span style="color: #009900;">&#40;</span>nand<span style="color: #339933;">-</span>&gt;fcrt_meta, nand<span style="color: #339933;">-</span>&gt;file <span style="color: #339933;">+</span> offset, <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>;
&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Meta is : %x %x %x %xx98AnTiSlAsHx98n&quot;</span>,
nand<span style="color: #339933;">-</span>&gt;fcrt_meta<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>,nand<span style="color: #339933;">-</span>&gt;fcrt_meta<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, nand<span style="color: #339933;">-</span>&gt;fcrt_meta<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span>, nand<span style="color: #339933;">-</span>&gt;fcrt_meta<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;</code></pre></div>
<br />
Une fois que l'on connait l'offset et la taille, il suffit d'un petit lseek pour ce positionner au bon endroit dans le fichier, et on lit de la bonne taille et l'on possede le fichier <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/wink.png" width="15" height="15" alt="wink" />.<br />
<br />
Les offsets sont donnees par rapport a des blocks de 16896 octets.<br />
Donc si ton offset est 2, l'offset reel dans le fichier sera 2 * 16896.<br />
<br />
Ceci est applicable sur une nand directement dumper, donc aucun dechiffrage a faire avant.<br />
<br />
La nand en elle meme n'est pas chiffrer, ce sont juste certaine partie qui le sont, comme le kevault ou des fichiers les CB etc.<br />
Tu peux voir ce script qui dechiffre certain fichier<br />
http://www.logic-sunrise.com/forums/files/file/4782-buildpy-14719-by-marchisio-vola-fixed/<br />
<br />
On vois bien que pour chaque fichier, ca differe un peu, mais ca reste tout le temps a peu pres la meme chose.]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Tue, 07 Aug 2012 21:15:42 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=192#p192</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>Mon, 06 Aug 2012 16:26:09 +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=44#p44</link>
			<description><![CDATA[Thanks <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/wink.png" width="15" height="15" alt="wink" />]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Sun, 30 May 2010 19:13:49 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=44#p44</guid>
		</item>
		<item>
			<title><![CDATA[What WinForm Control?]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=43#p43</link>
			<description><![CDATA[Delphi really! That's awesome I've not seen Delphi in forever,  again congrats on a awesome tool job well done.]]></description>
			<author><![CDATA[dummy@example.com (jnewing)]]></author>
			<pubDate>Sun, 30 May 2010 13:42:08 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=43#p43</guid>
		</item>
		<item>
			<title><![CDATA[What WinForm Control?]]></title>
			<link>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=42#p42</link>
			<description><![CDATA[Hello,<br />
<br />
My tool has not been developed. Net, it is in Delphi.<br />
And to make it  look I use alphacontrols (<a href="http://www.alphaskins.com/" >http://www.alphaskins.com/</a>).]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Sun, 30 May 2010 08:57:18 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=42#p42</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 03:19:46 +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=26#p26</link>
			<description><![CDATA[D&eacute;sol&eacute;, mais franchement la, j'ignore la r&eacute;ponse que tu cherche <img src="http://www.bestpig.fr/forum/images/blue/bbcode/smilies/sad.png" width="15" height="15" alt="sad" />.]]></description>
			<author><![CDATA[dummy@example.com (bestpig)]]></author>
			<pubDate>Wed, 21 Apr 2010 20:18:59 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=26#p26</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('s4897842015')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s4897842015"><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('s5264822961')" href="javascript:void(0)">[Séléctionner le code]</a></cite><pre id="s5264822961"><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>Sun, 18 Apr 2010 22:51:24 +0000</pubDate>
			<guid>http://www.bestpig.fr/forum/index.php?page=viewtopic&amp;pid=25#p25</guid>
		</item>
	</channel>
</rss>
