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
|
||||
_annc_filename.append (VERSIONSTRING);
|
||||
|
||||
_announce_string = "";
|
||||
|
||||
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
||||
FILE* fin = g_fopen (path.c_str(), "rb");
|
||||
|
||||
if (fin) {
|
||||
std::ifstream announce_file (fin);
|
||||
|
||||
if ( announce_file.fail() )
|
||||
_announce_string = "";
|
||||
else {
|
||||
std::stringstream oss;
|
||||
oss << announce_file.rdbuf();
|
||||
_announce_string = oss.str();
|
||||
while (!feof (fin)) {
|
||||
char tmp[1024];
|
||||
if (fread (tmp, sizeof(char), 1024, fin) <= 0) {
|
||||
break;
|
||||
}
|
||||
_announce_string += fin
|
||||
}
|
||||
|
||||
fclose (fin);
|
||||
}
|
||||
|
||||
|
|
|
@ -226,14 +226,7 @@ _pingback (void *arg)
|
|||
FILE* fout = g_fopen (cm->announce_path.c_str(), "wb");
|
||||
|
||||
if (fout) {
|
||||
{
|
||||
std::ofstream annc_file (fout);
|
||||
|
||||
if (annc_file) {
|
||||
annc_file << return_str;
|
||||
}
|
||||
}
|
||||
|
||||
fwrite (return_str.c_str(), sizeof(char), return_str.length (), fout);
|
||||
fclose (fout);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user