#define URL_AUTOCOMPLETE "https://api.yelp.com/v3/autocomplete"
#define URL_SEARCH "https://api.yelp.com/v3/businesses/search"
-#define BIG_BUFFER_SIZE (1024*1024)
#define LEFT_OFFSET 28
#define FONT_SIZE_LINEDIT 20
#define FONT_SIZE_LIST 18
void MainApp::networkReplySearch(QNetworkReply* reply)
{
- char buf[BIG_BUFFER_SIZE];
- int buflen;
+ QByteArray buf;
mutex.lock();
return;
}
- buflen = reply->read(buf, BIG_BUFFER_SIZE-1);
- buf[buflen] = '\0';
+ buf = reply->readAll();
- if (buflen == 0)
+ if (buf.isEmpty())
{
mutex.unlock();
return;
currentIndex = 0;
Businesses.clear();
- ParseJsonBusinessList(buf, Businesses);
+ ParseJsonBusinessList(buf.data(), Businesses);
DisplayResultList(true);
FillResultList(Businesses);
}