From 2fc0520895845fe5e08007de7580474941421ef2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 28 Nov 2008 20:01:23 -0600 Subject: [PATCH] Fixed ReadFile sign-extending instead of zero-extending (bug 3449, r=ds). --- core/smn_filesystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/smn_filesystem.cpp b/core/smn_filesystem.cpp index 0d9a95c7..d178b8ce 100644 --- a/core/smn_filesystem.cpp +++ b/core/smn_filesystem.cpp @@ -754,10 +754,10 @@ static cell_t sm_ReadFile(IPluginContext *pContext, const cell_t *params) } else if (params[4] == 2) { - int16_t val; + uint16_t val; for (cell_t i = 0; i < params[3]; i++) { - if (fread(&val, sizeof(int16_t), 1, pFile) != 1) + if (fread(&val, sizeof(uint16_t), 1, pFile) != 1) { break; } @@ -766,10 +766,10 @@ static cell_t sm_ReadFile(IPluginContext *pContext, const cell_t *params) } else if (params[4] == 1) { - int8_t val; + uint8_t val; for (cell_t i = 0; i < params[3]; i++) { - if (fread(&val, sizeof(int8_t), 1, pFile) != 1) + if (fread(&val, sizeof(uint8_t), 1, pFile) != 1) { break; }