<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Filipe,<div>no I meant item_count = 1</div><div>It is true that is gets erased, but it is previously saved in count.</div><div>Then I use item_count as the loop counter and count (which is now the same value of item_count) as the loop counter</div><div>The reason for this is that code below expects item_count to mean how many items are available, and I exploit this to break out of the loop earlier with the right count of items if I can't find a valid NULL-terminated chunk of data (you could say "read me 5 strings" but we only find 3 and then we have to stop reading before we find another 0).</div><div>Hope this clarifies the code path a little.<br><div><br></div><div>Thanks for keeping eyes open ;-)</div><div><br></div><div><div>
<div><div style="border-collapse: separate; border-spacing: 0px; "><i>Enrico Granata</i></div><div style="border-collapse: separate; border-spacing: 0px; ">✉ egranata@<font class="Apple-style-span" color="#ff230e"></font>.com</div><div>✆ (408) 972-7683</div></div>
</div>
<br><div><div>On Jan 21, 2013, at 12:14 PM, Filipe Cabecinhas <<a href="mailto:filcab@gmail.com">filcab@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra">Hi Enrico,<br><br><div class="gmail_quote">On Mon, Jan 21, 2013 at 11:20 AM, Enrico Granata <span dir="ltr"><<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">...<br>
@@ -674,6 +676,46 @@<br>
             if (bytes_read < total_byte_size)<br>
                 result.AppendWarningWithFormat("Not all bytes (%lu/%lu) were able to be read from 0x%" PRIx64 ".", bytes_read, total_byte_size, addr);<br>
         }<br>
+        else<br>
+        {<br>
+            // we treat c-strings as a special case because they do not have a fixed size<br>
+            if (m_format_options.GetByteSizeValue().OptionWasSet() && !m_format_options.HasGDBFormat())<br>
+                item_byte_size = m_format_options.GetByteSizeValue().GetCurrentValue();<br>
+            else<br>
+                item_byte_size = target->GetMaximumSizeOfStringSummary();<br>
+            if (!m_format_options.GetCountValue().OptionWasSet())<br>
+                item_count = 1;<br></blockquote><div style="">^^ didn't you mean count = 1?</div><div style=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            data_sp.reset (new DataBufferHeap ((item_byte_size+1) * item_count, '\0')); // account for NULLs as necessary<br>
+            uint8_t *data_ptr = data_sp->GetBytes();<br>
+            auto data_addr = addr;<br>
+            auto count = item_count;<br>
+            item_count = 0;<br></blockquote><div style="">^^ Otherwise, it gets erased by this.</div><div style=""><br></div><div style="">Thanks,</div><div style=""><br></div><div style="">  Filipe</div></div></div></div>
</blockquote></div><br></div></div></body></html>