Silence some prefast warnings

Originally committed to SVN as r4472.
This commit is contained in:
Thomas Goyne 2010-06-11 02:24:59 +00:00
parent bc40eeb827
commit c290b6b811
16 changed files with 60 additions and 59 deletions

View file

@ -312,7 +312,7 @@ void AssFile::AddLine (wxString data,wxString group,int &version,wxString *outGr
} }
// Is the filename line? // Is the filename line?
bool isFilename = (data.Left(10) == _T("fontname: ") || data.Left(10) == _T("filename: ")); bool isFilename = (data.StartsWith(_T("fontname: ")) || data.StartsWith(_T("filename: ")));
// The attachment file is static, since it is built through several calls to this // The attachment file is static, since it is built through several calls to this
// After it's done building, it's reset to NULL // After it's done building, it's reset to NULL
@ -360,13 +360,13 @@ void AssFile::AddLine (wxString data,wxString group,int &version,wxString *outGr
// Dialogue // Dialogue
if (lowGroup == _T("[events]")) { if (lowGroup == _T("[events]")) {
if ((data.Left(9) == _T("Dialogue:") || data.Left(8) == _T("Comment:"))) { if (data.StartsWith(_T("Dialogue:")) || data.StartsWith(_T("Comment:"))) {
AssDialogue *diag = new AssDialogue(data,version); AssDialogue *diag = new AssDialogue(data,version);
//diag->ParseASSTags(); //diag->ParseASSTags();
entry = diag; entry = diag;
entry->group = group; entry->group = group;
} }
if (data.Left(7) == _T("Format:")) { else if (data.StartsWith(_T("Format:"))) {
entry = new AssEntry(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text")); entry = new AssEntry(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"));
entry->group = group; entry->group = group;
} }
@ -374,12 +374,12 @@ void AssFile::AddLine (wxString data,wxString group,int &version,wxString *outGr
// Style // Style
else if (lowGroup == _T("[v4+ styles]")) { else if (lowGroup == _T("[v4+ styles]")) {
if (data.Left(6) == _T("Style:")) { if (data.StartsWith(_T("Style:"))) {
AssStyle *style = new AssStyle(data,version); AssStyle *style = new AssStyle(data,version);
entry = style; entry = style;
entry->group = group; entry->group = group;
} }
if (data.Left(7) == _T("Format:")) { if (data.StartsWith(_T("Format:"))) {
entry = new AssEntry(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding")); entry = new AssEntry(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"));
entry->group = group; entry->group = group;
} }
@ -388,14 +388,14 @@ void AssFile::AddLine (wxString data,wxString group,int &version,wxString *outGr
// Script info // Script info
else if (lowGroup == _T("[script info]")) { else if (lowGroup == _T("[script info]")) {
// Comment // Comment
if (data.Left(1) == _T(";")) { if (data.StartsWith(_T(";"))) {
// Skip stupid comments added by other programs // Skip stupid comments added by other programs
// Of course, we'll add our own in place later... ;) // Of course, we'll add our own in place later... ;)
return; return;
} }
// Version // Version
if (data.Left(11) == _T("ScriptType:")) { if (data.StartsWith(_T("ScriptType:"))) {
wxString versionString = data.Mid(11); wxString versionString = data.Mid(11);
versionString.Trim(true); versionString.Trim(true);
versionString.Trim(false); versionString.Trim(false);
@ -615,7 +615,7 @@ wxString AssFile::GetScriptInfo(const wxString _key) {
curText.Lower(); curText.Lower();
// Found // Found
if (curText.Left(key.length()) == key) { if (curText.StartsWith(key)) {
wxString result = curText.Mid(key.length()); wxString result = curText.Mid(key.length());
result.Trim(false); result.Trim(false);
result.Trim(true); result.Trim(true);
@ -664,7 +664,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
curText.Lower(); curText.Lower();
// Found // Found
if (curText.Left(key.length()) == key) { if (curText.StartsWith(key)) {
// Set value // Set value
if (value != _T("")) { if (value != _T("")) {
wxString result = _key; wxString result = _key;
@ -756,7 +756,7 @@ void AssFile::AddComment(const wxString _comment) {
if (step == 0 && (*cur)->group == _T("[Script Info]")) step = 1; if (step == 0 && (*cur)->group == _T("[Script Info]")) step = 1;
// First line after a ; // First line after a ;
else if (step == 1 && (*cur)->GetEntryData().Left(1) != _T(";")) { else if (step == 1 && !(*cur)->GetEntryData().StartsWith(_T(";"))) {
AssEntry *prev = *cur; AssEntry *prev = *cur;
AssEntry *comm = new AssEntry(comment); AssEntry *comm = new AssEntry(comment);
comm->group = prev->group; comm->group = prev->group;

View file

@ -670,6 +670,8 @@ end_tokenizing:
// Create parameter // Create parameter
AssOverrideParameter *newparam = new AssOverrideParameter; AssOverrideParameter *newparam = new AssOverrideParameter;
newparam->classification = curproto->classification;
Params.push_back(newparam);
// Check if it's optional and not set (set to default) // Check if it's optional and not set (set to default)
if (!(curproto->optional & parsFlag)) { if (!(curproto->optional & parsFlag)) {
@ -735,10 +737,6 @@ end_tokenizing:
} }
else curtok = _T(""); else curtok = _T("");
} }
// Add to list
newparam->classification = curproto->classification;
Params.push_back(newparam);
} }
} }

View file

@ -84,8 +84,8 @@ void AssColor::Parse(const wxString value) {
ostr[11]=0; ostr[11]=0;
for(int i=value.Len()-1;i>=0&&oindex>=0;i--) { for(unsigned char i = value.Len(); i > 0 && oindex >= 0; i--) {
c=value[i]; c=value[i - 1];
if (isxdigit(c) || c=='-') { if (isxdigit(c) || c=='-') {
ostr[--oindex] = c; ostr[--oindex] = c;
if (c>='A') ishex = true; if (c>='A') ishex = true;

View file

@ -513,13 +513,13 @@ void BaseGrid::DrawImage(wxDC &dc) {
int textlen = curDiag->Text.Length(); int textlen = curDiag->Text.Length();
int depth = 0; int depth = 0;
wxChar curChar; wxChar curChar;
for (int i=0;i<textlen;i++) { for (int j=0;j<textlen;j++) {
curChar = curDiag->Text[i]; curChar = curDiag->Text[j];
if (curChar == _T('{')) depth = 1; if (curChar == _T('{')) depth = 1;
else if (curChar == _T('}')) { else if (curChar == _T('}')) {
depth--; depth--;
if (depth == 0 && mode == 1) value += replaceWith; if (depth == 0 && mode == 1) value += replaceWith;
if (depth < 0) depth = 0; else if (depth < 0) depth = 0;
} }
else if (depth != 1) value += curChar; else if (depth != 1) value += curChar;
} }

View file

@ -323,8 +323,8 @@ void DialogAutomation::OnInfo(wxCommandEvent &evt)
info += _("Scripting engines installed:\n"); info += _("Scripting engines installed:\n");
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories(); const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
for (std::vector<Automation4::ScriptFactory*>::const_iterator i = factories.begin(); i != factories.end(); ++i) { for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) {
info += wxString::Format(_T("- %s (%s)\n"), (*i)->GetEngineName().c_str(), (*i)->GetFilenamePattern().c_str()); info += wxString::Format(_T("- %s (%s)\n"), (*c)->GetEngineName().c_str(), (*c)->GetFilenamePattern().c_str());
} }
if (ei) { if (ei) {

View file

@ -667,9 +667,9 @@ void ColorPickerRecent::OnClick(wxMouseEvent &evt)
i = cols*cy + cx; i = cols*cy + cx;
if (i >= 0 && i < (int)colors.size()) { if (i >= 0 && i < (int)colors.size()) {
AssColor color(colors[i]); AssColor color(colors[i]);
wxCommandEvent evt(wxRECENT_SELECT, GetId()); wxCommandEvent evnt(wxRECENT_SELECT, GetId());
evt.SetString(color.GetASSFormatted(false, false, false)); evnt.SetString(color.GetASSFormatted(false, false, false));
AddPendingEvent(evt); AddPendingEvent(evnt);
} }
} }
@ -778,9 +778,9 @@ void ColorPickerScreenDropper::OnMouse(wxMouseEvent &evt)
wxColour color; wxColour color;
capdc.GetPixel(x, y, &color); capdc.GetPixel(x, y, &color);
AssColor ass(color); AssColor ass(color);
wxCommandEvent evt(wxDROPPER_SELECT, GetId()); wxCommandEvent evnt(wxDROPPER_SELECT, GetId());
evt.SetString(ass.GetASSFormatted(false, false, false)); evnt.SetString(ass.GetASSFormatted(false, false, false));
AddPendingEvent(evt); AddPendingEvent(evnt);
} }
} else if (HasCapture() && evt.LeftUp()) { } else if (HasCapture() && evt.LeftUp()) {
@ -878,6 +878,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
// red // red
oslid = slid = (unsigned char *)malloc(slider_width*256*3); oslid = slid = (unsigned char *)malloc(slider_width*256*3);
if (!slid) throw std::bad_alloc();
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
for (int x = 0; x < slider_width; x++) { for (int x = 0; x < slider_width; x++) {
*slid++ = clip_colorval(y); *slid++ = clip_colorval(y);
@ -890,6 +891,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
// green // green
oslid = slid = (unsigned char *)malloc(slider_width*256*3); oslid = slid = (unsigned char *)malloc(slider_width*256*3);
if (!slid) throw std::bad_alloc();
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
for (int x = 0; x < slider_width; x++) { for (int x = 0; x < slider_width; x++) {
*slid++ = 0; *slid++ = 0;
@ -902,6 +904,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
// blue // blue
oslid = slid = (unsigned char *)malloc(slider_width*256*3); oslid = slid = (unsigned char *)malloc(slider_width*256*3);
if (!slid) throw std::bad_alloc();
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
for (int x = 0; x < slider_width; x++) { for (int x = 0; x < slider_width; x++) {
*slid++ = 0; *slid++ = 0;
@ -914,6 +917,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
// luminance // luminance
oslid = slid = (unsigned char *)malloc(slider_width*256*3); oslid = slid = (unsigned char *)malloc(slider_width*256*3);
if (!slid) throw std::bad_alloc();
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
int x = 0; int x = 0;
for (; x < slider_width; x++) { for (; x < slider_width; x++) {
@ -926,6 +930,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
hsl_slider = new wxBitmap(sliderimg); hsl_slider = new wxBitmap(sliderimg);
oslid = slid = (unsigned char *)malloc(slider_width*256*3); oslid = slid = (unsigned char *)malloc(slider_width*256*3);
if (!slid) throw std::bad_alloc();
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
for (int x = 0; x < slider_width; x++) { for (int x = 0; x < slider_width; x++) {
hsv_to_rgb(y, 255, 255, slid, slid+1, slid+2); hsv_to_rgb(y, 255, 255, slid, slid+1, slid+2);

View file

@ -80,7 +80,7 @@ class KaraokeLineMatchDisplay : public wxControl {
struct MatchSyllable { struct MatchSyllable {
/// DOCME /// DOCME
int dur; size_t dur;
/// DOCME /// DOCME
wxString text; wxString text;
@ -105,7 +105,7 @@ class KaraokeLineMatchDisplay : public wxControl {
wxString dst; wxString dst;
/// DOCME /// DOCME
int duration; size_t duration;
/// DOCME /// DOCME
int last_render_width; int last_render_width;
@ -137,10 +137,10 @@ class KaraokeLineMatchDisplay : public wxControl {
/// DOCME /// DOCME
int source_sel_length; size_t source_sel_length;
/// DOCME /// DOCME
int destination_sel_length; size_t destination_sel_length;
/// DOCME /// DOCME
@ -163,9 +163,9 @@ public:
wxString GetOutputLine(); wxString GetOutputLine();
// Number of syllables not yet matched from source // Number of syllables not yet matched from source
int GetRemainingSource(); size_t GetRemainingSource();
// Number of characters not yet matched from destination // Number of characters not yet matched from destination
int GetRemainingDestination(); size_t GetRemainingDestination();
// Adjust source and destination match lengths // Adjust source and destination match lengths
void IncreaseSourceMatch(); void IncreaseSourceMatch();
@ -507,7 +507,7 @@ wxString KaraokeLineMatchDisplay::GetOutputLine()
/// @brief DOCME /// @brief DOCME
/// @return /// @return
/// ///
int KaraokeLineMatchDisplay::GetRemainingSource() size_t KaraokeLineMatchDisplay::GetRemainingSource()
{ {
return unmatched_source.size(); return unmatched_source.size();
} }
@ -516,7 +516,7 @@ int KaraokeLineMatchDisplay::GetRemainingSource()
/// @brief DOCME /// @brief DOCME
/// @return /// @return
/// ///
int KaraokeLineMatchDisplay::GetRemainingDestination() size_t KaraokeLineMatchDisplay::GetRemainingDestination()
{ {
return unmatched_destination.size(); return unmatched_destination.size();
} }
@ -538,9 +538,8 @@ void KaraokeLineMatchDisplay::IncreaseSourceMatch()
/// ///
void KaraokeLineMatchDisplay::DecreaseSourceMatch() void KaraokeLineMatchDisplay::DecreaseSourceMatch()
{ {
source_sel_length -= 1; if (source_sel_length > 0)
if (source_sel_length < 0) source_sel_length -= 1;
source_sel_length = 0;
Refresh(true); Refresh(true);
} }
@ -560,9 +559,8 @@ void KaraokeLineMatchDisplay::IncreseDestinationMatch()
/// ///
void KaraokeLineMatchDisplay::DecreaseDestinationMatch() void KaraokeLineMatchDisplay::DecreaseDestinationMatch()
{ {
destination_sel_length -= 1; if (destination_sel_length > 0)
if (destination_sel_length < 0) destination_sel_length -= 1;
destination_sel_length = 0;
Refresh(true); Refresh(true);
} }
@ -763,20 +761,17 @@ bool KaraokeLineMatchDisplay::AcceptMatch()
// Completely empty match // Completely empty match
return false; return false;
} }
assert(source_sel_length >= 0); assert(source_sel_length <= unmatched_source.size());
assert(source_sel_length <= (int)unmatched_source.size()); for (; source_sel_length > 0; source_sel_length--)
while (source_sel_length > 0)
{ {
match.src.push_back(unmatched_source.front()); match.src.push_back(unmatched_source.front());
match.duration += unmatched_source.front().dur; match.duration += unmatched_source.front().dur;
unmatched_source.pop_front(); unmatched_source.pop_front();
source_sel_length--;
} }
assert(source_sel_length == 0); assert(source_sel_length == 0);
assert(destination_sel_length >= 0); assert(destination_sel_length <= unmatched_destination.size());
assert(destination_sel_length <= (int)unmatched_destination.size());
match.dst = unmatched_destination.Left(destination_sel_length); match.dst = unmatched_destination.Left(destination_sel_length);
unmatched_destination = unmatched_destination.Mid(destination_sel_length); unmatched_destination = unmatched_destination.Mid(destination_sel_length);
destination_sel_length = 0; destination_sel_length = 0;

View file

@ -228,7 +228,7 @@ void Preferences::OnCancel(wxCommandEvent &event) {
name_value##_sizer->Add(name_value##_flex, 1, wxEXPAND, 5); \ name_value##_sizer->Add(name_value##_flex, 1, wxEXPAND, 5); \
sizer->AddSpacer(8); sizer->AddSpacer(8);
// name_value##_flex->SetFlexibleDirection(wxVERTICAL); \ // name_value##_flex->SetFlexibleDirection(wxVERTICAL);
#define PAGE_END() \ #define PAGE_END() \
panel->SetSizerAndFit(sizer); panel->SetSizerAndFit(sizer);

View file

@ -127,6 +127,7 @@ void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
// Check if it's a line number // Check if it's a line number
if (!curLine.IsNumber()) { if (!curLine.IsNumber()) {
Clear(); Clear();
if (line) delete line;
throw wxString::Format(_T("Parse error on entry %i at line %i (expecting line number). Possible malformed file."),linen,fileLine); throw wxString::Format(_T("Parse error on entry %i at line %i (expecting line number). Possible malformed file."),linen,fileLine);
} }
@ -143,6 +144,7 @@ void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
// Read timestamps // Read timestamps
if (curLine.substr(13,3) != _T("-->")) { if (curLine.substr(13,3) != _T("-->")) {
Clear(); Clear();
if (line) delete line;
throw wxString::Format(_T("Parse error on entry %i at line %i (expecting timestamps). Possible malformed file."),linen,fileLine); throw wxString::Format(_T("Parse error on entry %i at line %i (expecting timestamps). Possible malformed file."),linen,fileLine);
} }
line->Start.ParseSRT(curLine.substr(0,12)); line->Start.ParseSRT(curLine.substr(0,12));
@ -172,13 +174,14 @@ void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
line->ParseSRTTags(); line->ParseSRTTags();
Line->push_back(line); Line->push_back(line);
lines++; lines++;
line = NULL;
} }
} }
} }
// No lines? // No lines?
if (lines == 0) { if (lines == 0) {
AssDialogue *line = new AssDialogue(); line = new AssDialogue();
line->group = _T("[Events]"); line->group = _T("[Events]");
line->Style = _T("Default"); line->Style = _T("Default");
line->Start.SetMS(0); line->Start.SetMS(0);

View file

@ -130,7 +130,7 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
if(value.IsEmpty()) continue; if(value.IsEmpty()) continue;
// Check if this isn't a timecodes file // Check if this isn't a timecodes file
if (value.Left(10) == _T("# timecode")) { if (value.StartsWith(_T("# timecode"))) {
throw _T("File is a timecode file, cannot load as subtitles."); throw _T("File is a timecode file, cannot load as subtitles.");
} }
@ -159,7 +159,7 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
value.Trim(false); value.Trim(false);
// Sets line up // Sets line up
line = new AssDialogue(); line = new AssDialogue;
line->group = _T("[Events]"); line->group = _T("[Events]");
line->Style = _T("Default"); line->Style = _T("Default");
if (isComment) line->Actor = _T(""); if (isComment) line->Actor = _T("");
@ -182,7 +182,7 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
// No lines? // No lines?
if (lines == 0) { if (lines == 0) {
AssDialogue *line = new AssDialogue(); line = new AssDialogue;
line->group = _T("[Events]"); line->group = _T("[Events]");
line->Style = _T("Default"); line->Style = _T("Default");
line->Start.SetMS(0); line->Start.SetMS(0);

View file

@ -120,10 +120,10 @@ VideoContext::VideoContext()
, arValue(1.) , arValue(1.)
, arType(0) , arType(0)
, hasSubtitles(false) , hasSubtitles(false)
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
, grid(NULL) , grid(NULL)
, curLine(NULL) , curLine(NULL)
, audio(NULL) , audio(NULL)
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
{ {
} }

View file

@ -178,6 +178,7 @@ wxImage AegiVideoFrame::GetImage() const {
if (format == FORMAT_RGB32 || format == FORMAT_RGB24) { if (format == FORMAT_RGB32 || format == FORMAT_RGB24) {
// Create // Create
unsigned char *buf = (unsigned char*)malloc(w*h*3); unsigned char *buf = (unsigned char*)malloc(w*h*3);
if (!buf) throw std::bad_alloc();
const unsigned char *src = data[0]; const unsigned char *src = data[0];
unsigned char *dst = buf; unsigned char *dst = buf;

View file

@ -233,7 +233,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
Width = TempFrame->EncodedWidth; Width = TempFrame->EncodedWidth;
Height = TempFrame->EncodedHeight; Height = TempFrame->EncodedHeight;
if (FFMS_SetOutputFormatV(VideoSource, 1 << FFMS_GetPixFmt("bgra"), Width, Height, FFMS_RESIZER_BICUBIC, &ErrInfo)) { if (FFMS_SetOutputFormatV(VideoSource, 1LL << FFMS_GetPixFmt("bgra"), Width, Height, FFMS_RESIZER_BICUBIC, &ErrInfo)) {
ErrorMsg.Append(wxString::Format(_T("Failed to set output format: %s"), ErrInfo.Buffer)); ErrorMsg.Append(wxString::Format(_T("Failed to set output format: %s"), ErrInfo.Buffer));
throw ErrorMsg; throw ErrorMsg;
} }

View file

@ -129,7 +129,7 @@ void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) {
dragListOK = true; dragListOK = true;
} }
if (!dragging) { if (!dragging) {
int oldHigh = curFeatureI; unsigned oldHigh = curFeatureI;
GetHighlightedFeature(); GetHighlightedFeature();
if (curFeatureI != oldHigh) needRender = true; if (curFeatureI != oldHigh) needRender = true;
} }

View file

@ -71,7 +71,7 @@ bool VisualToolCross::Update() {
SubtitlesGrid *grid = VideoContext::Get()->grid; SubtitlesGrid *grid = VideoContext::Get()->grid;
wxArrayInt sel = grid->GetSelection(); wxArrayInt sel = grid->GetSelection();
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) { for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
AssDialogue* line = grid->GetDialogue(*cur); line = grid->GetDialogue(*cur);
if (!line) continue; if (!line) continue;
int x1, y1; int x1, y1;
GetLinePosition(line, x1, y1); GetLinePosition(line, x1, y1);

View file

@ -225,9 +225,8 @@ void VisualToolVectorClip::PopulateFeatureList() {
VisualToolVectorClipDraggableFeature feat; VisualToolVectorClipDraggableFeature feat;
// Go through each curve // Go through each curve
int i = 0;
int j = 0; int j = 0;
for (Spline::iterator cur=spline.begin();cur!=spline.end();cur++,i++) { for (Spline::iterator cur=spline.begin();cur!=spline.end();cur++) {
if (cur->type == CURVE_POINT) { if (cur->type == CURVE_POINT) {
feat.x = (int)cur->p1.x; feat.x = (int)cur->p1.x;
feat.y = (int)cur->p1.y; feat.y = (int)cur->p1.y;