1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 07:02:30 +01:00

Fix for non-gcc compilers

This commit is contained in:
dan
2000-03-30 04:52:43 +00:00
parent b40d52edd6
commit 5730c765c3
3 changed files with 17 additions and 9 deletions

View File

@@ -710,7 +710,7 @@ WMSendConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
{
int bytes, pos, len, totalTransfer;
TimeoutData *tPtr = &cPtr->sendTimeout;
const void *dataBytes;
const unsigned char *dataBytes;
wassertrv(cPtr->state!=WCNotConnected && cPtr->state!=WCListening, -1);
wassertrv(cPtr->state!=WCInProgress && cPtr->state!=WCFailed, -1);
@@ -733,7 +733,7 @@ WMSendConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
while (WMGetBagItemCount(cPtr->outputQueue) > 0) {
data = WMGetFromBag(cPtr->outputQueue, 0);
dataBytes = WMDataBytes(data);
dataBytes = (const unsigned char *)WMDataBytes(data);
len = WMGetDataLength(data);
pos = cPtr->bufPos; /* where we're left last time */
while(pos < len) {

View File

@@ -158,7 +158,9 @@ WMSetDataLength(WMData *aData, unsigned length) /*FOLD00*/
WMSetDataCapacity(aData, length);
}
if (length > aData->length) {
memset(aData->bytes + aData->length, 0, length - aData->length);
unsigned char *dataBytes = (unsigned char *)aData->bytes;
memset(dataBytes + aData->length, 0, length - aData->length);
}
aData->length = length;
}
@@ -202,10 +204,12 @@ WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length) /*FOLD00*
void
WMGetDataBytesWithRange(WMData *aData, void *buffer, WMRange aRange) /*FOLD00*/
{
unsigned char *dataBytes = (unsigned char *)aData->bytes;
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
memcpy(buffer, aData->bytes + aRange.position, aRange.count);
memcpy(buffer,dataBytes + aRange.position, aRange.count);
}
@@ -258,6 +262,7 @@ WMAppendDataBytes(WMData *aData, void *bytes, unsigned length) /*FOLD00*/
{
unsigned oldLength = aData->length;
unsigned newLength = oldLength + length;
unsigned char *dataBytes = (unsigned char *)aData->bytes;
if (newLength > aData->capacity) {
unsigned nextCapacity = aData->capacity + aData->growth;
@@ -272,7 +277,7 @@ WMAppendDataBytes(WMData *aData, void *bytes, unsigned length) /*FOLD00*/
WMSetDataCapacity(aData, nextCapacity);
aData->growth = nextGrowth;
}
memcpy(aData->bytes + oldLength, bytes, length);
memcpy(dataBytes + oldLength, bytes, length);
aData->length = newLength;
}
@@ -291,20 +296,24 @@ WMAppendData(WMData *aData, WMData *anotherData) /*FOLD00*/
void
WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes) /*FOLD00*/
{
unsigned char *dataBytes = (unsigned char *)aData->bytes;
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
memcpy(aData->bytes + aRange.position, bytes, aRange.count);
memcpy(dataBytes + aRange.position, bytes, aRange.count);
}
void
WMResetDataBytesInRange(WMData *aData, WMRange aRange) /*FOLD00*/
{
unsigned char *dataBytes = (unsigned char *)aData->bytes;
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
memset(aData->bytes + aRange.position, 0, aRange.count);
memset(dataBytes + aRange.position, 0, aRange.count);
}

View File

@@ -172,14 +172,13 @@ renderVGradient(unsigned width, unsigned height, int r0, int g0, int b0,
unsigned long r, g, b, dr, dg, db;
RImage *image;
unsigned char *ptr;
unsigned int *iptr;
unsigned char rr, gg, bb;
image = RCreateImage(width, height, False);
if (!image) {
return NULL;
}
iptr = (unsigned int*)ptr = image->data;
ptr = image->data;
r = r0<<16;
g = g0<<16;