Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e3a0632c
Commit
e3a0632c
authored
Nov 09, 2002
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor formatting, and a copyright notice.
parent
36bb803b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
lib/python/BDBStorage/_helper.c
lib/python/BDBStorage/_helper.c
+24
-7
No files found.
lib/python/BDBStorage/_helper.c
View file @
e3a0632c
/*****************************************************************************
Copyright (c) 2002 Zope Corporation and Contributors.
All Rights Reserved.
This software is subject to the provisions of the Zope Public License,
Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE
****************************************************************************/
#include <Python.h>
/* This helper only works for Python 2.2. If using an older version, crap
* out now so we don't leave a broken, but compiled and importable module
* laying about.
/* This helper only works for Python 2.2 and beyond. If we're using an
* older version of Python, stop out now so we don't leave a broken, but
* compiled and importable module laying about. Full.py has a workaround
* for when this extension isn't available.
*/
#if PY_VERSION_HEX < 0x020200F0
#error "Must be using at least Python 2.2"
...
...
@@ -20,12 +35,13 @@ helper_incr(PyObject* self, PyObject* args)
assert
(
len
==
8
);
/*
t
here seems to be no direct route from byte array to long long, so
/*
T
here seems to be no direct route from byte array to long long, so
* first convert it to a PyLongObject*, then convert /that/ thing to a
* long long
* long long
.
*/
pylong
=
_PyLong_FromByteArray
(
s
,
len
,
0
/* big endian */
,
0
/* unsigned */
);
0
/* big endian */
,
0
/* unsigned */
);
if
(
!
pylong
)
return
NULL
;
...
...
@@ -35,7 +51,8 @@ helper_incr(PyObject* self, PyObject* args)
return
NULL
;
res
=
_PyLong_AsByteArray
((
PyLongObject
*
)
sum
,
x
,
8
,
0
/* big endian */
,
0
/* unsigned */
);
0
/* big endian */
,
0
/* unsigned */
);
if
(
res
<
0
)
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment