www.digitalmars.com         C & C++   DMDScript  

D - bug: utferror & std.zip & std.file

reply "Carlos Santander B." <carlos8294 msn.com> writes:
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
Mar 12 2004
parent J C Calvarese <jcc7 cox.net> writes:
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 (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