Changeset 414

Show
Ignore:
Timestamp:
10/15/07 01:51:04 (1 year ago)
Author:
andrei
Message:

Bug fixes prompted by Walter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • candidate/phobos/std/stdio.d

    r403 r414  
    343343    static if (!is(typeof(args[0]) : FILE*)) 
    344344    { 
    345         static assert(isSomeString!(T[0]), errorMessage); 
    346         w.backend = stdout; 
    347         FLOCK(w.backend); 
    348         scope(exit) FUNLOCK(w.backend); 
    349         std.format.formattedWrite(w, args); 
     345        static if (!isSomeString!(T[0])) 
     346        { 
     347            // compatibility hack 
     348            return writef(stdio, "", args); 
     349        } 
     350        else 
     351        { 
     352            w.backend = stdout; 
     353            FLOCK(w.backend); 
     354            scope(exit) FUNLOCK(w.backend); 
     355            std.format.formattedWrite(w, args); 
     356        } 
    350357    } 
    351358    else 
    352359    { 
    353         static assert(isSomeString!(T[1]), errorMessage); 
    354         w.backend = args[0]; 
    355         FLOCK(w.backend); 
    356         scope(exit) FUNLOCK(w.backend); 
    357         std.format.formattedWrite(w, args[1 .. $]); 
     360        static if (!isSomeString!(T[1])) 
     361        { 
     362            // compatibility hack 
     363            return writef(args[0], "", args[1 .. $]); 
     364        } 
     365        else 
     366        { 
     367            w.backend = args[0]; 
     368            FLOCK(w.backend); 
     369            scope(exit) FUNLOCK(w.backend); 
     370            std.format.formattedWrite(w, args[1 .. $]); 
     371        } 
    358372    } 
    359373} 
     
    392406    static if (!is(typeof(args[0]) : FILE*)) 
    393407    { 
    394         static assert(isSomeString!(T[0]), errorMessage); 
    395         w.backend = stdout; 
    396         FLOCK(w.backend); 
    397         scope(exit) FUNLOCK(w.backend); 
    398         std.format.formattedWrite(w, args, '\n'); 
     408        static if (!isSomeString!(T[0])) 
     409        { 
     410            // compatibility hack 
     411            return writef(stdio, "", args, '\n'); 
     412        } 
     413        else 
     414        { 
     415            w.backend = stdout; 
     416            FLOCK(w.backend); 
     417            scope(exit) FUNLOCK(w.backend); 
     418            std.format.formattedWrite(w, args, '\n'); 
     419        } 
    399420    } 
    400421    else 
    401422    { 
    402         static assert(isSomeString!(T[1]), errorMessage); 
    403         w.backend = args[0]; 
    404         FLOCK(w.backend); 
    405         scope(exit) FUNLOCK(w.backend); 
    406         std.format.formattedWrite(w, args[1 .. $], '\n'); 
     423        static if (!isSomeString!(T[1])) 
     424        { 
     425            // compatibility hack 
     426            return writef(args[0], "", args[1 .. $], '\n'); 
     427        } 
     428        else 
     429        { 
     430            w.backend = args[0]; 
     431            FLOCK(w.backend); 
     432            scope(exit) FUNLOCK(w.backend); 
     433            std.format.formattedWrite(w, args[1 .. $], '\n'); 
     434        } 
    407435    } 
    408436} 
     
    825853                else 
    826854                { 
    827                     char[2] buf; 
     855                    char[4] buf; 
    828856                    auto b = std.utf.toUTF8(buf, c); 
    829857                    foreach (i ; 0 .. b.length)