Skip to content

Commit

Permalink
C++ compliance/clang fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
reupen committed Mar 17, 2016
1 parent 71ced0f commit acfe197
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 28 deletions.
3 changes: 2 additions & 1 deletion SDK/dsp.h
Expand Up @@ -80,7 +80,8 @@ class NOVTABLE dsp_v2 : public dsp {
virtual void run_v2(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) = 0;
private:
void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags) {
run_v2(p_chunk_list,p_cur_file,p_flags,abort_callback_dummy());
abort_callback_dummy p_abort;
run_v2(p_chunk_list,p_cur_file,p_flags,p_abort);
}

FB2K_MAKE_SERVICE_INTERFACE(dsp_v2,dsp);
Expand Down
5 changes: 4 additions & 1 deletion SDK/filesystem.cpp
Expand Up @@ -754,7 +754,10 @@ namespace {

class exception_io_win32_ex : public exception_io_win32 {
public:
exception_io_win32_ex(DWORD p_code) : m_msg(pfc::string_formatter() << "I/O error (win32 #" << (t_uint32)p_code << ")") {}
exception_io_win32_ex(DWORD p_code) {
pfc::string_formatter formatter;
m_msg = formatter << "I/O error (win32 #" << (t_uint32)p_code << ")";
}
exception_io_win32_ex(const exception_io_win32_ex & p_other) {*this = p_other;}
const char * what() const throw() {return m_msg;}
private:
Expand Down
2 changes: 1 addition & 1 deletion SDK/metadb_handle.h
Expand Up @@ -169,7 +169,7 @@ template<template<typename> class t_alloc = pfc::alloc_fast >
class metadb_handle_list_t : public service_list_t<metadb_handle,t_alloc> {
private:
typedef metadb_handle_list_t<t_alloc> t_self;
typedef list_base_const_t<metadb_handle_ptr> t_interface;
typedef pfc::list_base_const_t<metadb_handle_ptr> t_interface;
public:
inline void sort_by_format(const char * spec,titleformat_hook * p_hook) {
return metadb_handle_list_helper::sort_by_format(*this, spec, p_hook);
Expand Down
14 changes: 9 additions & 5 deletions SDK/playlist.cpp
Expand Up @@ -90,12 +90,14 @@ void playlist_manager::playlist_get_all_items(t_size p_playlist,pfc::list_base_t

void playlist_manager::playlist_get_selected_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out)
{
playlist_enum_items(p_playlist,enum_items_callback_retrieve_selected_items(out),bit_array_true());
enum_items_callback_retrieve_selected_items p_callback(out);
playlist_enum_items(p_playlist,p_callback,bit_array_true());
}

void playlist_manager::playlist_get_selection_mask(t_size p_playlist,bit_array_var & out)
{
playlist_enum_items(p_playlist,enum_items_callback_retrieve_selection_mask(out),bit_array_true());
enum_items_callback_retrieve_selection_mask p_callback(out);
playlist_enum_items(p_playlist,p_callback,bit_array_true());
}

bool playlist_manager::playlist_is_item_selected(t_size p_playlist,t_size p_item)
Expand Down Expand Up @@ -131,8 +133,9 @@ bool playlist_manager::playlist_move_selection(t_size p_playlist,int p_delta) {

pfc::array_t<t_size> order; order.set_size(count);
pfc::array_t<bool> selection; selection.set_size(count);

playlist_get_selection_mask(p_playlist,bit_array_var_table(selection.get_ptr(),selection.get_size()));
bit_array_var_table bit_table(selection.get_ptr(), selection.get_size());

playlist_get_selection_mask(p_playlist,bit_table);
g_make_selection_move_permutation(order.get_ptr(),count,bit_array_table(selection.get_ptr(),selection.get_size()),p_delta);
return playlist_reorder_items(p_playlist,order.get_ptr(),count);
}
Expand Down Expand Up @@ -551,7 +554,8 @@ bool playlist_manager::highlight_playing_item()

void playlist_manager::playlist_get_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask)
{
playlist_enum_items(p_playlist,enum_items_callback_retrieve_all_items(out),p_mask);
enum_items_callback_retrieve_all_items p_callback(out);
playlist_enum_items(p_playlist,p_callback,p_mask);
}

void playlist_manager::activeplaylist_get_items(pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask)
Expand Down
3 changes: 2 additions & 1 deletion SDK/playlist_loader.cpp
Expand Up @@ -142,7 +142,8 @@ static void track_indexer__g_get_tracks_wrap(const char * p_path,const service_p
fail = true;
} catch(std::exception const & e) {
fail = true;
console::formatter() << "could not enumerate tracks (" << e << ") on:\n" << file_path_display(p_path);
console::formatter formatter;
formatter << "could not enumerate tracks (" << e << ") on:\n" << file_path_display(p_path);
}
if (fail) {
if (!got_input && !p_abort.is_aborting()) {
Expand Down
19 changes: 8 additions & 11 deletions SDK/titleformat.cpp
Expand Up @@ -55,7 +55,8 @@ void titleformat_compiler::remove_forbidden_chars(titleformat_text_out * p_out,c

void titleformat_compiler::remove_forbidden_chars_string_append(pfc::string_receiver & p_out,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
{
remove_forbidden_chars(&titleformat_text_out_impl_string(p_out),pfc::guid_null,p_source,p_source_len,p_reserved_chars);
titleformat_text_out_impl_string p_text_out(p_out);
remove_forbidden_chars(&p_text_out,pfc::guid_null,p_source,p_source_len,p_reserved_chars);
}

void titleformat_compiler::remove_forbidden_chars_string(pfc::string_base & p_out,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
Expand All @@ -73,26 +74,22 @@ bool titleformat_hook_impl_file_info::process_function(titleformat_text_out * p_

void titleformat_object::run_hook(const playable_location & p_location,const file_info * p_source,titleformat_hook * p_hook,pfc::string_base & p_out,titleformat_text_filter * p_filter)
{
titleformat_hook_impl_file_info p_hook_file_info(p_location, p_source);
if (p_hook)
{
run(
&titleformat_hook_impl_splitter(
p_hook,
&titleformat_hook_impl_file_info(p_location,p_source)
),
p_out,p_filter);
titleformat_hook_impl_splitter p_hook_splitter(p_hook, &p_hook_file_info);
run(&p_hook_splitter,p_out,p_filter);
}
else
{
run(
&titleformat_hook_impl_file_info(p_location,p_source),
p_out,p_filter);
run(&p_hook_file_info,p_out,p_filter);
}
}

void titleformat_object::run_simple(const playable_location & p_location,const file_info * p_source,pfc::string_base & p_out)
{
run(&titleformat_hook_impl_file_info(p_location,p_source),p_out,NULL);
titleformat_hook_impl_file_info p_hook(p_location, p_source);
run(&p_hook,p_out,NULL);
}

t_size titleformat_hook_function_params::get_param_uint(t_size index)
Expand Down
7 changes: 5 additions & 2 deletions SDK/ui_element.cpp
Expand Up @@ -35,7 +35,9 @@ service_ptr_t<ui_element_config> ui_element_config::g_create(const GUID & id, st

service_ptr_t<ui_element_config> ui_element_config::g_create(stream_reader * in, t_size bytes, abort_callback & abort) {
if (bytes < sizeof(GUID)) throw exception_io_data_truncation();
GUID id; stream_reader_formatter<>(*in,abort) >> id;
GUID id;
stream_reader_formatter<>reader_formatter(*in, abort);
reader_formatter >> id;
return g_create(id,in,bytes - sizeof(GUID),abort);
}

Expand All @@ -48,7 +50,8 @@ ui_element_config::ptr ui_element_config_parser::subelement(const GUID & id, t_s

service_ptr_t<ui_element_config> ui_element_config::g_create(const void * data, t_size size) {
stream_reader_memblock_ref stream(data,size);
return g_create(&stream,size,abort_callback_dummy());
abort_callback_dummy p_abort;
return g_create(&stream,size,p_abort);
}

bool ui_element_subclass_description(const GUID & id, pfc::string_base & p_out) {
Expand Down
3 changes: 2 additions & 1 deletion SDK/ui_element.h
Expand Up @@ -436,7 +436,8 @@ class NOVTABLE ui_element_v2 : public ui_element {
//! Override to use another description for our menu command. Relevant only when KFlagHavePopupCommand is set.
virtual bool get_menu_command_description(pfc::string_base & out) {
pfc::string8 name; get_name(name);
out = pfc::string_formatter() << "Activates " << name << " window.";
pfc::string_formatter formatter;
out = formatter << "Activates " << name << " window.";
return true;
}

Expand Down
9 changes: 6 additions & 3 deletions helpers/ProcessUtils.h
Expand Up @@ -158,7 +158,8 @@ namespace ProcessUtils {
try {
WIN32_OP( CreateProcess(pfc::stringcvt::string_os_from_utf8(ExePath), NULL, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) );
} catch(std::exception const & e) {
throw failure(pfc::string_formatter() << "Could not start the worker process - " << e);
pfc::string_formatter formatter;
throw failure(formatter << "Could not start the worker process - " << e);
}
hProcess = pi.hProcess; _Close(pi.hThread);
} catch(...) {
Expand Down Expand Up @@ -206,7 +207,8 @@ namespace ProcessUtils {
if (!bDetach) {
if (WaitForSingleObject(hProcess, TimeOutMS) != WAIT_OBJECT_0) {
//PFC_ASSERT( !"Should not get here - worker stuck" );
console::formatter() << pfc::string_filename_ext(ExePath) << " unresponsive - terminating";
console::formatter formatter;
formatter << pfc::string_filename_ext(ExePath) << " unresponsive - terminating";
TerminateProcess(hProcess, -1);
}
}
Expand All @@ -226,7 +228,8 @@ namespace ProcessUtils {
static pfc::string_formatter makePipeName() {
GUID id;
CoCreateGuid (&id);
return pfc::string_formatter() << "\\\\.\\pipe\\" << pfc::print_guid(id);
pfc::string_formatter formatter;
return formatter << "\\\\.\\pipe\\" << pfc::print_guid(id);
}

static void myCreatePipeOut(HANDLE & in, HANDLE & out) {
Expand Down
3 changes: 2 additions & 1 deletion helpers/file_info_const_impl.cpp
Expand Up @@ -242,7 +242,8 @@ void file_info_const_impl::copy(const file_info & p_source)
if (hintmap != NULL) {
// profiler(file_info_const_impl__copy__hintmap);
for(t_size n=0;n<m_meta_count;n++) hintmap[n]=n;
pfc::sort(sort_callback_hintmap_impl(meta,hintmap),m_meta_count);
sort_callback_hintmap_impl p_callback(meta, hintmap);
pfc::sort(p_callback,m_meta_count);
}
#endif//__file_info_const_impl_have_hintmap__
}
Expand Down
5 changes: 4 additions & 1 deletion helpers/input_helpers.cpp
Expand Up @@ -213,7 +213,10 @@ bool dead_item_filter::run(const pfc::list_base_const_t<metadb_handle_ptr> & p_l
valid_handles.sort_by_pointer();
for(t_size listidx=0;listidx<p_list.get_count();listidx++) {
bool dead = valid_handles.bsearch_by_pointer(p_list[listidx]) == ~0;
if (dead) console::formatter() << "Dead item: " << p_list[listidx];
if (dead) {
console::formatter formatter;
formatter << "Dead item: " << p_list[listidx];
}
p_mask.set(listidx,dead);
}
return !is_aborting();
Expand Down

0 comments on commit acfe197

Please sign in to comment.