Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #12255
| From | "R.Wieser" <address@not.available> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: file.ReadAll - another quirk |
| Date | 2019-11-22 09:23 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qr8ep6$1f27$1@gioia.aioe.org> (permalink) |
| References | (1 earlier) <nnvg6lcw8zs0$.lzm0ik3jt3ww$.dlg@40tude.net> <qr6p71$21l$1@gioia.aioe.org> <qr6ql2$6v3$1@dont-email.me> <qr6t4k$kht$1@gioia.aioe.org> <qr6voe$628$1@dont-email.me> |
Mayayana, > But the former will stop at the first null when I try to read I'm not sure what you mean with "when I try to read" there. The whole file gets processed, as is proven by the last bytes of the resulting malformed string matching the last bytes of the file. > If I ReadAll a GIF or Read(filelen) a GIF I apparently get the same bytes. That fully depends on the size of the file. The readall code internally works in increments of 260 bytes. Take a file of at least that size and the corruption will take place. > But the former will stop at the first null when I try to read it > while the latter will not. Again, /it doesn't stop/. > I don't understand what you mean by "copying after reallocating". The "readall" method goes (simplified) like this: - while not at EOF - try to read 260 bytes of data - convert from utf-8 to widestring - allocate a new blob of memory the size of the old one plus the size of the wide string - copy the contents of the old blob into the new blob <=== !! - copy the widestring into the new blob (at an offset equal to the old blobs size) - wend - return contents of the "new blob" It goes wrong at the "copy the contents of the old blob into the new blob" point. That copy routine stops at the first zero (leaving the remainder of the "new blob" undefined) when it should just have copied the whole specified block (copy X bytes from Y to Z). Regards, Rudy Wieser
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-20 12:54 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-20 08:39 -0500
Re: file.ReadAll - another quirk JJ <jj4public@vfemail.net> - 2019-11-22 00:00 +0700
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-21 12:50 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-21 20:39 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-21 15:04 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-21 21:46 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-21 16:31 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-22 09:23 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-22 09:14 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-22 15:58 +0100
Re: file.ReadAll - another quirk JJ <jj4public@vfemail.net> - 2019-11-22 19:13 +0700
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-22 15:47 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-22 10:10 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-22 18:37 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-22 18:40 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-23 09:19 +0100
Re: file.ReadAll - another quirk "Mayayana" <mayayana@invalid.nospam> - 2019-11-23 10:09 -0500
Re: file.ReadAll - another quirk "R.Wieser" <address@not.available> - 2019-11-23 17:36 +0100
Re: file.ReadAll - another quirk JJ <jj4public@vfemail.net> - 2019-11-22 19:10 +0700
csiph-web