diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-23 12:32:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-23 12:32:34 +0000 |
commit | f0ff6972eb5fecda4218fcea6686194f1b52e704 (patch) | |
tree | b60680c9ca6f7c5fd8b57a7760c625e0371e05f5 | |
parent | 8788bb35e10ef5403a08388d33ed4ab2ff7d67df (diff) |
various warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@5095 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/HTTPServer/src/FileShareNode.cpp | 4 | ||||
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 2 | ||||
-rw-r--r-- | plugins/HTTPServer/src/HttpUser.cpp | 2 | ||||
-rw-r--r-- | plugins/IEView/src/ChatHTMLBuilder.cpp | 4 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/namereplacing.cpp | 102 | ||||
-rw-r--r-- | plugins/Utils/mir_smileys.cpp | 2 | ||||
-rw-r--r-- | plugins/YahooGroups/src/utils.cpp | 8 |
7 files changed, 62 insertions, 62 deletions
diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index d2e9f62731..a5b57ecc14 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -207,11 +207,11 @@ bool CLFileShareNode::bSetPaths(char * pszSrvPath, char * pszRealPath) { delete [] st.pszSrvPath;
delete [] st.pszRealPath;
- st.dwMaxSrvPath = strlen(pszSrvPath) + 1;
+ st.dwMaxSrvPath = (int)strlen(pszSrvPath) + 1;
st.pszSrvPath = new char[ st.dwMaxSrvPath ];
strcpy(st.pszSrvPath, pszSrvPath);
- int nRealLen = strlen(pszRealPath);
+ int nRealLen = (int)strlen(pszRealPath);
if (nRealLen <= 2 || !(pszRealPath[1] == ':' ||
(pszRealPath[0] == '\\' && pszRealPath[1] == '\\'))) {
// Relative path
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 9af17158e9..be3233c174 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -63,7 +63,7 @@ string sPageKeyword = szDefaultPageKeyword; void ReplaceAll(string &sSrc, const char * pszReplace, const string &sNew) {
string::size_type nCur = 0;
- int nRepalceLen = strlen(pszReplace);
+ int nRepalceLen = (int)strlen(pszReplace);
while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) {
sSrc.replace(nCur, nRepalceLen, sNew);
nCur += sNew.size();
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index 475765f495..a565289ba7 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -183,7 +183,7 @@ bool CLHttpUser::bReadGetParameters(char * pszRequest) { pszRequest[0] = 0;
pszRequest++;
for (int nCur = 0; nCur < eLastParam ; nCur++) {
- int nLen = strlen(szParmStr[nCur]);
+ int nLen = (int)strlen(szParmStr[nCur]);
if (strncmp(pszRequest, szParmStr[nCur], nLen) == 0) {
if (apszParam[nCur]) {
bRet = false;
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index eb6ff7eaeb..f449cc0c4c 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -165,7 +165,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) //DWORD dwFlags = eventData->dwFlags;
const char *iconFile = "";
DWORD dwData = eventData->dwData;
- int isSent = eventData->bIsMe;
+ bool isSent = eventData->bIsMe != 0;
int outputSize = 0;
char *output = NULL;
const char *className = "";
@@ -184,7 +184,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) if (eventData->iType == IEED_GC_EVENT_MESSAGE) {
iconFile = isSent ? "message_out_chat.gif" : "message_in_chat.gif";
- showIcon = iconFlags & (isSent ? GC_EVENT_MESSAGE : GC_EVENT_MESSAGE);
+ showIcon = (iconFlags & (isSent ? GC_EVENT_MESSAGE : GC_EVENT_MESSAGE)) != 0;
className = isSent ? "messageOut" : "messageIn";
}
else {
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 622126ff64..757a55f0b9 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -53,11 +53,11 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in }
}
i=0;
- *lengthOfWord = strlen(word)+strlen(CloseDivider)+strlen(OpenDivider);
+ *lengthOfWord = (int)(strlen(word)+strlen(CloseDivider)+strlen(OpenDivider));
/* find the word in the line */
while (i < (strlen(line) - strlen(word))) {
if (!strncmp(&line[i], word, strlen(word))) {
- if (!flag) return i + strlen(word); /* the next char after the word */
+ if (!flag) return i + (int)strlen(word); /* the next char after the word */
else return i; /* the char before the word */
}
i++;
@@ -76,16 +76,16 @@ int findLine(char* FileContents[], const char* string, int linesInFile,int start // check if its a number
if (i != -1) {
- *positionInOldString += strlen(_itoa(i,tmp,10)) - 1;
+ *positionInOldString += (int)strlen(_itoa(i,tmp,10)) - 1;
return i;
}
// lastline
if (!strncmp(&string[*positionInOldString], Translate("lastline("), strlen(Translate("lastline(")))) {
- *positionInOldString += strlen(Translate("lastline("));
+ *positionInOldString += (int)strlen(Translate("lastline("));
i = getNumber(&string[*positionInOldString]);
if ( i != -1) {
- *positionInOldString += strlen(_itoa(i,tmp,10));
+ *positionInOldString += (int)strlen(_itoa(i,tmp,10));
return linesInFile - (i+1);
}
@@ -111,14 +111,14 @@ int findLine(char* FileContents[], const char* string, int linesInFile,int start }
i = -1;
}
- *positionInOldString += strlen(string2Find) + strlen(Translate("\"\")"));
+ *positionInOldString += (int)(strlen(string2Find) + strlen(Translate("\"\")")));
if (i==-1) return i;
// allow for a +- after the word to go up or down lines
if (string[*positionInOldString] == '+') {
*positionInOldString += 1;
j = getNumber(&string[*positionInOldString]);
if (j != -1) {
- *positionInOldString += strlen(_itoa(j,tmp,10))-2;
+ *positionInOldString += (int)strlen(_itoa(j,tmp,10))-2;
return i+j;
}
}
@@ -126,7 +126,7 @@ int findLine(char* FileContents[], const char* string, int linesInFile,int start *positionInOldString+=1;
j = getNumber(&string[*positionInOldString]);
if (j != -1) {
- *positionInOldString += strlen(_itoa(j,tmp,10))-2;
+ *positionInOldString += (int)strlen(_itoa(j,tmp,10))-2;
return i-j;
}
}
@@ -144,7 +144,7 @@ int findChar(char* FileContents[], const char* string, int linesInFile,int start int i = getNumber(&string[*positionInOldString]);
// check if its a number
if (i != -1) {
- *positionInOldString += strlen(_itoa(i,tmp,10)) - 1;
+ *positionInOldString += (int)strlen(_itoa(i,tmp,10)) - 1;
return i;
}
@@ -165,15 +165,15 @@ int findChar(char* FileContents[], const char* string, int linesInFile,int start if (j==strlen(FileContents[startLine]))
return -1;
- *positionInOldString += strlen(string2Find)+1;
- return (startEnd) ? j : j+strlen(string2Find);
+ *positionInOldString += (int)strlen(string2Find)+1;
+ return (startEnd) ? j : j + (int)strlen(string2Find);
}
// csv(
if (!strncmp(&string[*positionInOldString], Translate("csv("), strlen(Translate("csv(")))) {
char seperator;
int j=0, k=startChar;
- *positionInOldString += strlen(Translate("csv("));
+ *positionInOldString += (int)strlen(Translate("csv("));
if (!strncmp(&string[*positionInOldString], "tab", 3)) {
*positionInOldString += 3;
seperator = '\t';
@@ -188,8 +188,8 @@ int findChar(char* FileContents[], const char* string, int linesInFile,int start }
i = getNumber(&string[*positionInOldString]);
if ( i == -1) return -1;
- *positionInOldString += strlen(_itoa(i,tmp,10));
- while (j<i) {
+ *positionInOldString += (int)strlen(_itoa(i,tmp,10));
+ while (j < i) {
if (FileContents[startLine][k] == '\0') break;
if (FileContents[startLine][k] == seperator)
j++;
@@ -204,17 +204,17 @@ int findChar(char* FileContents[], const char* string, int linesInFile,int start void checkStringForcompare(char *str)
{
char *A,*B, *X, *Y , *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str);
- unsigned int i, j=0, s=strlen(str);
+ unsigned int i, j = 0, s = (int)strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("compare(\""))) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], Translate("compare(\""), strlen(Translate("compare(\"")))) {
- i += strlen(Translate("compare(\""));
+ i += (int)strlen(Translate("compare(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, "\",\"");
X = strtok(NULL, "\",\"");
Y = strtok(NULL, ",\")");
- j = Y - ©OfStr[i] + strlen(Y)+1;
+ j = Y - ©OfStr[i] + (int)strlen(Y)+1;
if (A && B && X && Y)
{
if (!strcmp(A,B))
@@ -235,15 +235,15 @@ void checkStringForcompare(char *str) void checkStringForSave(HANDLE hContact, char* str)
{
char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
- unsigned int i, j=0, s=strlen(str);
+ unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("save(\""))) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], Translate("save(\""), strlen(Translate("save(\"")))) {
- i += strlen(Translate("save(\""));
+ i += (int)strlen(Translate("save(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\")");
- j = B - ©OfStr[i] + strlen(B)+1;
+ j = B - ©OfStr[i] + (int)strlen(B)+1;
if (A && B)
db_set_s(hContact, MODNAME, A, B);
@@ -261,14 +261,14 @@ void checkStringForSave(HANDLE hContact, char* str) void checkStringForLoad(HANDLE hContact, char* str)
{
char *A,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
- unsigned int i, j=0, s=strlen(str);
+ unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("load(\""))) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], Translate("load(\""), strlen(Translate("load(\"")))) {
- i += strlen(Translate("load(\""));
+ i += (int)strlen(Translate("load(\""));
A = strtok(©OfStr[i], "\")");
- j = A - ©OfStr[i] + strlen(A)+1;
+ j = A - ©OfStr[i] + (int)strlen(A)+1;
if (A) {
DBVARIANT dbv;
if ( !db_get_s(hContact, MODNAME, A, &dbv)) {
@@ -290,17 +290,17 @@ void checkStringForLoad(HANDLE hContact, char* str) void checkStringForSaveN(char* str)
{
char *A,*B,*C,*D,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
- unsigned int i, j=0, s=strlen(str);
+ unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("saveN(\""))) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], Translate("saveN(\""), strlen(Translate("saveN(\"")))) {
- i += strlen(Translate("saveN(\""));
+ i += (int)strlen(Translate("saveN(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\"");
C = strtok(NULL, ",\"");
D = strtok(NULL, ",\")");
- j = D - ©OfStr[i] + strlen(D)+1;
+ j = D - ©OfStr[i] + (int)strlen(D)+1;
if (A && B && C && D) {
switch (D[0]) {
case '0':
@@ -335,15 +335,15 @@ void checkStringForSaveN(char* str) void checkStringForLoadN(char* str)
{
char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str), temp[32];
- unsigned int i, j=0, s=strlen(str);
+ unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("loadN(\""))) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], Translate("loadN(\""), strlen(Translate("loadN(\"")))) {
- i += strlen(Translate("loadN(\""));
+ i += (int)strlen(Translate("loadN(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\")");
- j = B - ©OfStr[i] + strlen(B)+1;
+ j = B - ©OfStr[i] + (int)strlen(B)+1;
if (A && B) {
DBVARIANT dbv;
if ( !db_get(NULL, A, B, &dbv)) {
@@ -423,7 +423,7 @@ int lastChecked(char *newStr, const char *str) CloseHandle(hFile);
strcat(newStr, tszFileName);
_snprintf(tszFileName, MAX_PATH, "%s%d))", szPattern, file);
- return strlen(tszFileName);
+ return (int)strlen(tszFileName);
}
CloseHandle(hFile);
}
@@ -459,7 +459,7 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) // load the file... must be first
if (!strncmp(&oldString[positionInOldString], var_file, strlen(var_file)))
{
- positionInOldString += strlen(var_file);
+ positionInOldString += (int)strlen(var_file);
// check if its a number
tempInt = getNumber(&oldString[positionInOldString]);
if (tempInt == -1)
@@ -470,23 +470,24 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) }
// read the file
linesInFile = readFileIntoArray(tempInt, fileContents);
- if (linesInFile == 0) return ERROR_NO_FILE;
- positionInOldString += strlen(_itoa(tempInt, tempString,10)) + 1; // +1 for the closing )
+ if (linesInFile == 0)
+ return ERROR_NO_FILE;
+ positionInOldString += (int)strlen(_itoa(tempInt, tempString,10)) + 1; // +1 for the closing )
// wholeline()
if (!strncmp(&oldString[positionInOldString], Translate("wholeline(line("), strlen(Translate("wholeline(line("))))
{
- positionInOldString += strlen(Translate("wholeline(line("));
+ positionInOldString += (int)strlen(Translate("wholeline(line("));
tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
- if (tempInt == -1|| !fileContents[tempInt])
+ if (tempInt == -1 || !fileContents[tempInt])
return ERROR_NO_LINE_AFTER_VAR_F;
- else wholeLine =tempInt;
+ wholeLine = tempInt;
positionInOldString += 3; // add 2 for the )) for wholeline(line())
}
if (!strncmp(&oldString[positionInOldString], Translate("start("), strlen(Translate("start("))))
{
- positionInOldString += strlen(Translate("start(line("));
+ positionInOldString += (int)strlen(Translate("start(line("));
tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
if (tempInt == -1 || !fileContents[tempInt])
return ERROR_NO_LINE_AFTER_VAR_F;
@@ -494,29 +495,28 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) {
positionInOldString+=2;
startLine = tempInt;
- if (!endChar ) endChar = strlen(fileContents[startLine]);
+ if (!endChar)
+ endChar = (int)strlen(fileContents[startLine]);
tempInt = findChar(fileContents,oldString, linesInFile, startLine,&positionInOldString, startChar,0);
if (tempInt == -1)
return ERROR_NO_LINE_AFTER_VAR_F;
- else startChar = tempInt;
+ startChar = tempInt;
}
positionInOldString += 2; // add 2 for the )) for start(line())
}
if (!strncmp(&oldString[positionInOldString], Translate("end("), strlen(Translate("end("))))
{
- positionInOldString += strlen(Translate("end(line("));
+ positionInOldString += (int)strlen(Translate("end(line("));
tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
if (tempInt == -1 || !fileContents[tempInt])
return ERROR_NO_LINE_AFTER_VAR_F;
- else
- {
- positionInOldString+=2;
- endLine = tempInt;
- tempInt = findChar(fileContents,oldString, linesInFile, startLine,&positionInOldString, startChar,1);
- if (tempInt == -1)
- return ERROR_NO_LINE_AFTER_VAR_F;
- else endChar = tempInt;
- }
+
+ positionInOldString+=2;
+ endLine = tempInt;
+ tempInt = findChar(fileContents,oldString, linesInFile, startLine,&positionInOldString, startChar,1);
+ if (tempInt == -1)
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ endChar = tempInt;
positionInOldString += 2; // add 2 for the )) for end(line())
}
// check for both start() and end() otherwise, only copying 1 line
@@ -547,7 +547,7 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) // filename()
else if (!strncmp(&oldString[positionInOldString], Translate("filename("), strlen(Translate("filename("))))
{
- positionInOldString += strlen(Translate("filename("));
+ positionInOldString += (int)strlen(Translate("filename("));
tempInt = getNumber(&oldString[positionInOldString]);
if (tempInt == -1)
{
@@ -559,7 +559,7 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) if (db_get_static(NULL, MODNAME,tempString, tempString))
strcat(newString, tempString);
else return ERROR_NO_FILE;
- positionInOldString += strlen(_itoa(tempInt, tempString, 10))+1;
+ positionInOldString += (int)strlen(_itoa(tempInt, tempString, 10))+1;
}
}
// lastchecked(file(X))
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index e512273c17..f8db3fbbd9 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -134,7 +134,7 @@ int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT int ret;
if (nCount < 0)
- nCount = _tcslen(lpString);
+ nCount = (int)_tcslen(lpString);
// Get parse info
if (parseInfo == NULL)
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index fce73b4936..f86520019a 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -141,7 +141,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, if (db_get_s(hContact, szModule, szSettingName, &dbv) == 0)
{
res = 0;
- int tmp = strlen(dbv.pszVal);
+ int tmp = (int)strlen(dbv.pszVal);
len = (tmp < size - 1) ? tmp : size - 1;
strncpy(szResult, dbv.pszVal, len);
szResult[len] = '\0';
@@ -151,7 +151,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, res = 1;
if (szError)
{
- int tmp = strlen(szError);
+ int tmp = (int)strlen(szError);
len = (tmp < size - 1) ? tmp : size - 1;
strncpy(szResult, szError, len);
szResult[len] = '\0';
@@ -174,7 +174,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, if (dbv.type != DBVT_WCHAR)
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count);
else {
- int tmp = wcslen(dbv.pwszVal);
+ int tmp = (int)wcslen(dbv.pwszVal);
len = (tmp < count - 1) ? tmp : count - 1;
wcsncpy(szResult, dbv.pwszVal, len);
szResult[len] = L'\0';
@@ -184,7 +184,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, else {
res = 1;
if (szError) {
- int tmp = wcslen(szError);
+ int tmp = (int)wcslen(szError);
len = (tmp < count - 1) ? tmp : count - 1;
wcsncpy(szResult, szError, len);
szResult[len] = L'\0';
|