1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-10 21:33:38 +00:00

Fixed 32 bit compiler warnings, and fixed bug where serviceName could be undefined

This commit is contained in:
Bryan Roe
2020-11-10 02:08:06 -08:00
parent 4bc6ab6e3b
commit ef307c7843
6 changed files with 11 additions and 10 deletions

View File

@@ -1157,7 +1157,7 @@ void kvm_relay_StdOutHandler(ILibProcessPipe_Process sender, char *buffer, size_
{
if (bufferLen > 8)
{
if (bufferLen >= (8 + (int)ntohl(((unsigned int*)(buffer))[1])))
if (bufferLen >= (size_t)(8 + (int)ntohl(((unsigned int*)(buffer))[1])))
{
*bytesConsumed = 8 + (int)ntohl(((unsigned int*)(buffer))[1]);
writeHandler(buffer, (int)*bytesConsumed, reserved);

File diff suppressed because one or more lines are too long

View File

@@ -2979,7 +2979,7 @@ void ILibDuktape_ScriptContainer_Slave_OnReadStdIn(ILibProcessPipe_Pipe sender,
if (!ILibMemory_CanaryOK(sender)) { return; }
ILibDuktape_ScriptContainer_Slave *slave = (ILibDuktape_ScriptContainer_Slave*)((void**)ILibMemory_Extra(sender))[0];
if (bufferLen < 4 || bufferLen < ((int*)buffer)[0]) { return; }
if (bufferLen < 4 || bufferLen < (size_t)((int*)buffer)[0]) { return; }
ILibRemoteLogging_printf(ILibChainGetLogger(slave->chain), ILibRemoteLogging_Modules_Microstack_Generic, ILibRemoteLogging_Flags_VerbosityLevel_1, "Slave read: %d bytes", bufferLen);
#ifdef WIN32
@@ -3367,7 +3367,7 @@ void ILibDuktape_ScriptContainer_StdErrSink(ILibProcessPipe_Process sender, char
{
ILibDuktape_ScriptContainer_Master* master = (ILibDuktape_ScriptContainer_Master*)user;
if (bufferLen < 4 || bufferLen < ((int*)buffer)[0]) { return; }
if (bufferLen < 4 || bufferLen < (size_t)((int*)buffer)[0]) { return; }
*bytesConsumed = ((int*)buffer)[0];
#ifdef WIN32

View File

@@ -754,7 +754,7 @@ void ILibAsyncServerSocket_GetLocal(ILibAsyncServerSocket_ServerModule ServerSoc
size_t ILibAsyncServerSocket_GetConnections(ILibAsyncServerSocket_ServerModule server, ILibAsyncServerSocket_ConnectionToken *connections, size_t connectionsSize)
{
ILibAsyncServerSocketModule *mod = (ILibAsyncServerSocketModule*)server;
if (connections == NULL || connectionsSize < mod->MaxConnection) { return((size_t)mod->MaxConnection); }
if (connections == NULL || connectionsSize < (size_t)mod->MaxConnection) { return((size_t)mod->MaxConnection); }
int i;
size_t x = 0;
for (i = 0; i < mod->MaxConnection; ++i)

View File

@@ -890,10 +890,10 @@ __EXPORT_TYPE int ILibSimpleDataStore_GetEx(ILibSimpleDataStore dataStore, char*
}
if (centry != NULL)
{
if ((buffer != NULL) && (bufferLen >= centry->valueLength)) // If the buffer is not null and can hold the value, place the value in the buffer.
if ((buffer != NULL) && (bufferLen >= (size_t)centry->valueLength)) // If the buffer is not null and can hold the value, place the value in the buffer.
{
memcpy_s(buffer, bufferLen, centry->value, centry->valueLength);
if (bufferLen > centry->valueLength) { buffer[centry->valueLength] = 0; } // Add a zero at the end to be nice, if the buffer can take it.
if (bufferLen > (size_t)centry->valueLength) { buffer[centry->valueLength] = 0; } // Add a zero at the end to be nice, if the buffer can take it.
return(centry->valueLength);
}
@@ -921,13 +921,13 @@ __EXPORT_TYPE int ILibSimpleDataStore_GetEx(ILibSimpleDataStore dataStore, char*
}
if (entry == NULL) return 0; // If there is no in-memory entry for this key, return zero now.
if ((buffer != NULL) && (bufferLen >= entry->valueLength) && isCompressed == 0) // If the buffer is not null and can hold the value, place the value in the buffer.
if ((buffer != NULL) && (bufferLen >= (size_t)entry->valueLength) && isCompressed == 0) // If the buffer is not null and can hold the value, place the value in the buffer.
{
if (ILibSimpleDataStore_SeekPosition(root->dataFile, entry->valueOffset, SEEK_SET) != 0) return 0; // Seek to the position of the value in the data store
if (fread(buffer, 1, entry->valueLength, root->dataFile) == 0) return 0; // Read the value into the buffer
util_sha384(buffer, entry->valueLength, hash); // Compute the hash of the read value
if (memcmp(hash, entry->valueHash, SHA384HASHSIZE) != 0) return 0; // Check the hash, return 0 if not valid
if (bufferLen > entry->valueLength) { buffer[entry->valueLength] = 0; } // Add a zero at the end to be nice, if the buffer can take it.
if (bufferLen > (size_t)entry->valueLength) { buffer[entry->valueLength] = 0; } // Add a zero at the end to be nice, if the buffer can take it.
}
else if (isCompressed != 0)
{
@@ -959,7 +959,7 @@ __EXPORT_TYPE int ILibSimpleDataStore_GetEx(ILibSimpleDataStore dataStore, char*
}
}
return((bufferLen == 0 || bufferLen >= entry->valueLength) ? entry->valueLength : 0);
return((bufferLen == 0 || bufferLen >= (size_t)entry->valueLength) ? entry->valueLength : 0);
}
// Get the reference to the SHA384 hash value from the datastore for a given a key.

View File

@@ -95,6 +95,7 @@ function _meshName()
}
}
}
if (name == null) { name = 'Mesh Agent'; }
break;
default:
var service = require('service-manager').manager.enumerateService();