Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: NotFound/winxedxx
base: 5403b0ae99
...
head fork: NotFound/winxedxx
compare: 429e7952b3
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
19 winxedxx_bytebuffer.cxx
@@ -31,6 +31,16 @@ WxxByteBuffer & WxxByteBuffer::set(int i)
return *this;
}
+WxxByteBuffer & WxxByteBuffer::set(const std::string & s)
+{
+ const int len = s.size();
+ set_integer_native(len + 1);
+ set_integer_native(len);
+ for (int i = 0; i < len; ++i)
+ p[i] = (unsigned char)s[i];
+ return *this;
+}
+
void WxxByteBuffer::set_integer_native(int i)
{
if (allocated_size) {
@@ -69,9 +79,8 @@ int WxxByteBuffer::get_integer_keyed(int i)
{
if (i < 0 || (size_t)i >= size)
return 0;
- else {
- return ((unsigned char *)get_pointer())[i];
- }
+ else
+ return p[i];
}
WxxObjectPtr WxxByteBuffer::get_pmc_keyed(int i)
@@ -82,7 +91,7 @@ WxxObjectPtr WxxByteBuffer::get_pmc_keyed(int i)
void WxxByteBuffer::set_integer_keyed(int i, int value)
{
if (i >= 0 && (size_t)i < size)
- ((char *)get_pointer())[i] = value;
+ p[i] = value;
}
void WxxByteBuffer::set_pmc_keyed(int i, const WxxObjectPtr &value)
@@ -97,7 +106,7 @@ void * WxxByteBuffer::get_pointer()
void WxxByteBuffer::set_pointer(void *ptr)
{
- p = ptr;
+ p = (unsigned char *)ptr;
}
} // namespace WinxedXX
View
3  winxedxx_bytebuffer.h
@@ -16,6 +16,7 @@ class WxxByteBuffer : public WxxDefault
int elements() const;
WxxByteBuffer & set(int i);
+ WxxByteBuffer & set(const std::string & s);
int get_integer_keyed(int i);
WxxObjectPtr get_pmc_keyed(int i);
void set_integer_native(int i);
@@ -25,7 +26,7 @@ class WxxByteBuffer : public WxxDefault
void * get_pointer();
void set_pointer(void *ptr);
private:
- void *p;
+ unsigned char *p;
size_t allocated_size;
size_t size;
};
View
5 winxedxx_ptr.cxx
@@ -18,6 +18,11 @@ WxxPtr::WxxPtr(void *ptr) : WxxDefault("Ptr"), p(ptr)
{
}
+int WxxPtr::get_integer()
+{
+ return p != 0;
+}
+
void * WxxPtr::get_pointer()
{
return p;
View
1  winxedxx_ptr.h
@@ -15,6 +15,7 @@ class WxxPtr : public WxxDefault
WxxPtr();
WxxPtr(void *ptr);
+ int get_integer();
void * get_pointer();
void set_pointer(void *ptr);
WxxObjectPtr call_method

No commit comments for this range

Something went wrong with that request. Please try again.