Kaydet (Commit) 70c1cf03 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1323912 Improper use of negative value

Change-Id: I7c403ccb40bfddee2e30ba10e755187490857596
üst 67f5012d
......@@ -630,9 +630,10 @@ void exportModuleStream(SvStream& rStrm, const OUString& rSourceCode, const OUSt
exportString(aModuleStream, "Attribute VB_Name = \"" + aElementName + "\"\r\n");
OUString aSourceCode = rSourceCode.replaceFirst("Option VBASupport 1\n", "");
sal_Int32 nPos = aSourceCode.indexOf("Rem Attribute VBA_ModuleType=");
sal_Int32 nEndPos = aSourceCode.indexOf("\n", nPos);
aSourceCode = aSourceCode.replaceAt(nPos, nEndPos - nPos+1, "");
const sal_Int32 nPos = aSourceCode.indexOf("Rem Attribute VBA_ModuleType=");
const sal_Int32 nEndPos = nPos != -1 ? aSourceCode.indexOf("\n", nPos) : -1;
if (nPos != -1 && nEndPos != -1)
aSourceCode = aSourceCode.replaceAt(nPos, nEndPos - nPos+1, "");
aSourceCode = aSourceCode.replaceAll("\n", "\r\n");
exportString(aModuleStream, aSourceCode);
aModuleStream.Seek(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment