Russian Qt Forum
Апрель 26, 2024, 22:51 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: Помогите найти ошибку access violation  (Прочитано 5792 раз)
Zusykss
Гость
« : Июнь 08, 2017, 07:46 »

Привет всем)
Помогите найти ошибку, вроде все правильно написано, а вылетает ошибка access violation
Ошибка вылетает, когда функция заканчивается. Отработало все и в конце бабах ошибка)
Код:
void ParserKino::AfterUpdating()
{
    QString strBuff = ReadFile(PATH_GOOD_LIST);
    QString strBuff2 = ReadFile(PATH_BLACK_LIST);
    QStringList listBlackList;

    listBlackList = strBuff2.split(",");
    QString type;
    InfoKino kinoExamp;
    memset(&kinoExamp, 0, sizeof(StatisticInFile));

    Parser parse;
    int colNewElement = 0;
    bool flag = false;

    for(int i = 0; i < listBlackList.length(); i++)
    {
        type = "film";
        QString strId = listBlackList.at(i);
        if(strId.isEmpty())
            continue;
        int id = strId.toInt();
        QString result = m_dataBase->FindIdInfo(type, id);
        if(result.isEmpty())
        {
            type = "serial";
            result = m_dataBase->FindIdInfo(type,id);
        }
        QString sravnenie;
        kinoExamp.release_date_int = parse.GetValue(GET_DATE_INT, result); // get data_int
        kinoExamp.release_date_rus = parse.GetValue(GET_DATE_RUS, result); // get data_rus
        kinoExamp.year = parse.GetValue(GET_YEAR, result).toInt(); // get year

        if(!kinoExamp.release_date_rus.isEmpty())
            sravnenie = kinoExamp.release_date_rus;
        else if(!kinoExamp.release_date_int.isEmpty())
            sravnenie = kinoExamp.release_date_int;
        else
        {
            flag = true;
        }

        QDate time = QDate::currentDate();
        QString str2;
        QTextStream ts1(&str2);
        int year = 0;
        if(!m_listKino[i].release_date_rus.isEmpty())
            ts1 << m_listKino[i].release_date_rus;
        else if(!m_listKino[i].release_date_int.isEmpty())
            ts1 <<  m_listKino[i].release_date_int;
        else
        {
            year = time.year();
            if(year != m_listKino[i].year)
            {
                flag = true;
            }
        }

        if(!flag)
        {
            str2 = str2.mid(0,str2.length() - str2.indexOf("T"));
            str2 = str2.replace("-", "");
            QDate tim2 = QDate::fromString(str2, "yyyyMMdd");
            QString str3,str4;
            QTextStream ts(&str3),ts2(&str4);

            int day = tim2.daysTo(time);
            if(day >= 30 && !flag)
            {
                ts << listBlackList.at(i) << ",";
                ts2 << listBlackList.at(i);
                strBuff2.replace(str3, "");
                if(strBuff.indexOf(str4) != -1)
                {
                    strBuff.append("," + str4);
                    colNewElement++;
                }

            }
            else if(flag)
            {
                if(m_listKino[i].year == 0)
                    continue;
                else
                {
                    ts << listBlackList.at(i) <<",";
                    ts2 << listBlackList.at(i);
                    strBuff2.replace(str3, "");
                    if(strBuff.indexOf(str4) != -1)
                    {
                        strBuff.append("," + str4);
                        colNewElement++;
                    }
                }
            }
        }
    }
    if(colNewElement > 0)
        WriteFile(PATH_GOOD_LIST, strBuff);
    if(!strBuff2.isEmpty())
        WriteFile(PATH_BLACK_LIST, strBuff2);

}
Записан
Zusykss
Гость
« Ответ #1 : Июнь 08, 2017, 08:01 »

Разобрался
Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.046 секунд. Запросов: 20.