diff --git a/src/Clip.cpp b/src/Clip.cpp index 45afd2aa..985df015 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -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]; diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index 645c0cca..4a7a0acb 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -615,7 +615,7 @@ void FFmpegWriter::WriteFrame(std::shared_ptr 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 @@ -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++) diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index fe12a780..6ace8400 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -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::size_type field = 1; field <= fields.size(); field++) { // Get the current field Field f = fields[field - 1]; @@ -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(); diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index d16348a2..e58c5e8f 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -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::size_type x = 0; x < Points.size(); x++) { // Get each point Point existing_point = Points[x]; @@ -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::size_type x = 0; x < Points.size(); x++) { // Get each point Point existing_point = Points[x]; root["Points"].append(existing_point.JsonValue()); @@ -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 @@ -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::size_type x = 0; x < Points.size(); x++) { // Get each point Point existing_point = Points[x]; @@ -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); @@ -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"; } @@ -597,7 +597,7 @@ 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::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); } @@ -605,7 +605,7 @@ void Keyframe::ScalePoints(double 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::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); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 86ef2911..63e1c121 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -780,7 +780,7 @@ std::shared_ptr 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::size_type clip_index = 0; clip_index < nearby_clips.size(); clip_index++) { // Get clip object from the iterator Clip *clip = nearby_clips[clip_index]; @@ -832,7 +832,7 @@ std::shared_ptr 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::size_type clip_index = 0; clip_index < nearby_clips.size(); clip_index++) { // Get clip object from the iterator Clip *clip = nearby_clips[clip_index]; @@ -850,7 +850,7 @@ std::shared_ptr 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::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; @@ -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]; @@ -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]; @@ -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(); @@ -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]; @@ -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]; diff --git a/src/effects/Wave.cpp b/src/effects/Wave.cpp index 2139e4ac..3b1cfb21 100644 --- a/src/effects/Wave.cpp +++ b/src/effects/Wave.cpp @@ -95,7 +95,7 @@ std::shared_ptr Wave::GetFrame(std::shared_ptr 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))