Improved the code quality and TeaSpeak now builds with clang
This commit is contained in:
		
							parent
							
								
									7b51bcc5e8
								
							
						
					
					
						commit
						23db0edd22
					
				@ -1,6 +1,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <cstdio>
 | 
					#include <cstdio>
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
#include <cstring>
 | 
					#include <cstring>
 | 
				
			||||||
#include <array>
 | 
					#include <array>
 | 
				
			||||||
#include <string_view>
 | 
					#include <string_view>
 | 
				
			||||||
 | 
				
			|||||||
@ -330,10 +330,11 @@ namespace ts {
 | 
				
			|||||||
                    if(it + 1 != this->bulks.end())
 | 
					                    if(it + 1 != this->bulks.end())
 | 
				
			||||||
                        result.append("|");
 | 
					                        result.append("|");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if(!with_empty && result.ends_with('|'))
 | 
					                if(!with_empty && !result.empty() && result.back() == '|') {
 | 
				
			||||||
                    this->builded = result.substr(0, result.length() - 1);
 | 
					                    this->builded = result.substr(0, result.length() - 1);
 | 
				
			||||||
                else
 | 
					                } else {
 | 
				
			||||||
                    this->builded = result;
 | 
					                    this->builded = result;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                this->flag_changed = false;
 | 
					                this->flag_changed = false;
 | 
				
			||||||
                return this->builded.value();
 | 
					                return this->builded.value();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -262,7 +262,7 @@ namespace sql {
 | 
				
			|||||||
                friend class ::sql::command;
 | 
					                friend class ::sql::command;
 | 
				
			||||||
                friend class ::sql::model;
 | 
					                friend class ::sql::model;
 | 
				
			||||||
            public:
 | 
					            public:
 | 
				
			||||||
                explicit command_base(nullptr_t) : _data{nullptr} {}
 | 
					                explicit command_base(std::nullptr_t) : _data{nullptr} {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                command_base(SqlManager* handle, const std::string &sql, std::initializer_list<variable> values) {
 | 
					                command_base(SqlManager* handle, const std::string &sql, std::initializer_list<variable> values) {
 | 
				
			||||||
                    assert(handle);
 | 
					                    assert(handle);
 | 
				
			||||||
@ -329,7 +329,7 @@ namespace sql {
 | 
				
			|||||||
            template<typename... Ts>
 | 
					            template<typename... Ts>
 | 
				
			||||||
            model(SqlManager* handle, const std::string &sql, Ts... vars) : model(handle, sql, {}) { values(vars...); }
 | 
					            model(SqlManager* handle, const std::string &sql, Ts... vars) : model(handle, sql, {}) { values(vars...); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            explicit model(nullptr_t) : command_base{nullptr} {};
 | 
					            explicit model(std::nullptr_t) : command_base{nullptr} {};
 | 
				
			||||||
            //model(const model& v) : command_base{v} {};
 | 
					            //model(const model& v) : command_base{v} {};
 | 
				
			||||||
            //model(model&& v) noexcept  : command_base{std::forward<model>(v)} {};
 | 
					            //model(model&& v) noexcept  : command_base{std::forward<model>(v)} {};
 | 
				
			||||||
            ~model() override = default;
 | 
					            ~model() override = default;
 | 
				
			||||||
 | 
				
			|||||||
@ -707,7 +707,7 @@ result MySQLManager::executeCommand(std::shared_ptr<CommandData> _ptr) {
 | 
				
			|||||||
    if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables))
 | 
					    if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables))
 | 
				
			||||||
        return {ptr->sql_command, -1, "Failed to allocate bind memory!"};
 | 
					        return {ptr->sql_command, -1, "Failed to allocate bind memory!"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ResultBind bind_result_data{.field_count = 0, .memory = nullptr, .descriptors = nullptr};
 | 
					    ResultBind bind_result_data{0, nullptr, nullptr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto connection = this->next_connection();
 | 
					    auto connection = this->next_connection();
 | 
				
			||||||
    if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"};
 | 
					    if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"};
 | 
				
			||||||
@ -761,7 +761,7 @@ result MySQLManager::queryCommand(shared_ptr<CommandData> _ptr, const QueryCallb
 | 
				
			|||||||
    FreeGuard<BindMemory> bind_parameter_memory{nullptr};
 | 
					    FreeGuard<BindMemory> bind_parameter_memory{nullptr};
 | 
				
			||||||
    if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables)) return {ptr->sql_command, -1, "Failed to allocate bind memory!"};
 | 
					    if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables)) return {ptr->sql_command, -1, "Failed to allocate bind memory!"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ResultBind bind_result_data{.field_count = 0, .memory = nullptr, .descriptors = nullptr};
 | 
					    ResultBind bind_result_data{0, nullptr, nullptr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto connection = this->next_connection();
 | 
					    auto connection = this->next_connection();
 | 
				
			||||||
    if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"};
 | 
					    if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user