openbsd-ports/games/numptyphysics/patches/patch-Array_h
dcoppa 3a96856ab4 Update to the latest svn snapshots:
numptyphysics -> 2010/09/16

npcomplete -> 2010/01/24

Kudos to sthen@ for mirroring the distfiles
2012-12-12 14:58:00 +00:00

27 lines
798 B
Plaintext

$OpenBSD: patch-Array_h,v 1.2 2012/12/12 14:58:00 dcoppa Exp $
--- Array.h.orig Wed Dec 5 17:20:19 2012
+++ Array.h Wed Dec 5 17:21:33 2012
@@ -32,18 +32,18 @@ class Array
Array( int n, const T* d ) : m_data(NULL), m_size(0), m_capacity(0)
{
- if ( n ) {
+ if ( n > 0 ) {
capacity( n );
- memcpy( m_data, d, n * sizeof(T) );
+ if ( m_data ) memcpy( m_data, d, n * sizeof(T) );
m_size = n;
}
}
Array( const Array& other ) : m_data(NULL), m_size(0), m_capacity(0)
{
- if ( other.size() ) {
+ if ( other.size() > 0 ) {
capacity( other.size() );
- memcpy( m_data, other.m_data, other.size() * sizeof(T) );
+ if ( m_data ) memcpy( m_data, other.m_data, other.size() * sizeof(T) );
m_size = other.size();
}
}