Fix const errors.
authorJelmer Vernooij <jelmer@jelmer.uk>
Sat, 9 Jul 2016 23:13:10 +0000 (23:13 +0000)
committerJelmer Vernooij <jelmer@jelmer.uk>
Sat, 9 Jul 2016 23:13:10 +0000 (23:13 +0000)
subvertpy/_ra.c
subvertpy/client.c
subvertpy/editor.c
subvertpy/repos.c
subvertpy/util.c
subvertpy/util.h

index a8d54fe10958e51cb32c586cbd6c9dbc6d5664ae..a1153002965fc00cd78067fb4c7387cae52eb506 100644 (file)
@@ -46,7 +46,7 @@ static PyTypeObject AuthProvider_Type;
 static PyTypeObject CredentialsIter_Type;
 static PyTypeObject Auth_Type;
 
-static bool ra_check_svn_path(char *path)
+static bool ra_check_svn_path(const char *path)
 {
        /* svn_ra_check_path will raise an assertion error if the path has a
         * leading '/'. Raise a Python exception if there ar eleading '/'s so that 
@@ -121,8 +121,8 @@ typedef struct {
        bool busy;
        PyObject *client_string_func;
        PyObject *open_tmp_file_func;
-       char *root;
-       char *corrected_url;
+       const char *root;
+       const char *corrected_url;
 } RemoteAccessObject;
 
 typedef struct {
@@ -1392,12 +1392,12 @@ static PyObject *ra_get_dir(PyObject *self, PyObject *args, PyObject *kwargs)
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
        svn_dirent_t *dirent;
        apr_ssize_t klen;
-       char *path;
+       const char *path;
        PyObject *py_path;
        svn_revnum_t revision = -1;
        unsigned int dirent_fields = 0;
        PyObject *py_dirents, *py_props;
-    char *kwnames[] = { "path", "revision", "fields", NULL };
+       char *kwnames[] = { "path", "revision", "fields", NULL };
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|lI:get_dir", kwnames,
                                      &py_path, &revision, &dirent_fields))
@@ -1472,7 +1472,7 @@ fail:
 
 static PyObject *ra_get_file(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        svn_revnum_t revision = -1;
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
@@ -1540,7 +1540,7 @@ static PyObject *ra_get_lock(PyObject *self, PyObject *args)
 
 static PyObject *ra_check_path(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
        svn_revnum_t revision;
        svn_node_kind_t kind;
@@ -1572,7 +1572,7 @@ static PyObject *ra_check_path(PyObject *self, PyObject *args)
 
 static PyObject *ra_stat(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
        PyObject *ret;
@@ -1717,7 +1717,7 @@ fail_busy:
 
 static PyObject *ra_get_locks(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        apr_pool_t *temp_pool;
        apr_hash_t *hash_locks;
@@ -1777,7 +1777,7 @@ static PyObject *ra_get_locks(PyObject *self, PyObject *args)
 
 static PyObject *ra_get_locations(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
        svn_revnum_t peg_revision;
@@ -1992,7 +1992,7 @@ static PyObject *ra_get_location_segments(PyObject *self, PyObject *args)
 #if ONLY_SINCE_SVN(1, 5)
        RemoteAccessObject *ra = (RemoteAccessObject *)self;
        svn_revnum_t peg_revision, start_revision, end_revision;
-       char *path;
+       const char *path;
        PyObject *py_path;
        PyObject *py_rcvr;
        apr_pool_t *temp_pool;
index 4115371dd497fa6fdc4ab35d64c1668b31100d7a..a2cffd0996c7f3956cc3986a5b4fbeb8101f50c8 100644 (file)
@@ -529,11 +529,12 @@ static PyObject *client_checkout(PyObject *self, PyObject *args, PyObject *kwarg
     char *kwnames[] = { "url", "path", "rev", "peg_rev", "recurse", "ignore_externals", "allow_unver_obstructions", NULL };
     svn_revnum_t result_rev;
     svn_opt_revision_t c_peg_rev, c_rev;
-    char *path, *url;
+       char *path;
+       const char *url;
        PyObject *py_url = NULL;
-    apr_pool_t *temp_pool;
-    PyObject *peg_rev=Py_None, *rev=Py_None;
-    bool recurse=true, ignore_externals=false, allow_unver_obstructions=false;
+       apr_pool_t *temp_pool;
+       PyObject *peg_rev=Py_None, *rev=Py_None;
+       bool recurse=true, ignore_externals=false, allow_unver_obstructions=false;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|OObbb", kwnames, &py_url, &path, &rev, &peg_rev, &recurse, &ignore_externals, &allow_unver_obstructions))
         return NULL;
index 1bd3e6c3bd6c7b65223896fb106bb623a3059f4d..4daffdb5ecbcbb07ed37b310e72acf2249ba38aa 100644 (file)
@@ -368,7 +368,7 @@ PyTypeObject FileEditor_Type = {
 static PyObject *py_dir_editor_delete_entry(PyObject *self, PyObject *args)
 {
        EditorObject *editor = (EditorObject *)self;
-       char *path;
+       const char *path;
        PyObject *py_path;
        svn_revnum_t revision = -1;
 
@@ -398,7 +398,7 @@ static PyObject *py_dir_editor_delete_entry(PyObject *self, PyObject *args)
 static PyObject *py_dir_editor_add_directory(PyObject *self, PyObject *args)
 {
        PyObject *py_path;
-       char *path;
+       const char *path;
        char *copyfrom_path = NULL;
        svn_revnum_t copyfrom_rev = -1;
        void *child_baton;
@@ -438,7 +438,7 @@ static PyObject *py_dir_editor_add_directory(PyObject *self, PyObject *args)
 
 static PyObject *py_dir_editor_open_directory(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        EditorObject *editor = (EditorObject *)self;
        svn_revnum_t base_revision=-1;
@@ -532,7 +532,7 @@ static PyObject *py_dir_editor_close(PyObject *self)
 
 static PyObject *py_dir_editor_absent_directory(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        EditorObject *editor = (EditorObject *)self;
 
@@ -562,7 +562,8 @@ static PyObject *py_dir_editor_absent_directory(PyObject *self, PyObject *args)
 
 static PyObject *py_dir_editor_add_file(PyObject *self, PyObject *args)
 {
-       char *path, *copy_path=NULL;
+       const char *path;
+       char *copy_path=NULL;
        PyObject *py_path;
        svn_revnum_t copy_rev=-1;
        void *file_baton = NULL;
@@ -601,7 +602,7 @@ static PyObject *py_dir_editor_add_file(PyObject *self, PyObject *args)
 
 static PyObject *py_dir_editor_open_file(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        svn_revnum_t base_revision=-1;
        void *file_baton;
@@ -639,7 +640,7 @@ static PyObject *py_dir_editor_open_file(PyObject *self, PyObject *args)
 
 static PyObject *py_dir_editor_absent_file(PyObject *self, PyObject *args)
 {
-       char *path;
+       const char *path;
        PyObject *py_path;
        EditorObject *editor = (EditorObject *)self;
 
index c5874280e31c4861203616268730850c20e29c64..f23a66bca79eee09ed4e2c1ca8789f3f62798948 100644 (file)
@@ -86,7 +86,7 @@ static void repos_dealloc(PyObject *self)
 
 static PyObject *repos_init(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
-       char *path;
+       const char *path;
        char *kwnames[] = { "path", NULL };
        svn_error_t *err;
        RepositoryObject *ret;
index e5893e85e2f29fd3d23e4f0847abfa16c43416d1..4db00b67a493334352e1cfe4f10fb71caac5f018 100644 (file)
@@ -92,7 +92,7 @@ char *py_object_to_svn_string(PyObject *obj, apr_pool_t *pool)
        }
 }
 
-char *py_object_to_svn_uri(PyObject *obj, apr_pool_t *pool)
+const char *py_object_to_svn_uri(PyObject *obj, apr_pool_t *pool)
 {
        const char *ret;
        PyObject *bytes_obj = NULL;
@@ -116,8 +116,9 @@ char *py_object_to_svn_uri(PyObject *obj, apr_pool_t *pool)
        }
 }
 
-char *py_object_to_svn_relpath(PyObject *obj, apr_pool_t *pool)
+const char *py_object_to_svn_relpath(PyObject *obj, apr_pool_t *pool)
 {
+       const char *ret;
        PyObject *bytes_obj = NULL;
 
        if (PyUnicode_Check(obj)) {
@@ -128,8 +129,9 @@ char *py_object_to_svn_relpath(PyObject *obj, apr_pool_t *pool)
        }
 
        if (PyBytes_Check(obj)) {
-               return svn_relpath_canonicalize(PyBytes_AsString(obj), pool);
+               ret = svn_relpath_canonicalize(PyBytes_AsString(obj), pool);
                Py_XDECREF(bytes_obj);
+               return ret;
        } else {
                Py_XDECREF(bytes_obj);
                PyErr_SetString(PyExc_TypeError,
index 6b902cd0ba3a9fc5e121cec29637c2f7c37a2b40..b82b174a8a030dbd8f26ba0c95d0c179b7cc8f66 100644 (file)
@@ -152,8 +152,8 @@ svn_relpath_canonicalize(const char *relpath,
                          apr_pool_t *result_pool);
 #endif
 
-char *py_object_to_svn_uri(PyObject *obj, apr_pool_t *pool);
-char *py_object_to_svn_relpath(PyObject *obj, apr_pool_t *pool);
+const char *py_object_to_svn_uri(PyObject *obj, apr_pool_t *pool);
+const char *py_object_to_svn_relpath(PyObject *obj, apr_pool_t *pool);
 char *py_object_to_svn_string(PyObject *obj, apr_pool_t *pool);
 
 #endif /* _SUBVERTPY_UTIL_H_ */