Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
ba71f950
Commit
ba71f950
authored
Oct 18, 2009
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce Python specific code in swig header.
parent
7fa91f0b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
plist.i
swig/plist.i
+13
-15
No files found.
swig/plist.i
View file @
ba71f950
...
...
@@ -6,10 +6,6 @@
#include <plist/plist.h>
#include <plist/plist++.h>
#include <ctime>
//for datetime in python
#include <datetime.h>
typedef struct {
plist_t node;
char should_keep_plist;
...
...
@@ -29,22 +25,26 @@ PListNode *allocate_plist_wrapper(plist_t plist, char should_keep_plist) {
%include "std_string.i"
#if SWIGPYTHON
%typemap(out) std::vector<char> {
$result =
PyString_FromString
AndSize((const char*)&($1[0]),(int)($1.size()));
$result =
SWIG_FromCharPtr
AndSize((const char*)&($1[0]),(int)($1.size()));
}
%typemap(in) (const std::vector<char>& v)
{
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
return NULL;
}
char* buffer = PyString_AsString($input);
int length = PyString_Size($input);
char* buffer = NULL;
int length = 0;
SWIG_AsCharPtrAndSize($input, &buffer, &length, NULL);
$1 = std::vector<char>(buffer, buffer + length);
}
#if SWIGPYTHON
//for datetime in python
%{
#include <ctime>
#include <datetime.h>
%}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) timeval {
PyDateTime_IMPORT;
$1 = PyDateTime_Check($input) ? 1 : 0;
...
...
@@ -78,6 +78,7 @@ PListNode *allocate_plist_wrapper(plist_t plist, char should_keep_plist) {
timeval ret = {(int)mktime(&t), PyDateTime_DATE_GET_MICROSECOND($input)};
$1 = ret;
}
#endif
%apply SWIGTYPE *DYNAMIC { PList::Node* };
%apply SWIGTYPE *DYNAMIC { PList::Structure* };
...
...
@@ -127,9 +128,6 @@ static swig_type_info *Node_dynamic(void **ptr)
DYNAMIC_CAST(SWIGTYPE_p_PList__Node, Node_dynamic);
DYNAMIC_CAST(SWIGTYPE_p_PList__Structure, Node_dynamic);
#else
#endif
%rename(__assign__) *::operator=;
%rename(__getitem__) *::operator[];
...
...
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