Fix some more type mismatches with std::{min,max}
This commit is contained in:
@@ -23,7 +23,7 @@ ata_trace_printf(uint32 flags, const char *format, ...)
|
||||
size_t totalBytes = vsnprintf(sTraceBuffer + sTraceBufferOffset,
|
||||
sizeof(sTraceBuffer) - sTraceBufferOffset, format, arguments);
|
||||
sTraceBufferOffset += std::min(totalBytes,
|
||||
sizeof(sTraceBuffer) - sTraceBufferOffset - 1);
|
||||
(size_t)(sizeof(sTraceBuffer) - sTraceBufferOffset - 1));
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize,
|
||||
int32 managerIndex = GetStack()->IndexOfBusManager(GetBusManager());
|
||||
size_t totalBytes = snprintf(string + *index, bufferSize - *index,
|
||||
"%" B_PRId32, managerIndex);
|
||||
*index += std::min(totalBytes, bufferSize - *index - 1);
|
||||
*index += std::min(totalBytes, (size_t)(bufferSize - *index - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize,
|
||||
if (*index < bufferSize) {
|
||||
size_t totalBytes = snprintf(string + *index, bufferSize - *index,
|
||||
"/hub");
|
||||
*index += std::min(totalBytes, bufferSize - *index - 1);
|
||||
*index += std::min(totalBytes, (size_t)(bufferSize - *index - 1));
|
||||
}
|
||||
} else {
|
||||
// find out where the requested device sitts
|
||||
@@ -435,7 +435,8 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize,
|
||||
if (*index < bufferSize) {
|
||||
size_t totalBytes = snprintf(string + *index,
|
||||
bufferSize - *index, "/%" B_PRId32, i);
|
||||
*index += std::min(totalBytes, bufferSize - *index - 1);
|
||||
*index += std::min(totalBytes,
|
||||
(size_t)(bufferSize - *index - 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1986,7 +1986,7 @@ debug_strlcpy(team_id teamID, char* to, const char* from, size_t size)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
// limit size to avoid address overflows
|
||||
size_t maxSize = std::min(size,
|
||||
size_t maxSize = std::min((addr_t)size,
|
||||
~(addr_t)0 - std::max((addr_t)from, (addr_t)to) + 1);
|
||||
// NOTE: Since strlcpy() determines the length of \a from, the source
|
||||
// address might still overflow.
|
||||
|
||||
@@ -5316,7 +5316,7 @@ user_strlcpy(char* to, const char* from, size_t size)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
// limit size to avoid address overflows
|
||||
size_t maxSize = std::min(size,
|
||||
size_t maxSize = std::min((addr_t)size,
|
||||
~(addr_t)0 - std::max((addr_t)from, (addr_t)to) + 1);
|
||||
// NOTE: Since arch_cpu_user_strlcpy() determines the length of \a from,
|
||||
// the source address might still overflow.
|
||||
|
||||
Reference in New Issue
Block a user