Skip to content
Snippets Groups Projects
Commit 9d9bc96b authored by Jan Trávníček's avatar Jan Trávníček
Browse files

cleanup warnings

parent c95c9876
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
* CyclicStringCompare.cpp
*
* Created on: Oct 9, 2014
* Author: Radomír Polcáh */
* Author: Radomir Polach */
 
#include "CyclicStringCompare.h"
 
......@@ -11,7 +11,7 @@ namespace compare {
bool CyclicStringCompare::equals(const string::LinearString& u, const string::LinearString& v) {
int n = (int)u.getContent().size();
int i = -1, j = -1, k;
if (n != v.getContent().size()) return false;
if (n != (int) v.getContent().size()) return false;
 
while(i < n - 1 && j < n - 1)
{
......@@ -24,7 +24,7 @@ bool CyclicStringCompare::equals(const string::LinearString& u, const string::Li
}
 
int CyclicStringCompare::compare(const string::LinearString& u, const string::LinearString& v) {
int n = (int)u.getContent().size(), m = (int)v.getContent().size();
int n = (int) u.getContent().size(), m = (int)v.getContent().size();
int i = -1, j = -1, k;
 
bool last = 0;
......@@ -33,7 +33,8 @@ int CyclicStringCompare::compare(const string::LinearString& u, const string::Li
k = 1;
while(k <= n && u.getContent()[(i + k) % n] == v.getContent()[(j + k) % m]) k++;
if (k > n) return 0;
if (last = u.getContent()[(i + k) % n] > v.getContent()[(j + k) % m]) i += k; else j += k;
last = u.getContent()[(i + k) % n] > v.getContent()[(j + k) % m];
if (last) i += k; else j += k;
}
return last ? 1 : - 1;
}
......
......@@ -2,7 +2,7 @@
* CyclicStringCompare.h
*
* Created on: Oct 14, 2014
* Author: Radomír Polách
* Author: Radomir Polach
*/
 
#ifndef CYCLIC_STRING_COMPARE_H_
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment