summaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-16 15:24:40 +0000
committerDan Gohman <gohman@apple.com>2009-07-16 15:24:40 +0000
commitad60f660c6fd1999a3e21823128d37aca62e9285 (patch)
tree8e207c767d66af28ad41f472069d25721d66661b /lib/Support/raw_ostream.cpp
parentebfe2b27223d4b177f05bc1b003f83f4a7044066 (diff)
downloadllvm-ad60f660c6fd1999a3e21823128d37aca62e9285.tar.gz
llvm-ad60f660c6fd1999a3e21823128d37aca62e9285.tar.bz2
llvm-ad60f660c6fd1999a3e21823128d37aca62e9285.tar.xz
Use size_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 8724801818..397d2967c2 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -121,7 +121,7 @@ raw_ostream &raw_ostream::operator<<(const void *P) {
char *CurPtr = EndPtr;
while (N) {
- unsigned x = N % 16;
+ uintptr_t x = N % 16;
*--CurPtr = (x < 10 ? '0' + x : 'a' + x - 10);
N /= 16;
}
@@ -153,7 +153,7 @@ raw_ostream &raw_ostream::write(unsigned char C) {
return *this;
}
-raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) {
+raw_ostream &raw_ostream::write(const char *Ptr, size_t Size) {
// Group exceptional cases into a single branch.
if (BUILTIN_EXPECT(OutBufCur+Size > OutBufEnd, false)) {
if (Unbuffered) {
@@ -203,10 +203,10 @@ raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) {
// anyway. We should just flush upfront in such cases, and use the
// whole buffer as our scratch pad. Note, however, that this case is
// also necessary for correctness on unbuffered streams.
- unsigned NextBufferSize = 127;
+ size_t NextBufferSize = 127;
if (OutBufEnd-OutBufCur > 3) {
- unsigned BufferBytesLeft = OutBufEnd-OutBufCur;
- unsigned BytesUsed = Fmt.print(OutBufCur, BufferBytesLeft);
+ size_t BufferBytesLeft = OutBufEnd-OutBufCur;
+ size_t BytesUsed = Fmt.print(OutBufCur, BufferBytesLeft);
// Common case is that we have plenty of space.
if (BytesUsed < BufferBytesLeft) {
@@ -228,7 +228,7 @@ raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) {
V.resize(NextBufferSize);
// Try formatting into the SmallVector.
- unsigned BytesUsed = Fmt.print(&V[0], NextBufferSize);
+ size_t BytesUsed = Fmt.print(&V[0], NextBufferSize);
// If BytesUsed fit into the vector, we win.
if (BytesUsed <= NextBufferSize)
@@ -296,7 +296,7 @@ raw_fd_ostream::~raw_fd_ostream() {
}
}
-void raw_fd_ostream::write_impl(const char *Ptr, unsigned Size) {
+void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
assert (FD >= 0 && "File already closed.");
pos += Size;
if (::write(FD, Ptr, Size) != (ssize_t) Size)
@@ -328,7 +328,7 @@ raw_ostream &raw_fd_ostream::changeColor(enum Colors colors, bool bold,
(colors == SAVEDCOLOR) ? sys::Process::OutputBold(bg)
: sys::Process::OutputColor(colors, bold, bg);
if (colorcode) {
- unsigned len = strlen(colorcode);
+ size_t len = strlen(colorcode);
write(colorcode, len);
// don't account colors towards output characters
pos -= len;
@@ -341,7 +341,7 @@ raw_ostream &raw_fd_ostream::resetColor() {
flush();
const char *colorcode = sys::Process::ResetColor();
if (colorcode) {
- unsigned len = strlen(colorcode);
+ size_t len = strlen(colorcode);
write(colorcode, len);
// don't account colors towards output characters
pos -= len;
@@ -383,7 +383,7 @@ raw_os_ostream::~raw_os_ostream() {
flush();
}
-void raw_os_ostream::write_impl(const char *Ptr, unsigned Size) {
+void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
OS.write(Ptr, Size);
}
@@ -401,7 +401,7 @@ raw_string_ostream::~raw_string_ostream() {
flush();
}
-void raw_string_ostream::write_impl(const char *Ptr, unsigned Size) {
+void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
OS.append(Ptr, Size);
}
@@ -413,7 +413,7 @@ raw_svector_ostream::~raw_svector_ostream() {
flush();
}
-void raw_svector_ostream::write_impl(const char *Ptr, unsigned Size) {
+void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
OS.append(Ptr, Ptr + Size);
}