summaryrefslogtreecommitdiff
path: root/src/SMlibint.h
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-29 04:55:58 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-29 04:55:58 -0200
commit1dcf5502137efe36d01b30169d4387438ad47be0 (patch)
tree0bac65e122f51c1be7c5f1643c9ecda60566d9a2 /src/SMlibint.h
parent8bed01275a7c7caf8f777e4074a5ee1ba1c2b3e7 (diff)
avoid gcc warnings for libSM
Patch from http://bugs.freedesktop.org/show_bug.cgi?id=17968 adapted to current sources. This corrects a potential (hypothetical) segmentation fault.
Diffstat (limited to 'src/SMlibint.h')
-rw-r--r--src/SMlibint.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/SMlibint.h b/src/SMlibint.h
index 0569c3f..387f0bd 100644
--- a/src/SMlibint.h
+++ b/src/SMlibint.h
@@ -207,11 +207,9 @@ in this Software without prior written authorization from The Open Group.
#define STORE_ARRAY8(_pBuf, _len, _array8) \
{ \
STORE_CARD32 (_pBuf, _len); \
- if (_array8) \
- memcpy (_pBuf, _array8, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ if (_len) \
+ memcpy (_pBuf, _array8, _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define STORE_LISTOF_PROPERTY(_pBuf, _count, _props) \
@@ -244,9 +242,7 @@ in this Software without prior written authorization from The Open Group.
_array8 = (char *) malloc (_len + 1); \
memcpy (_array8, _pBuf, _len); \
_array8[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define EXTRACT_ARRAY8_AS_STRING(_pBuf, _swap, _string) \
@@ -256,9 +252,7 @@ in this Software without prior written authorization from The Open Group.
_string = (char *) malloc (_len + 1); \
memcpy (_string, _pBuf, _len); \
_string[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define EXTRACT_LISTOF_PROPERTY(_pBuf, _swap, _count, _props) \
@@ -290,9 +284,7 @@ in this Software without prior written authorization from The Open Group.
{ \
CARD32 _len; \
EXTRACT_CARD32 (_pBuf, _swap, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
+ _pBuf += _len + PAD64 (4 + _len); \
}
#define SKIP_LISTOF_PROPERTY(_pBuf, _swap) \