mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-30 05:39:12 +02:00
Add cvtZToMode().
The companion function to cvtModeToZ().
This commit is contained in:
parent
1f93e147fa
commit
969e5817c5
@ -324,6 +324,18 @@ cvtModeToZ(mode_t value, char *buffer, size_t bufferSize)
|
|||||||
FUNCTION_TEST_RETURN(result);
|
FUNCTION_TEST_RETURN(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_t
|
||||||
|
cvtZToMode(const char *value)
|
||||||
|
{
|
||||||
|
FUNCTION_TEST_BEGIN();
|
||||||
|
FUNCTION_TEST_PARAM(STRINGZ, value);
|
||||||
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(cvtZToUIntBase(value, 8));
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Convert size to zero-terminated string
|
Convert size to zero-terminated string
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -30,6 +30,7 @@ int64_t cvtZToInt64(const char *value);
|
|||||||
int64_t cvtZToInt64Base(const char *value, int base);
|
int64_t cvtZToInt64Base(const char *value, int base);
|
||||||
|
|
||||||
size_t cvtModeToZ(mode_t value, char *buffer, size_t bufferSize);
|
size_t cvtModeToZ(mode_t value, char *buffer, size_t bufferSize);
|
||||||
|
mode_t cvtZToMode(const char *value);
|
||||||
|
|
||||||
size_t cvtSizeToZ(size_t value, char *buffer, size_t bufferSize);
|
size_t cvtSizeToZ(size_t value, char *buffer, size_t bufferSize);
|
||||||
size_t cvtSSizeToZ(ssize_t value, char *buffer, size_t bufferSize);
|
size_t cvtSSizeToZ(ssize_t value, char *buffer, size_t bufferSize);
|
||||||
|
@ -87,6 +87,8 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_INT(cvtModeToZ(0777, buffer, STACK_TRACE_PARAM_MAX), 4, "convert mode to string");
|
TEST_RESULT_INT(cvtModeToZ(0777, buffer, STACK_TRACE_PARAM_MAX), 4, "convert mode to string");
|
||||||
TEST_RESULT_STR(buffer, "0777", " check buffer");
|
TEST_RESULT_STR(buffer, "0777", " check buffer");
|
||||||
|
|
||||||
|
TEST_RESULT_UINT(cvtZToMode("0700"), 0700, "convert string to mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user