D - bug: utferror & std.zip & std.file
- Carlos Santander B. (28/28) Mar 12 2004 It seems to me that std.zip.ArchiveMember.name should be dchar[] or wcha...
- J C Calvarese (26/33) Mar 12 2004 There's a bug in std.utf. I've already reported it
It seems to me that std.zip.ArchiveMember.name should be dchar[] or wchar[] instead of the current char[]. Ditto for the arguments of the functions in std.file. This code: import std.zip; import std.file; import std.c.stdio; void main(char [][] args) { try { void [] contents = read(args[1]); ZipArchive za = new ZipArchive(contents); foreach (ArchiveMember am; za.directory) write(am.name, za.expand(am)); } catch (Object o) printf("%.*s: %.*s\n",o.classinfo.name,o.toString()); } Outputs: "UtfError: s" when args[1]="aņo.zip", where "aņo.zip" is the attached file and contains the file "aņo.txt". Tested on WinXP and 98, dmd 0.81. BTW, what's kind of error is "s"? If I remove the try...catch, the message is "Error: s". ----------------------- Carlos Santander Bernal begin 666 aņo.zip <I&\N='AT4$L%! `````!``$`-0```"L````````` ` end
Mar 12 2004
Carlos Santander B. wrote:It seems to me that std.zip.ArchiveMember.name should be dchar[] or wchar[] instead of the current char[]. Ditto for the arguments of the functions in std.file. This code:[...]BTW, what's kind of error is "s"? If I remove the try...catch, the message is "Error: s".There's a bug in std.utf. I've already reported it (http://www.digitalmars.com/drn-bin/wwwnews?D/21523), but I guess it never showed up on Walter's bug radar. I just checked and the bug is still present with DMD 0.81. Here's a review: -------------------- I got an error using std.utf and error message says: Error: s That didn't seem very specific or helpful, so I looked at std.utf and found a minor bug. *Line 21 should be:* super(s); class UtfError : Error { uint idx; // index in string of where error occurred this(char[] s, uint i) { idx = i; super("s"); /* should be super(s); */ } }----------------------- Carlos Santander Bernal-- Justin http://jcc_7.tripod.com/d/
Mar 12 2004