Skip to content

Commit

Permalink
[XrdApps, XrdCl, XrdEc, Python] Use time_t for times and timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
amadio committed Jul 3, 2024
1 parent 0a5f79a commit e358ac0
Show file tree
Hide file tree
Showing 53 changed files with 738 additions and 737 deletions.
6 changes: 3 additions & 3 deletions bindings/python/src/PyXRootDCopyProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ namespace PyXRootD

val = XrdCl::DefaultCPInitTimeout;
env->GetInt( "CPInitTimeout", val );
uint16_t initTimeout = val;
time_t initTimeout = val;

val = XrdCl::DefaultCPTPCTimeout;
env->GetInt( "CPTPCTimeout", val );
uint16_t tpcTimeout = val;
time_t tpcTimeout = val;

val = XrdCl::DefaultCPTimeout;
env->GetInt( "CPTimeout", val );
uint16_t cpTimeout = val;
time_t cpTimeout = val;

if ( !PyArg_ParseTupleAndKeywords( args, kwds, "ss|HbbbbssssbIHHHbHLLLbs:add_job",
(char**) kwlist,
Expand Down
52 changes: 26 additions & 26 deletions bindings/python/src/PyXRootDFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace PyXRootD
const char *url;
XrdCl::OpenFlags::Flags flags = XrdCl::OpenFlags::None;
XrdCl::Access::Mode mode = XrdCl::Access::None;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -75,7 +75,7 @@ namespace PyXRootD
PyObject* File::Close( File *self, PyObject *args, PyObject *kwds )
{
static const char *kwlist[] = { "timeout", "callback", NULL };
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -107,7 +107,7 @@ namespace PyXRootD
{
static const char *kwlist[] = { "force", "timeout", "callback", NULL };
int force = 0;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pyresponse = NULL, *pystatus = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -146,7 +146,7 @@ namespace PyXRootD
NULL };
uint64_t offset = 0;
uint32_t size = 0;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL, *pyresponse = NULL;
PyObject *py_offset = NULL, *py_size = NULL, *py_timeout = NULL;
char *buffer = 0;
Expand All @@ -159,20 +159,20 @@ namespace PyXRootD

unsigned long long tmp_offset = 0;
unsigned int tmp_size = 0;
unsigned short int tmp_timeout = 0;
unsigned int tmp_timeout = 0;

if ( py_offset && PyObjToUllong( py_offset, &tmp_offset, "offset" ) )
return NULL;

if ( py_size && PyObjToUint(py_size, &tmp_size, "size" ) )
return NULL;

if ( py_timeout && PyObjToUshrt(py_timeout, &tmp_timeout, "timeout" ) )
if ( py_timeout && PyObjToUint(py_timeout, &tmp_timeout, "timeout" ) )
return NULL;

offset = (uint64_t)tmp_offset;
size = (uint32_t)tmp_size;
timeout = (uint16_t)tmp_timeout;
timeout = (time_t)tmp_timeout;

if (!size) {
XrdCl::StatInfo *info = 0;
Expand Down Expand Up @@ -427,7 +427,7 @@ namespace PyXRootD
Py_ssize_t buffsize;
uint64_t offset = 0;
uint32_t size = 0;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL;
PyObject *py_offset = NULL, *py_size = NULL, *py_timeout = NULL;
XrdCl::XRootDStatus status;
Expand All @@ -440,20 +440,20 @@ namespace PyXRootD

unsigned long long tmp_offset = 0;
unsigned int tmp_size = 0;
unsigned short int tmp_timeout = 0;
unsigned int tmp_timeout = 0;

if (py_offset && PyObjToUllong(py_offset, &tmp_offset, "offset"))
return NULL;

if (py_size && PyObjToUint(py_size, &tmp_size, "size"))
return NULL;

if (py_timeout && PyObjToUshrt(py_timeout, &tmp_timeout, "timeout"))
if (py_timeout && PyObjToUint(py_timeout, &tmp_timeout, "timeout"))
return NULL;

offset = (uint64_t)tmp_offset;
size = (uint32_t)tmp_size;
timeout = (uint16_t)tmp_timeout;
timeout = (time_t)tmp_timeout;

if (!size) {
size = buffsize;
Expand Down Expand Up @@ -483,7 +483,7 @@ namespace PyXRootD
PyObject* File::Sync( File *self, PyObject *args, PyObject *kwds )
{
static const char *kwlist[] = { "timeout", "callback", NULL };
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -516,7 +516,7 @@ namespace PyXRootD
{
static const char *kwlist[] = { "size", "timeout", "callback", NULL };
uint64_t size;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL;
PyObject *py_size = NULL, *py_timeout = NULL;
XrdCl::XRootDStatus status;
Expand All @@ -527,16 +527,16 @@ namespace PyXRootD
(char**) kwlist, &py_size, &py_timeout, &callback ) ) return NULL;

unsigned long long tmp_size = 0;
unsigned short int tmp_timeout = 0;
unsigned int tmp_timeout = 0;

if ( py_size && PyObjToUllong( py_size, &tmp_size, "size" ) )
return NULL;

if ( py_timeout && PyObjToUshrt( py_timeout, &tmp_timeout, "timeout" ) )
if ( py_timeout && PyObjToUint( py_timeout, &tmp_timeout, "timeout" ) )
return NULL;

size = (uint64_t)tmp_size;
timeout = (uint16_t)tmp_timeout;
timeout = (time_t)tmp_timeout;

if ( callback && callback != Py_None ) {
XrdCl::ResponseHandler *handler = GetHandler<XrdCl::AnyObject>( callback );
Expand All @@ -562,7 +562,7 @@ namespace PyXRootD
PyObject* File::VectorRead( File *self, PyObject *args, PyObject *kwds )
{
static const char *kwlist[] = { "chunks", "timeout", "callback", NULL };
uint16_t timeout = 0;
time_t timeout = 0;
uint64_t offset = 0;
uint32_t length = 0;
PyObject *pychunks = NULL, *callback = NULL;
Expand All @@ -575,12 +575,12 @@ namespace PyXRootD
if ( !PyArg_ParseTupleAndKeywords( args, kwds, "O|OO:vector_read",
(char**) kwlist, &pychunks, &py_timeout, &callback ) ) return NULL;

unsigned short int tmp_timeout = 0;
unsigned int tmp_timeout = 0;

if ( py_timeout && PyObjToUshrt( py_timeout, &tmp_timeout, "timeout" ) )
if ( py_timeout && PyObjToUint( py_timeout, &tmp_timeout, "timeout" ) )
return NULL;

timeout = (uint16_t)tmp_timeout;
timeout = (time_t)tmp_timeout;

if ( !PyList_Check( pychunks ) ) {
PyErr_SetString( PyExc_TypeError, "chunks parameter must be a list" );
Expand Down Expand Up @@ -642,7 +642,7 @@ namespace PyXRootD
static const char *kwlist[] = { "arg", "timeout", "callback", NULL };
const char *buffer = 0;
Py_ssize_t buffSize = 0;
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL, *pyresponse = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -684,7 +684,7 @@ namespace PyXRootD
PyObject* File::Visa( File *self, PyObject *args, PyObject *kwds )
{
static const char *kwlist[] = { "timeout", "callback", NULL };
uint16_t timeout = 0;
time_t timeout = 0;
PyObject *callback = NULL, *pystatus = NULL, *pyresponse = NULL;
XrdCl::XRootDStatus status;

Expand Down Expand Up @@ -770,7 +770,7 @@ namespace PyXRootD
static const char *kwlist[] = { "attrs", "timeout", "callback", NULL };

std::vector<XrdCl::xattr_t> attrs;
uint16_t timeout = 0;
time_t timeout = 0;

PyObject *callback = NULL, *pystatus = NULL;
PyObject *pyattrs = NULL, *pyresponse = NULL;
Expand Down Expand Up @@ -841,7 +841,7 @@ namespace PyXRootD
static const char *kwlist[] = { "attrs", "timeout", "callback", NULL };

std::vector<std::string> attrs;
uint16_t timeout = 0;
time_t timeout = 0;

PyObject *callback = NULL, *pystatus = NULL;
PyObject *pyattrs = NULL, *pyresponse = NULL;
Expand Down Expand Up @@ -900,7 +900,7 @@ namespace PyXRootD
static const char *kwlist[] = { "attrs", "timeout", "callback", NULL };

std::vector<std::string> attrs;
uint16_t timeout = 0;
time_t timeout = 0;

PyObject *callback = NULL, *pystatus = NULL;
PyObject *pyattrs = NULL, *pyresponse = NULL;
Expand Down Expand Up @@ -958,7 +958,7 @@ namespace PyXRootD
{
static const char *kwlist[] = { "timeout", "callback", NULL };

uint16_t timeout = 0;
time_t timeout = 0;

PyObject *callback = NULL, *pystatus = NULL;
PyObject *pyresponse = NULL;
Expand Down
Loading

0 comments on commit e358ac0

Please sign in to comment.