int FileInStream::overrun(int itemSize, int nItems, bool wait)
{
- if (itemSize > sizeof(b))
+ if (itemSize > (int)sizeof(b))
throw Exception("FileInStream overrun: max itemSize exceeded");
if (end - ptr != 0)
#ifdef RFB_HAVE_WINCRYPT
provider = 0;
if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, 0)) {
- if (GetLastError() == NTE_BAD_KEYSET) {
+ if (GetLastError() == (DWORD)NTE_BAD_KEYSET) {
if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
fprintf(stderr, "RandomStream: unable to create keyset\n");
provider = 0;
return -1;
}
- if (in->getend() - in->getptr() < size)
+ if (in->getend() - in->getptr() < (ptrdiff_t)size)
size = in->getend() - in->getptr();
in->readBytes(data, size);
void EncodeManager::logStats()
{
- int i, j;
+ size_t i, j;
unsigned rects;
unsigned long long pixels, bytes, equivalent;
Encoder *encoder;
struct RectInfo info;
- int divisor, maxColours;
+ unsigned int divisor, maxColours;
bool useRLE;
EncoderType type;
}
while (count) {
- int iter_count;
+ unsigned int iter_count;
iter_count = sizeof(rgb)/3;
if (iter_count > count)
if (!deferPending)
return true;
- if (msSince(&deferStart) >= deferUpdateTime)
+ if (msSince(&deferStart) >= (unsigned)deferUpdateTime)
return true;
return false;
static void doTests(const rfb::PixelFormat &dstpf,
const rfb::PixelFormat &srcpf)
{
- int i;
+ size_t i;
char dstb[256], srcb[256];
dstpf.print(dstb, sizeof(dstb));
static void doTests(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf)
{
- int i;
+ size_t i;
char dstb[256], srcb[256];
dstpf.print(dstb, sizeof(dstb));
int main(int argc, char **argv)
{
- int bufsize;
+ size_t bufsize;
time_t t;
char datebuffer[256];
- int i;
+ size_t i;
bufsize = fbsize * fbsize * 4;
fb1 = new rdr::U8[bufsize];
fb2 = new rdr::U8[bufsize];
- for (int i = 0;i < bufsize;i++) {
+ for (i = 0;i < bufsize;i++) {
fb1[i] = rand();
fb2[i] = rand();
}
{
OptionsDialog::removeCallback(handleOptions);
- for (int i = 0; i < sizeof(decoders)/sizeof(decoders[0]); i++)
+ for (size_t i = 0; i < sizeof(decoders)/sizeof(decoders[0]); i++)
delete decoders[i];
if (desktop)
if (CGGetActiveDisplayList(16, displays, &count) != kCGErrorSuccess)
return 1;
- if (count != Fl::screen_count())
+ if (count != (unsigned)Fl::screen_count())
return 1;
#ifdef HAVE_FLTK_FULLSCREEN_SCREENS
NSEvent *nsevent;
UInt16 key_code;
- int i;
+ size_t i;
NSString *chars;
UInt32 modifiers;
} else {
- for (int j = 0; j < sizeof(replaceMap)/sizeof(replaceMap[0]); j++) {
+ for (size_t j = 0; j < sizeof(replaceMap)/sizeof(replaceMap[0]); j++) {
if (val[i] == replaceMap[j].first) {
dest[pos] = '\\';
// Check for escape sequences
if (val[i] == '\\') {
- for (int j = 0; j < sizeof(replaceMap)/sizeof(replaceMap[0]); j++) {
+ for (size_t j = 0; j < sizeof(replaceMap)/sizeof(replaceMap[0]); j++) {
if (val[i+1] == replaceMap[j].second) {
dest[pos] = replaceMap[j].first;
escapedCharacter = true;
setKeyString("ServerName", servername, &hKey);
- for (int i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
+ for (size_t i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
if (dynamic_cast<StringParameter*>(parameterArray[i]) != NULL) {
setKeyString(parameterArray[i]->getName(), *(StringParameter*)parameterArray[i], &hKey);
} else if (dynamic_cast<IntParameter*>(parameterArray[i]) != NULL) {
int intValue = 0;
char stringValue[buffersize];
- for (int i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
+ for (size_t i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
if (dynamic_cast<StringParameter*>(parameterArray[i]) != NULL) {
if (getKeyString(parameterArray[i]->getName(), stringValue, buffersize, &hKey))
parameterArray[i]->setParam(stringValue);
if (encodeValue(servername, encodingBuffer, buffersize))
fprintf(f, "ServerName=%s\n", encodingBuffer);
- for (int i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
+ for (size_t i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
if (dynamic_cast<StringParameter*>(parameterArray[i]) != NULL) {
if (encodeValue(*(StringParameter*)parameterArray[i], encodingBuffer, buffersize))
fprintf(f, "%s=%s\n", ((StringParameter*)parameterArray[i])->getName(), encodingBuffer);
} else {
// Find and set the correct parameter
- for (int i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
+ for (size_t i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) {
if (dynamic_cast<StringParameter*>(parameterArray[i]) != NULL) {
if (strcasecmp(line, ((StringParameter*)parameterArray[i])->getName()) == 0) {
vlog.error("failed to get desktop item count: %ld", hr);
return false;
}
- for (unsigned int i=0; i<itemCount; i++) {
+ for (int i=0; i<itemCount; i++) {
if (enableItem(i, false))
restoreItems.insert(i);
}
id = 0;
if (!_ProcessIdToSessionId.isValid())
return;
- if (processId == -1)
+ if (processId == (DWORD)-1)
processId = GetCurrentProcessId();
if (!(*_ProcessIdToSessionId)(GetCurrentProcessId(), &id))
throw rdr::SystemException("ProcessIdToSessionId", GetLastError());
#ifdef RFB_HAVE_WINSTATION_CONNECT
if (!_WinStationConnect.isValid())
throw rdr::Exception("WinSta APIs missing");
- if (sessionId == -1)
+ if (sessionId == (DWORD)-1)
sessionId = mySessionId.id;
// Try to reconnect our session to the console
case IDC_HOSTS:
{
DWORD selected = SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_GETCURSEL, 0, 0);
- int count = SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_GETCOUNT, 0, 0);
- bool enable = selected != LB_ERR;
+ DWORD count = SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_GETCOUNT, 0, 0);
+ bool enable = selected != (DWORD)LB_ERR;
enableItem(IDC_HOST_REMOVE, enable);
enableItem(IDC_HOST_UP, enable && (selected > 0));
- enableItem(IDC_HOST_DOWN, enable && (selected < count-1));
+ enableItem(IDC_HOST_DOWN, enable && (selected+1 < count));
enableItem(IDC_HOST_EDIT, enable);
setChanged(isChanged());
}