Normalize line endings and whitespace

This commit is contained in:
OpenCV Buildbot
2012-10-17 11:12:04 +04:00
committed by Andrey Kamaev
parent 0442bca235
commit 81f826db2b
1511 changed files with 258678 additions and 258624 deletions

View File

@@ -1,9 +1,9 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2007, Weta Digital Ltd
//
//
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -15,8 +15,8 @@
// distribution.
// * Neither the name of Weta Digital nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -56,35 +56,35 @@ parseString (string name, char c = '.')
StringVector r;
while (name.size() > 0)
{
size_t s = name.find (c);
string sec = name.substr (0, s);
{
size_t s = name.find (c);
string sec = name.substr (0, s);
//
// Strip spaces from beginning
//
//
// Strip spaces from beginning
//
while (sec.size() > 0 && sec[0] == ' ')
sec.erase (0, 1);
while (sec.size() > 0 && sec[0] == ' ')
sec.erase (0, 1);
//
// Strip spaces from end
//
//
// Strip spaces from end
//
while (sec.size() > 0 && sec[sec.size() - 1] == ' ')
sec.erase (sec.size() - 1);
while (sec.size() > 0 && sec[sec.size() - 1] == ' ')
sec.erase (sec.size() - 1);
r.push_back (sec);
r.push_back (sec);
//
// Strip off name including ending 'c'
//
//
// Strip off name including ending 'c'
//
if (s == name.npos)
name = "";
else
name = name.substr (s + 1);
}
if (s == name.npos)
name = "";
else
name = name.substr (s + 1);
}
return r;
}
@@ -103,8 +103,8 @@ viewNum (const string &view, const StringVector &multiView)
for (int i = 0; i < multiView.size(); ++i)
{
if (multiView[i] == view)
return i;
if (multiView[i] == view)
return i;
}
return -1;
@@ -117,15 +117,15 @@ string
defaultViewName (const StringVector &multiView)
{
if (multiView.size() > 0)
return multiView[0];
return multiView[0];
else
return "";
return "";
}
string
viewFromChannelName (const string &channel,
const StringVector &multiView)
const StringVector &multiView)
{
//
// Given the name of a channel, return the name of the view to
@@ -139,41 +139,41 @@ viewFromChannelName (const string &channel,
StringVector s = parseString (channel, '.');
if (s.size() == 0)
return ""; // nothing in, nothing out
return ""; // nothing in, nothing out
if (s.size() == 1)
{
//
// Return default view name.
// The rules say ALL channels with no periods
// in the name belong to the default view.
//
//
// Return default view name.
// The rules say ALL channels with no periods
// in the name belong to the default view.
//
return multiView[0];
return multiView[0];
}
else
{
//
// size >= 2 - the last part is the channel name,
// the next-to-last part is the view name.
// Check if that part of the name really is
// a valid view and, if it is, return it.
//
{
//
// size >= 2 - the last part is the channel name,
// the next-to-last part is the view name.
// Check if that part of the name really is
// a valid view and, if it is, return it.
//
const string &viewName = s[s.size() - 2];
const string &viewName = s[s.size() - 2];
if (viewNum (viewName, multiView) >= 0)
return viewName;
else
return ""; // not associated with any particular view
if (viewNum (viewName, multiView) >= 0)
return viewName;
else
return ""; // not associated with any particular view
}
}
ChannelList
channelsInView (const string & viewName,
const ChannelList & channelList,
const StringVector & multiView)
const ChannelList & channelList,
const StringVector & multiView)
{
//
// Return a list of all channels belonging to view viewName.
@@ -182,22 +182,22 @@ channelsInView (const string & viewName,
ChannelList q;
for (ChannelList::ConstIterator i = channelList.begin();
i != channelList.end();
++i)
i != channelList.end();
++i)
{
//
// Get view name for this channel
//
//
// Get view name for this channel
//
string view = viewFromChannelName (i.name(), multiView);
string view = viewFromChannelName (i.name(), multiView);
//
// Insert channel into q if it's a member of view viewName
//
//
// Insert channel into q if it's a member of view viewName
//
if (view == viewName)
q.insert (i.name(), i.channel());
if (view == viewName)
q.insert (i.name(), i.channel());
}
return q;
@@ -206,21 +206,21 @@ channelsInView (const string & viewName,
ChannelList
channelsInNoView (const ChannelList &channelList,
const StringVector &multiView)
const StringVector &multiView)
{
//
// Return a list of channels not associated with any named view.
//
return channelsInView ("", channelList, multiView);
return channelsInView ("", channelList, multiView);
}
bool
areCounterparts (const string &channel1,
const string &channel2,
const StringVector &multiView)
areCounterparts (const string &channel1,
const string &channel2,
const StringVector &multiView)
{
//
// Given two channels, return true if they are the same
@@ -229,54 +229,54 @@ areCounterparts (const string &channel1,
StringVector chan1 = parseString (channel1);
unsigned int size1 = chan1.size(); // number of SECTIONS in string
// name (not string length)
// name (not string length)
StringVector chan2 = parseString (channel2);
unsigned int size2 = chan2.size();
if (size1 == 0 || size2 == 0)
return false;
return false;
//
// channel1 and channel2 can't be counterparts
// if either channel is in no view.
//
if (size1 > 1 && viewNum (chan1[size1 - 2], multiView) == -1)
return false;
return false;
if (size2 > 1 && viewNum (chan2[size2 - 2], multiView) == -1)
return false;
return false;
if (viewFromChannelName (channel1, multiView) ==
viewFromChannelName (channel2, multiView))
viewFromChannelName (channel2, multiView))
{
//
// channel1 and channel2 are not counterparts
// if they are in the same view.
//
//
// channel1 and channel2 are not counterparts
// if they are in the same view.
//
return false;
return false;
}
if (size1 == 1)
{
//
// channel1 is a default channel - the channels will only be
// counterparts if channel2 is of the form <view>.<channel1>
//
{
//
// channel1 is a default channel - the channels will only be
// counterparts if channel2 is of the form <view>.<channel1>
//
return size2 == 2 && chan1[0] == chan2[1];
return size2 == 2 && chan1[0] == chan2[1];
}
if (size2 == 1)
{
//
// channel2 is a default channel - the channels will only be
// counterparts if channel1 is of the form <view>.<channel2>
//
//
// channel2 is a default channel - the channels will only be
// counterparts if channel1 is of the form <view>.<channel2>
//
return size1 == 2 && chan2[0] == chan1[1];
return size1 == 2 && chan2[0] == chan1[1];
}
//
@@ -286,12 +286,12 @@ areCounterparts (const string &channel1,
//
if (size1 != size2)
return false;
return false;
for(int i = 0; i < size1; ++i)
{
if (i != size1 - 2 && chan1[i] != chan2[i])
return false;
if (i != size1 - 2 && chan1[i] != chan2[i])
return false;
}
return true;
@@ -300,8 +300,8 @@ areCounterparts (const string &channel1,
ChannelList
channelInAllViews (const string &channelName,
const ChannelList &channelList,
const StringVector &multiView)
const ChannelList &channelList,
const StringVector &multiView)
{
//
// Given the name of a channel, return a
@@ -311,14 +311,14 @@ channelInAllViews (const string &channelName,
ChannelList q;
for (ChannelList::ConstIterator i=channelList.begin();
i != channelList.end();
++i)
i != channelList.end();
++i)
{
if (i.name() == channelName ||
areCounterparts (i.name(), channelName, multiView))
{
q.insert (i.name(), i.channel());
}
if (i.name() == channelName ||
areCounterparts (i.name(), channelName, multiView))
{
q.insert (i.name(), i.channel());
}
}
return q;
@@ -327,9 +327,9 @@ channelInAllViews (const string &channelName,
string
channelInOtherView (const string &channelName,
const ChannelList &channelList,
const StringVector &multiView,
const string &otherViewName)
const ChannelList &channelList,
const StringVector &multiView,
const string &otherViewName)
{
//
// Given the name of a channel in one view, return the
@@ -337,14 +337,14 @@ channelInOtherView (const string &channelName,
//
for (ChannelList::ConstIterator i=channelList.begin();
i != channelList.end();
++i)
i != channelList.end();
++i)
{
if (viewFromChannelName (i.name(), multiView) == otherViewName &&
areCounterparts (i.name(), channelName, multiView))
{
return i.name();
}
if (viewFromChannelName (i.name(), multiView) == otherViewName &&
areCounterparts (i.name(), channelName, multiView))
{
return i.name();
}
}
return "";
@@ -353,8 +353,8 @@ channelInOtherView (const string &channelName,
string
insertViewName (const string &channel,
const StringVector &multiView,
int i)
const StringVector &multiView,
int i)
{
//
// Insert multiView[i] into the channel name if appropriate.
@@ -363,16 +363,16 @@ insertViewName (const string &channel,
StringVector s = parseString (channel, '.');
if (s.size() == 0)
return ""; // nothing in, nothing out
return ""; // nothing in, nothing out
if (s.size() == 1 && i == 0)
{
//
// Channel in the default view, with no periods in its name.
// Do not insert view name.
//
//
// Channel in the default view, with no periods in its name.
// Do not insert view name.
//
return channel;
return channel;
}
//
@@ -383,10 +383,10 @@ insertViewName (const string &channel,
for (int j = 0; j < s.size(); ++j)
{
if (j < s.size() - 1)
newName += s[j] + ".";
else
newName += multiView[i] + "." + s[j];
if (j < s.size() - 1)
newName += s[j] + ".";
else
newName += multiView[i] + "." + s[j];
}
return newName;