portable c-code for reading pingback/announcement message
This commit is contained in:
parent
dee324cc36
commit
2f1878a6f7
@ -807,20 +807,18 @@ ARDOUR_UI::check_announcements ()
|
|||||||
#endif
|
#endif
|
||||||
_annc_filename.append (VERSIONSTRING);
|
_annc_filename.append (VERSIONSTRING);
|
||||||
|
|
||||||
|
_announce_string = "";
|
||||||
|
|
||||||
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
||||||
FILE* fin = g_fopen (path.c_str(), "rb");
|
FILE* fin = g_fopen (path.c_str(), "rb");
|
||||||
|
|
||||||
if (fin) {
|
if (fin) {
|
||||||
std::ifstream announce_file (fin);
|
while (!feof (fin)) {
|
||||||
|
char tmp[1024];
|
||||||
if ( announce_file.fail() )
|
if (fread (tmp, sizeof(char), 1024, fin) <= 0) {
|
||||||
_announce_string = "";
|
break;
|
||||||
else {
|
}
|
||||||
std::stringstream oss;
|
_announce_string += fin
|
||||||
oss << announce_file.rdbuf();
|
|
||||||
_announce_string = oss.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (fin);
|
fclose (fin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,14 +226,7 @@ _pingback (void *arg)
|
|||||||
FILE* fout = g_fopen (cm->announce_path.c_str(), "wb");
|
FILE* fout = g_fopen (cm->announce_path.c_str(), "wb");
|
||||||
|
|
||||||
if (fout) {
|
if (fout) {
|
||||||
{
|
fwrite (return_str.c_str(), sizeof(char), return_str.length (), fout);
|
||||||
std::ofstream annc_file (fout);
|
|
||||||
|
|
||||||
if (annc_file) {
|
|
||||||
annc_file << return_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fout);
|
fclose (fout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user