<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 4: Bug in "InsertPaddingBytes" function</title><link>https://sourceforge.net/p/datamatrixnet/bugs/4/</link><description>Recent changes to 4: Bug in "InsertPaddingBytes" function</description><atom:link href="https://sourceforge.net/p/datamatrixnet/bugs/4/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 23 May 2018 11:10:42 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/datamatrixnet/bugs/4/feed.rss" rel="self" type="application/rss+xml"/><item><title>Bug in "InsertPaddingBytes" function</title><link>https://sourceforge.net/p/datamatrixnet/bugs/4/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;there is a bug in the "InsertPaddingBytes" function. Normally you do not see the effect but in the following cases you will see that depending on the padding the some column(s) of the left solid foreground colored columns will be white for DataMatrix. The conditions are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;When margin is not zero and the module size odd. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;When margin is 1 and the module size is even.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But these conditions only make the bug visible. The bug is there.&lt;/p&gt;
&lt;p&gt;Problem is in the following part:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;                for (int j = 0; j &amp;lt; width; j++)
                {
                    newData[i * paddedWidth + 3 * j] = data[3 * (i * width + j)];
                    newData[i * paddedWidth + 3 * j + 1] = data[3 * (i * width + j) + 1];
                    newData[i * paddedWidth + 3 * j + 2] = data[3 * (i * width + j) + 2];
                }
                for (int k = 0; k &amp;lt; padding; k++)
                {
                    newData[i * paddedWidth + 3 * k] = 255;
                    newData[i * paddedWidth + 3 * k + 1] = 255;
                    newData[i * paddedWidth + 3 * k + 2] = 255;
                }
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Here the second "for" loop overwrites the padding times columns of the data array. A possible solution is as follows:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;                int j;
                for (j = 0; j &amp;lt; width; j++)
                {
                    newData[i * paddedWidth + 3 * j] = data[3 * (i * width + j)];
                    newData[i * paddedWidth + 3 * j + 1] = data[3 * (i * width + j) + 1];
                    newData[i * paddedWidth + 3 * j + 2] = data[3 * (i * width + j) + 2];
                }
                for (int k = 0; k &amp;lt; padding; k++)
                {
                    newData[i * paddedWidth + 3 * j + k] = 255;
                }
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Can  you please check?&lt;/p&gt;
&lt;p&gt;Br,&lt;br/&gt;
Murat Y.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Murat YILDIZ</dc:creator><pubDate>Wed, 23 May 2018 11:10:42 -0000</pubDate><guid>https://sourceforge.net1c09eedf3c0e483b518ffc091f7e6563d0b0bd66</guid></item></channel></rss>