From 5a7b589bb3a32d49d2a196fe277a0d51f6afa541 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 12 Jul 2017 21:32:14 +0200 Subject: nxcomp: Trivially fix local variables shadowing variables of same name from higher scope. --- nxcomp/src/ClientChannel.cpp | 52 +++++++++++++++--------------- nxcomp/src/Loop.cpp | 6 ++-- nxcomp/src/Proxy.cpp | 20 ++++++------ nxcomp/src/ServerChannel.cpp | 76 ++++++++++++++++++++++---------------------- 4 files changed, 77 insertions(+), 77 deletions(-) (limited to 'nxcomp') diff --git a/nxcomp/src/ClientChannel.cpp b/nxcomp/src/ClientChannel.cpp index 2a182e49f..f01ad6d7b 100644 --- a/nxcomp/src/ClientChannel.cpp +++ b/nxcomp/src/ClientChannel.cpp @@ -697,10 +697,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m *(clientCache_ -> convertSelectionAtomCache[i]), 9); nextSrc += 4; } - unsigned int timestamp = GetULONG(nextSrc, bigEndian_); - encodeBuffer.encodeValue(timestamp - + unsigned int _timestamp = GetULONG(nextSrc, bigEndian_); + encodeBuffer.encodeValue(_timestamp - clientCache_ -> convertSelectionLastTimestamp, 32, 4); - clientCache_ -> convertSelectionLastTimestamp = timestamp; + clientCache_ -> convertSelectionLastTimestamp = _timestamp; } break; case X_CopyArea: @@ -1372,10 +1372,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, clientCache_ -> cursorCache, 9); - unsigned int timestamp = GetULONG(inputMessage + 20, bigEndian_); - encodeBuffer.encodeValue(timestamp - + unsigned int _timestamp = GetULONG(inputMessage + 20, bigEndian_); + encodeBuffer.encodeValue(_timestamp - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp = timestamp; + clientCache_ -> grabKeyboardLastTimestamp = _timestamp; sequenceQueue_.push(clientSequence_, inputOpcode); @@ -1387,10 +1387,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); - unsigned int timestamp = GetULONG(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(timestamp - + unsigned int _timestamp = GetULONG(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(_timestamp - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp = timestamp; + clientCache_ -> grabKeyboardLastTimestamp = _timestamp; encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); @@ -3607,10 +3607,10 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length unsigned char *nextDest = outputMessage + 32; for (; numExtensions; numExtensions--) { - unsigned int length; - decodeBuffer.decodeValue(length, 8); - *nextDest++ = (unsigned char) length; - for (; length; length--) + unsigned int _length; + decodeBuffer.decodeValue(_length, 8); + *nextDest++ = (unsigned char) _length; + for (; _length; _length--) { decodeBuffer.decodeValue(value, 8); *nextDest++ = value; @@ -3655,13 +3655,13 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length unsigned char* nextDest = outputMessage + 32; for (; numFonts; numFonts--) { - unsigned int length; - decodeBuffer.decodeValue(length, 8); - *nextDest++ = (unsigned char)length; + unsigned int _length; + decodeBuffer.decodeValue(_length, 8); + *nextDest++ = (unsigned char)_length; // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, length); - nextDest += length; + decodeBuffer.decodeTextData(nextDest, _length); + nextDest += _length; } handleSave(messageStore, outputMessage, outputLength); @@ -3904,10 +3904,10 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length { unsigned int index; decodeBuffer.decodeValue(index, 4); - unsigned int length; + unsigned int _length; const unsigned char *data; - ServerCache::queryFontFontCache.get(index, length, data); - memcpy(nextDest, data, length); + ServerCache::queryFontFontCache.get(index, _length, data); + memcpy(nextDest, data, _length); end = 1; } @@ -3915,7 +3915,7 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length if (end == 0) { unsigned char *saveDest = nextDest; - unsigned int length = numProperties * 8 + numCharInfos * 12; + unsigned int _length = numProperties * 8 + numCharInfos * 12; for (; numProperties; numProperties--) { decodeBuffer.decodeValue(value, 32, 9); @@ -3930,7 +3930,7 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length nextDest += 12; } - ServerCache::queryFontFontCache.set(length, saveDest); + ServerCache::queryFontFontCache.set(_length, saveDest); } handleSave(messageStore, outputMessage, outputLength); @@ -7845,12 +7845,12 @@ void ClientChannel::handleDecodeCharInfo(DecodeBuffer &decodeBuffer, unsigned ch for (unsigned int i = 1; i < 5; i++) { - unsigned int value; + unsigned int _value; - decodeBuffer.decodeCachedValue(value, 16, + decodeBuffer.decodeCachedValue(_value, 16, *serverCache_ -> queryFontCharInfoCache[i], 6); - PutUINT(value, nextDest, bigEndian_); + PutUINT(_value, nextDest, bigEndian_); nextDest += 2; } diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index 238e503b7..f29fae530 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -6687,10 +6687,10 @@ int WaitForRemote(ChannelEndPoint &socketAddress) strcpy(hostLabel, "any host"); } - long bindPort; - if (socketAddress.getTCPHostAndPort(NULL, &bindPort)) + long _bindPort; + if (socketAddress.getTCPHostAndPort(NULL, &_bindPort)) { - socketAddress.setSpec(loopbackBind ? "localhost" : "*", bindPort); + socketAddress.setSpec(loopbackBind ? "localhost" : "*", _bindPort); } else { diff --git a/nxcomp/src/Proxy.cpp b/nxcomp/src/Proxy.cpp index 72b2cee21..32c32795c 100644 --- a/nxcomp/src/Proxy.cpp +++ b/nxcomp/src/Proxy.cpp @@ -1138,9 +1138,9 @@ int Proxy::handleRead() // the failure is detected. // - int result = channels_[channelId] -> handleWrite(message, dataLength); + int _result = channels_[channelId] -> handleWrite(message, dataLength); - if (result < 0 && finish == 0) + if (_result < 0 && finish == 0) { #ifdef TEST *logofs << "Proxy: Failed to write proxy data to FD#" @@ -5793,14 +5793,14 @@ void Proxy::setSplitTimeout(int channelId) for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { - int channelId = *j; + int _channelId = *j; - if (channels_[channelId] != NULL && - channels_[channelId] -> needSplit() == 1) + if (channels_[_channelId] != NULL && + channels_[_channelId] -> needSplit() == 1) { #ifdef TEST *logofs << "Proxy: SPLIT! Channel for FD#" - << getFd(channelId) << " still needs splits.\n" + << getFd(_channelId) << " still needs splits.\n" << logofs_flush; #endif @@ -5840,14 +5840,14 @@ void Proxy::setMotionTimeout(int channelId) for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { - int channelId = *j; + int _channelId = *j; - if (channels_[channelId] != NULL && - channels_[channelId] -> needMotion() == 1) + if (channels_[_channelId] != NULL && + channels_[_channelId] -> needMotion() == 1) { #ifdef TEST *logofs << "Proxy: SPLIT! Channel for FD#" - << getFd(channelId) << " still needs motions.\n" + << getFd(_channelId) << " still needs motions.\n" << logofs_flush; #endif diff --git a/nxcomp/src/ServerChannel.cpp b/nxcomp/src/ServerChannel.cpp index a560eca6d..830985295 100644 --- a/nxcomp/src/ServerChannel.cpp +++ b/nxcomp/src/ServerChannel.cpp @@ -501,13 +501,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m if (control -> LocalDeltaCompression == 0) { - int result = handleFastReadReply(encodeBuffer, requestOpcode, + int _result = handleFastReadReply(encodeBuffer, requestOpcode, inputMessage, inputLength); - if (result < 0) + if (_result < 0) { return -1; } - else if (result > 0) + else if (_result > 0) { continue; } @@ -790,9 +790,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m for (; numExtensions; numExtensions--) { - unsigned int length = (unsigned int) (*nextSrc++); + unsigned int _length = (unsigned int) (*nextSrc++); - encodeBuffer.encodeValue(length, 8); + encodeBuffer.encodeValue(_length, 8); #ifdef HIDE_MIT_SHM_EXTENSION @@ -913,13 +913,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m const unsigned char* nextSrc = inputMessage + 32; for (; numFonts; numFonts--) { - unsigned int length = (unsigned int) (*nextSrc++); - encodeBuffer.encodeValue(length, 8); + unsigned int _length = (unsigned int) (*nextSrc++); + encodeBuffer.encodeValue(_length, 8); // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, length); + encodeBuffer.encodeTextData(nextSrc, _length); - nextSrc += length; + nextSrc += _length; } priority_++; @@ -963,13 +963,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m encodeBuffer.encodeBoolValue(1); unsigned int numColors = ((inputLength - 32) >> 3); - const unsigned char *nextSrc = inputMessage + 40; + const unsigned char *nextSrc1 = inputMessage + 40; unsigned char *nextDest = (unsigned char *) inputMessage + 38; for (unsigned int c = 1; c < numColors; c++) { for (unsigned int i = 0; i < 6; i++) - *nextDest++ = *nextSrc++; - nextSrc += 2; + *nextDest++ = *nextSrc1++; + nextSrc1 += 2; } unsigned int colorsLength = numColors * 6; if (serverCache_ -> queryColorsLastReply.compare(colorsLength, @@ -977,13 +977,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m encodeBuffer.encodeBoolValue(1); else { - const unsigned char *nextSrc = inputMessage + 32; + const unsigned char *nextSrc2 = inputMessage + 32; encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(numColors, 16, 5); for (numColors *= 3; numColors; numColors--) { - encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); - nextSrc += 2; + encodeBuffer.encodeValue(GetUINT(nextSrc2, bigEndian_), 16); + nextSrc2 += 2; } } @@ -1299,13 +1299,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m if (control -> LocalDeltaCompression == 0) { - int result = handleFastReadReply(encodeBuffer, requestOpcode, + int _result = handleFastReadReply(encodeBuffer, requestOpcode, inputMessage, inputLength); - if (result < 0) + if (_result < 0) { return -1; } - else if (result > 0) + else if (_result > 0) { continue; } @@ -1522,13 +1522,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m if (control -> LocalDeltaCompression == 0) { - int result = handleFastReadEvent(encodeBuffer, inputOpcode, + int _result = handleFastReadEvent(encodeBuffer, inputOpcode, inputMessage, inputLength); - if (result < 0) + if (_result < 0) { return -1; } - else if (result > 0) + else if (_result > 0) { continue; } @@ -1620,10 +1620,10 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m serverCache_ -> buttonCache); else encodeBuffer.encodeValue((unsigned int) detail, 8); - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); unsigned int timestampDiff = - timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; + _timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeCachedValue(timestampDiff, 32, serverCache_ -> motionNotifyTimestampCache, 9); int skipRest = 0; @@ -1795,10 +1795,10 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m 29, serverCache_ -> propertyNotifyWindowCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> propertyNotifyAtomCache, 9); - unsigned int timestamp = GetULONG(inputMessage + 12, bigEndian_); + unsigned int _timestamp = GetULONG(inputMessage + 12, bigEndian_); unsigned int timestampDiff = - timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; + _timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[16]); } @@ -1819,9 +1819,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m break; case SelectionClear: { - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; + unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> selectionClearWindowCache, 9); @@ -1831,9 +1831,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m break; case SelectionRequest: { - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; + unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> selectionClearWindowCache, 9); @@ -5669,9 +5669,9 @@ int ServerChannel::handleMotion(EncodeBuffer &encodeBuffer) serverCache_ -> buttonCache); else encodeBuffer.encodeValue((unsigned int) detail, 8); - unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; + unsigned int _timestamp = GetULONG(buffer + 4, bigEndian_); + unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeCachedValue(timestampDiff, 32, serverCache_ -> motionNotifyTimestampCache, 9); int skipRest = 0; @@ -7910,11 +7910,11 @@ void ServerChannel::handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuf for (unsigned int i = 1; i < 5; i++) { - unsigned int value = GetUINT(nextSrc, bigEndian_); + unsigned int _value = GetUINT(nextSrc, bigEndian_); nextSrc += 2; - encodeBuffer.encodeCachedValue(value, 16, + encodeBuffer.encodeCachedValue(_value, 16, *serverCache_ -> queryFontCharInfoCache[i], 6); } } -- cgit v1.2.3