Skip to content

Commit

Permalink
Fix up a few more improper printf usages
Browse files Browse the repository at this point in the history
  • Loading branch information
braddr committed Jan 26, 2011
1 parent 338b9cc commit c41103f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 4 additions & 3 deletions test/runnable/test11.d
Expand Up @@ -700,7 +700,7 @@ void test35()
try {
alias Foo35!( Bar35 ) filter;
} catch (Exception e) {
printf( "Exception %.*s", e.msg );
printf( "Exception %.*s", e.msg.length, e.msg.ptr );
} finally {
printf( "Done0." );
}
Expand Down Expand Up @@ -904,7 +904,7 @@ void test45()
char[5] foo;

foo[] = "hello";
printf("'%.*s'\n", foo);
printf("'%.*s'\n", foo.length, foo.ptr);
func45(cast(string)foo);
}

Expand Down Expand Up @@ -1275,7 +1275,8 @@ class A63
void test63()
{
A63 f = new A63();
printf("%.*s\n", f.getcwd());
auto s = f.getcwd();
printf("%.*s\n", s.length, s.ptr);
}


Expand Down
12 changes: 5 additions & 7 deletions test/runnable/test8.d
Expand Up @@ -317,14 +317,12 @@ void test17()
{
string s;

printf("passString() = %.*s\n", passString());

s = passString();
printf("passString() = %.*s\n", s.length, s.ptr);
assert(s == "First stringConcatenated with second");

printf("butThisWorks() = %.*s\n", butThisWorks());

s = butThisWorks();
printf("butThisWorks() = %.*s\n", s.length, s.ptr);
assert(s == "Third stringConcatenated with fourth");
}

Expand Down Expand Up @@ -356,8 +354,8 @@ void test18()
// This will give sintax error
//str[0].sort();

printf(str[0].ptr);
printf(str[1].ptr);
printf("%.*s", str[0].length, str[0].ptr);
printf("%.*s", str[1].length, str[1].ptr);
printf("\n");

string s = str[0] ~ str[1];
Expand Down Expand Up @@ -726,7 +724,7 @@ void test36()
{
string s = testa36(26, 47, "a", "b", "c");

printf("s = '%.*s'\n", s);
printf("s = '%.*s'\n", s.length, s.ptr);
assert(s == "string 0;26string 1;47string 2;26string 3;");
}

Expand Down

0 comments on commit c41103f

Please sign in to comment.