Merge branch 'monetary-type-fix' into 'master'
correct types in monetary See merge request redox-os/relibc!1198
This commit is contained in:
@@ -15,6 +15,7 @@ language = "C"
|
||||
style = "tag"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
usize_is_size_t = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::platform::types::c_char;
|
||||
use crate::platform::types::{c_char, size_t, ssize_t};
|
||||
|
||||
use super::{DEFAULT_MONETARY, FormatFlags, LocaleMonetaryInfo, apply_grouping};
|
||||
use alloc::string::{String, ToString};
|
||||
@@ -17,10 +17,10 @@ use libm::{fabs, pow, round, trunc};
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn strfmon(
|
||||
s: *mut c_char, // Output buffer
|
||||
maxsize: usize, // Maximum size of the buffer
|
||||
maxsize: size_t, // Maximum size of the buffer
|
||||
format: *const c_char, // Format string
|
||||
mut args: ... // Variadic arguments for monetary values
|
||||
) -> isize {
|
||||
) -> ssize_t {
|
||||
// Validate input pointers and buffer size
|
||||
if s.is_null() || format.is_null() || maxsize == 0 {
|
||||
return -1; // Invalid input
|
||||
@@ -151,7 +151,7 @@ pub unsafe extern "C" fn strfmon(
|
||||
return -1; // Buffer overflow
|
||||
}
|
||||
buffer[pos] = 0; // Null-terminate the buffer
|
||||
pos as isize // Return the number of characters written
|
||||
pos as ssize_t // Return the number of characters written
|
||||
}
|
||||
|
||||
/// Formats a monetary value into the given `buffer` using locale-specific rules
|
||||
|
||||
Reference in New Issue
Block a user