mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
[cdatapack] #define PY_SSIZE_T_CLEAN
Summary: This allows us to use a typedef'd type for our size fields, and avoid the sketchy int declarations. Test Plan: pass test-remotefilelog-datapack.py (with hacks) Reviewers: #fastmanifest, durham Reviewed By: durham Subscribers: durham, mitrandir, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3786882 Tasks: 12932864 Signature: t1:3786882:1472515261:91d86f5bda09f4a0beea729eb1f871e99932548b
This commit is contained in:
parent
e337be9c29
commit
ec2fcf297c
@ -7,6 +7,10 @@
|
||||
//
|
||||
// no-check-code
|
||||
|
||||
// The PY_SSIZE_T_CLEAN define must be defined before the Python.h include,
|
||||
// as per the documentation.
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include "cdatapack.h"
|
||||
@ -45,7 +49,7 @@ static int cdatapack_init(py_cdatapack *self, PyObject *args) {
|
||||
self->handle = NULL;
|
||||
|
||||
char *node;
|
||||
int nodelen;
|
||||
Py_ssize_t nodelen;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s#", &node, &nodelen)) {
|
||||
return -1;
|
||||
@ -143,7 +147,7 @@ static PyObject *cdatapack_find(
|
||||
py_cdatapack *self,
|
||||
PyObject *args) {
|
||||
const char *node;
|
||||
int node_sz;
|
||||
Py_ssize_t node_sz;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s#", &node, &node_sz)) {
|
||||
return NULL;
|
||||
@ -197,7 +201,7 @@ static PyObject *cdatapack_getdeltachain(
|
||||
py_cdatapack *self,
|
||||
PyObject *args) {
|
||||
const char *node;
|
||||
int node_sz;
|
||||
Py_ssize_t node_sz;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s#", &node, &node_sz)) {
|
||||
return NULL;
|
||||
@ -238,7 +242,7 @@ static PyObject *cdatapack_getdeltachain(
|
||||
deltabasenode = PyString_FromStringAndSize(
|
||||
(const char *) link->deltabase_node, NODE_SZ);
|
||||
delta = PyString_FromStringAndSize(
|
||||
(const char *) link->delta, link->delta_sz);
|
||||
(const char *) link->delta, (Py_ssize_t) link->delta_sz);
|
||||
|
||||
if (name != NULL &&
|
||||
retnode != NULL &&
|
||||
|
Loading…
Reference in New Issue
Block a user