Skip to content

Commit

Permalink
Don't compare differently-signed types
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Dec 15, 2019
1 parent 99565bb commit e502f97
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ void Clip::SetJsonValue(Json::Value root) {
effects.clear();

// loop through effects
for (int x = 0; x < root["effects"].size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < root["effects"].size(); x++) {
// Get each effect
Json::Value existing_effect = root["effects"][x];

Expand Down
4 changes: 2 additions & 2 deletions src/FFmpegWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void FFmpegWriter::WriteFrame(std::shared_ptr<Frame> frame) {
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::WriteFrame", "frame->number", frame->number, "spooled_video_frames.size()", spooled_video_frames.size(), "spooled_audio_frames.size()", spooled_audio_frames.size(), "cache_size", cache_size, "is_writing", is_writing);

// Write the frames once it reaches the correct cache size
if (spooled_video_frames.size() == cache_size || spooled_audio_frames.size() == cache_size) {
if ((int)spooled_video_frames.size() == cache_size || (int)spooled_audio_frames.size() == cache_size) {
// Is writer currently writing?
if (!is_writing)
// Write frames to video file
Expand Down Expand Up @@ -1083,7 +1083,7 @@ AVStream *FFmpegWriter::add_audio_stream() {


// Set a valid number of channels (or throw error)
int channel_layout = info.channel_layout;
const uint64_t channel_layout = info.channel_layout;
if (codec->channel_layouts) {
int i;
for (i = 0; codec->channel_layouts[i] != 0; i++)
Expand Down
4 changes: 2 additions & 2 deletions src/FrameMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void FrameMapper::Init()
int64_t start_samples_frame = 1;
int start_samples_position = 0;

for (int64_t field = 1; field <= fields.size(); field++)
for (std::vector<Field>::size_type field = 1; field <= fields.size(); field++)
{
// Get the current field
Field f = fields[field - 1];
Expand Down Expand Up @@ -337,7 +337,7 @@ MappedFrame FrameMapper::GetMappedFrame(int64_t TargetFrameNumber)
// frame too small, return error
throw OutOfBoundsFrame("An invalid frame was requested.", TargetFrameNumber, frames.size());

else if (TargetFrameNumber > frames.size())
else if (TargetFrameNumber > (int64_t)frames.size())
// frame too large, set to end frame
TargetFrameNumber = frames.size();

Expand Down
16 changes: 8 additions & 8 deletions src/KeyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void Keyframe::AddPoint(double x, double y, InterpolationType interpolate)
// Get the index of a point by matching a coordinate
int64_t Keyframe::FindIndex(Point p) const {
// loop through points, and find a matching coordinate
for (int64_t x = 0; x < Points.size(); x++) {
for (std::vector<Point>::size_type x = 0; x < Points.size(); x++) {
// Get each point
Point existing_point = Points[x];

Expand Down Expand Up @@ -333,7 +333,7 @@ Json::Value Keyframe::JsonValue() const {
root["Points"] = Json::Value(Json::arrayValue);

// loop through points, and find a matching coordinate
for (int x = 0; x < Points.size(); x++) {
for (std::vector<Point>::size_type x = 0; x < Points.size(); x++) {
// Get each point
Point existing_point = Points[x];
root["Points"].append(existing_point.JsonValue());
Expand Down Expand Up @@ -509,7 +509,7 @@ double Keyframe::GetDelta(int64_t index) const {
// Get a point at a specific index
Point const & Keyframe::GetPoint(int64_t index) const {
// Is index a valid point?
if (index >= 0 && index < Points.size())
if (index >= 0 && index < (int64_t)Points.size())
return Points[index];
else
// Invalid index
Expand All @@ -532,7 +532,7 @@ int64_t Keyframe::GetCount() const {
// Remove a point by matching a coordinate
void Keyframe::RemovePoint(Point p) {
// loop through points, and find a matching coordinate
for (int64_t x = 0; x < Points.size(); x++) {
for (std::vector<Point>::size_type x = 0; x < Points.size(); x++) {
// Get each point
Point existing_point = Points[x];

Expand All @@ -551,7 +551,7 @@ void Keyframe::RemovePoint(Point p) {
// Remove a point by index
void Keyframe::RemovePoint(int64_t index) {
// Is index a valid point?
if (index >= 0 && index < Points.size())
if (index >= 0 && index < (int64_t)Points.size())
{
// Remove a specific point by index
Points.erase(Points.begin() + index);
Expand Down Expand Up @@ -581,7 +581,7 @@ void Keyframe::PrintValues() const {
cout << fixed << setprecision(4);
cout << "Frame Number (X)\tValue (Y)\tIs Increasing\tRepeat Numerator\tRepeat Denominator\tDelta (Y Difference)\n";

for (uint64_t i = 1; i < GetLength(); ++i) {
for (int64_t i = 1; i < GetLength(); ++i) {
cout << i << "\t" << GetValue(i) << "\t" << IsIncreasing(i) << "\t" ;
cout << GetRepeatFraction(i).num << "\t" << GetRepeatFraction(i).den << "\t" << GetDelta(i) << "\n";
}
Expand All @@ -597,15 +597,15 @@ void Keyframe::ScalePoints(double scale)
// TODO: What if scale < 0?

// Loop through each point (skipping the 1st point)
for (int64_t point_index = 1; point_index < Points.size(); point_index++) {
for (std::vector<Point>::size_type point_index = 1; point_index < Points.size(); point_index++) {
// Scale X value
Points[point_index].co.X = round(Points[point_index].co.X * scale);
}
}

// Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...)
void Keyframe::FlipPoints() {
for (int64_t point_index = 0, reverse_index = Points.size() - 1; point_index < reverse_index; point_index++, reverse_index--) {
for (std::vector<Point>::size_type point_index = 0, reverse_index = Points.size() - 1; point_index < reverse_index; point_index++, reverse_index--) {
// Flip the points
using std::swap;
swap(Points[point_index].co.Y, Points[reverse_index].co.Y);
Expand Down
16 changes: 8 additions & 8 deletions src/Timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
for (int64_t frame_number = requested_frame; frame_number < requested_frame + minimum_frames; frame_number++)
{
// Loop through clips
for (int clip_index = 0; clip_index < nearby_clips.size(); clip_index++)
for (std::vector<Clip>::size_type clip_index = 0; clip_index < nearby_clips.size(); clip_index++)
{
// Get clip object from the iterator
Clip *clip = nearby_clips[clip_index];
Expand Down Expand Up @@ -832,7 +832,7 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
ZmqLogger::Instance()->AppendDebugMethod("Timeline::GetFrame (Loop through clips)", "frame_number", frame_number, "clips.size()", clips.size(), "nearby_clips.size()", nearby_clips.size());

// Find Clips near this time
for (int clip_index = 0; clip_index < nearby_clips.size(); clip_index++)
for (std::vector<Clip>::size_type clip_index = 0; clip_index < nearby_clips.size(); clip_index++)
{
// Get clip object from the iterator
Clip *clip = nearby_clips[clip_index];
Expand All @@ -850,7 +850,7 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
// Determine if clip is "top" clip on this layer (only happens when multiple clips are overlapping)
bool is_top_clip = true;
float max_volume = 0.0;
for (int top_clip_index = 0; top_clip_index < nearby_clips.size(); top_clip_index++)
for (std::vector<Clip>::size_type top_clip_index = 0; top_clip_index < nearby_clips.size(); top_clip_index++)
{
Clip *nearby_clip = nearby_clips[top_clip_index];
long nearby_clip_start_position = round(nearby_clip->Position() * info.fps.ToDouble()) + 1;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ void Timeline::SetJsonValue(Json::Value root) {
clips.clear();

// loop through clips
for (int x = 0; x < root["clips"].size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < root["clips"].size(); x++) {
// Get each clip
Json::Value existing_clip = root["clips"][x];

Expand All @@ -1089,7 +1089,7 @@ void Timeline::SetJsonValue(Json::Value root) {
effects.clear();

// loop through effects
for (int x = 0; x < root["effects"].size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < root["effects"].size(); x++) {
// Get each effect
Json::Value existing_effect = root["effects"][x];

Expand Down Expand Up @@ -1144,7 +1144,7 @@ void Timeline::ApplyJsonDiff(std::string value) {
try
{
// Process the JSON change array, loop through each item
for (int x = 0; x < root.size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < root.size(); x++) {
// Get each change
Json::Value change = root[x];
std::string root_key = change["key"][(uint)0].asString();
Expand Down Expand Up @@ -1180,7 +1180,7 @@ void Timeline::apply_json_to_clips(Json::Value change) {
Clip *existing_clip = NULL;

// Find id of clip (if any)
for (int x = 0; x < change["key"].size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < change["key"].size(); x++) {
// Get each change
Json::Value key_part = change["key"][x];

Expand Down Expand Up @@ -1308,7 +1308,7 @@ void Timeline::apply_json_to_effects(Json::Value change) {
EffectBase *existing_effect = NULL;

// Find id of an effect (if any)
for (int x = 0; x < change["key"].size(); x++) {
for (Json::Value::ArrayIndex x = 0; x < change["key"].size(); x++) {
// Get each change
Json::Value key_part = change["key"][x];

Expand Down
2 changes: 1 addition & 1 deletion src/effects/Wave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ std::shared_ptr<Frame> Wave::GetFrame(std::shared_ptr<Frame> frame, int64_t fram
float waveformVal = sin((Y * wavelength_value) + (time * speed_y_value)); // Waveform algorithm on y-axis
float waveVal = (waveformVal + shift_x_value) * noiseAmp; // Shifts pixels on the x-axis

int source_X = round(pixel + waveVal) * 4;
long unsigned int source_X = round(pixel + waveVal) * 4;
if (source_X < 0)
source_X = 0;
if (source_X > frame_image->width() * frame_image->height() * 4 * sizeof(char))
Expand Down

0 comments on commit e502f97

Please sign in to comment.