Skip to content

Commit

Permalink
[APPROVAL] review/bdlsb-test-build-failures-toupper-jira-676 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
abeels committed Oct 14, 2015
2 parents e1f7483 + 083f05e commit 1a8f20f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 19 deletions.
27 changes: 22 additions & 5 deletions groups/bdl/bdlsb/bdlsb_memoutstreambuf.h
Expand Up @@ -86,9 +86,24 @@ BSLS_IDENT("$Id: $")
// {
// }
//..
// As is typical, the streaming operators are made friends of the class. We
// use the 'transform' algorithm to convert lower-case characters to
// upper-case.
// As is typical, the streaming operators are made friends of the class.
//
// Note that we cannot directly use 'bsl::toupper' to capitalize each
// individual character, because 'bsl::toupper' operates on 'int' instead of
// 'char'. Instead, we call a function 'ucharToUpper' that works in terms of
// 'unsigned char'. some care must be made to avoid undefined and
// implementation-specific behavior during the conversions to and from 'int'.
// Therefore we wrap 'bsl::toupper' in an interface that works in terms of
// 'unsigned char':
//..
// static unsigned char ucharToUpper(unsigned char input)
// // Return the upper-case equivalent to the specified 'input' character.
// {
// return bsl::toupper(input);
// }
//..
// Finally, we use the 'transform' algorithm to convert lower-case characters
// to upper-case.
//..
// // FREE OPERATORS
// CapitalizingStream& operator<<(CapitalizingStream& stream,
Expand All @@ -98,7 +113,7 @@ BSLS_IDENT("$Id: $")
// bsl::transform(tmp.begin(),
// tmp.end(),
// tmp.begin(),
// bsl::toupper);
// ucharToUpper);
// stream.d_streamBuffer_p->sputn(tmp.data(), tmp.length());
// return stream;
// }
Expand All @@ -118,7 +133,9 @@ BSLS_IDENT("$Id: $")
// into dynamically allocated buffer:
//..
// assert(12 == streamBuffer.length());
// assert(0 == bsl::strcmp("HELLO WORLD.", streamBuffer.data()));
// assert(0 == bsl::strncmp("HELLO WORLD.",
// streamBuffer.data(),
// streamBuffer.length()));
//..

#ifndef INCLUDED_BDLSCM_VERSION
Expand Down
28 changes: 22 additions & 6 deletions groups/bdl/bdlsb/bdlsb_memoutstreambuf.t.cpp
Expand Up @@ -526,9 +526,24 @@ namespace {
{
}
//..
// As is typical, the streaming operators are made friends of the class. We
// use the 'transform' algorithm to convert lower-case characters to
// upper-case.
// As is typical, the streaming operators are made friends of the class.
//
// Note that we cannot directly use 'bsl::toupper' to capitalize each
// individual character, because 'bsl::toupper' operates on 'int' instead of
// 'char'. Instead, we call a function 'ucharToUpper' that works in terms of
// 'unsigned char'. some care must be made to avoid undefined and
// implementation-specific behavior during the conversions to and from 'int'.
// Therefore we wrap 'bsl::toupper' in an interface that works in terms of
// 'unsigned char':
//..
static unsigned char ucharToUpper(unsigned char input)
// Return the upper-case equivalent to the specified 'input' character.
{
return bsl::toupper(input);
}
//..
// Finally, we use the 'transform' algorithm to convert lower-case characters
// to upper-case.
//..
// FREE OPERATORS
CapitalizingStream& operator<<(CapitalizingStream& stream,
Expand All @@ -538,8 +553,7 @@ namespace {
bsl::transform(tmp.begin(),
tmp.end(),
tmp.begin(),
bsl::toupper);
//static_cast<int(*)(int)>(bsl::toupper));
ucharToUpper);
stream.d_streamBuffer_p->sputn(tmp.data(), tmp.length());
return stream;
}
Expand Down Expand Up @@ -600,7 +614,9 @@ int main(int argc, char *argv[])
// into dynamically allocated buffer:
//..
ASSERT(12 == streamBuffer.length());
ASSERT(0 == bsl::strcmp("HELLO WORLD.", streamBuffer.data()));
ASSERT(0 == bsl::strncmp("HELLO WORLD.",
streamBuffer.data(),
streamBuffer.length()));
//..
}
} break;
Expand Down
23 changes: 19 additions & 4 deletions groups/bdl/bdlsb/bdlsb_overflowmemoutstreambuf.h
Expand Up @@ -101,9 +101,24 @@ BSLS_IDENT("$Id: $")
// {
// }
//..
// As is typical, the streaming operators are made friends of the class. We
// use the 'transform' algorithm to convert lower-case characters to
// upper-case.
// As is typical, the streaming operators are made friends of the class.
//
// Note that we cannot directly use 'bsl::toupper' to capitalize each
// individual character, because 'bsl::toupper' operates on 'int' instead of
// 'char'. Instead, we call a function 'ucharToUpper' that works in terms of
// 'unsigned char'. some care must be made to avoid undefined and
// implementation-specific behavior during the conversions to and from 'int'.
// Therefore we wrap 'bsl::toupper' in an interface that works in terms of
// 'unsigned char':
//..
// static unsigned char ucharToUpper(unsigned char input)
// // Return the upper-case equivalent to the specified 'input' character.
// {
// return bsl::toupper(input);
// }
//..
// Finally, we use the 'transform' algorithm to convert lower-case characters
// to upper-case.
//..
// // FREE OPERATORS
// CapitalizingStream& operator<<(CapitalizingStream& stream,
Expand All @@ -113,7 +128,7 @@ BSLS_IDENT("$Id: $")
// bsl::transform(tmp.begin(),
// tmp.end(),
// tmp.begin(),
// bsl::toupper);
// ucharToUpper);
// stream.d_streamBuffer_p->sputn(tmp.data(), tmp.length());
// return stream;
// }
Expand Down
23 changes: 19 additions & 4 deletions groups/bdl/bdlsb/bdlsb_overflowmemoutstreambuf.t.cpp
Expand Up @@ -280,9 +280,24 @@ namespace {
{
}
//..
// As is typical, the streaming operators are made friends of the class. We
// use the 'transform' algorithm to convert lower-case characters to
// upper-case.
// As is typical, the streaming operators are made friends of the class.
//
// Note that we cannot directly use 'bsl::toupper' to capitalize each
// individual character, because 'bsl::toupper' operates on 'int' instead of
// 'char'. Instead, we call a function 'ucharToUpper' that works in terms of
// 'unsigned char'. some care must be made to avoid undefined and
// implementation-specific behavior during the conversions to and from 'int'.
// Therefore we wrap 'bsl::toupper' in an interface that works in terms of
// 'unsigned char':
//..
static unsigned char ucharToUpper(unsigned char input)
// Return the upper-case equivalent to the specified 'input' character.
{
return bsl::toupper(input);
}
//..
// Finally, we use the 'transform' algorithm to convert lower-case characters
// to upper-case.
//..
// FREE OPERATORS
CapitalizingStream& operator<<(CapitalizingStream& stream,
Expand All @@ -292,7 +307,7 @@ namespace {
bsl::transform(tmp.begin(),
tmp.end(),
tmp.begin(),
bsl::toupper);
ucharToUpper);
stream.d_streamBuffer_p->sputn(tmp.data(), tmp.length());
return stream;
}
Expand Down

0 comments on commit 1a8f20f

Please sign in to comment.