[alohalytics] clang-format indents.

This commit is contained in:
Alex Zolotarev 2015-03-23 16:44:36 +03:00
parent 3b49abae70
commit c086132c8d
5 changed files with 22 additions and 20 deletions

View file

@ -36,8 +36,11 @@
// or in application:willFinishLaunchingWithOptions:
+ (void)setup:(NSString *)serverUrl withLaunchOptions:(NSDictionary *)options;
// Alternative to the previous setup method if you integrated Alohalytics after initial release
// and don't want to count app upgrades as new installs (and definitely know that it's an already existing user).
+ (void)setup:(NSString *)serverUrl andFirstLaunch:(BOOL)isFirstLaunch withLaunchOptions:(NSDictionary *)options;
// and don't want to count app upgrades as new installs (and definitely know that it's an already existing
// user).
+ (void)setup:(NSString *)serverUrl
andFirstLaunch:(BOOL)isFirstLaunch
withLaunchOptions:(NSDictionary *)options;
+ (void)forceUpload;
+ (void)logEvent:(NSString *)event;
+ (void)logEvent:(NSString *)event atLocation:(CLLocation *)location;

View file

@ -270,7 +270,8 @@ bool HTTPClientPlatformWrapper::RunHTTPRequest() {
const static jfieldID contentEncodingField =
env->GetFieldID(g_httpParamsClass, "contentEncoding", "Ljava/lang/String;");
if (!content_encoding_.empty()) {
const auto jniContentEncoding = MakePointerScopeGuard(env->NewStringUTF(content_encoding_.c_str()), deleteLocalRef);
const auto jniContentEncoding =
MakePointerScopeGuard(env->NewStringUTF(content_encoding_.c_str()), deleteLocalRef);
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
env->SetObjectField(httpParamsObject.get(), contentEncodingField, jniContentEncoding.get());

View file

@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*******************************************************************************/
#include <cstring> // std::memset
#include <cstring> // std::memset
#include <string>
#include <vector>
#include <zlib.h>
@ -37,9 +37,7 @@ struct GzipErrorException : public std::exception {
GzipErrorException(int err, const char* msg) {
msg_ = std::string("ERROR ") + std::to_string(err) + " while gzipping with zlib. " + (msg ? msg : "");
}
virtual char const* what() const noexcept {
return msg_.c_str();
}
virtual char const* what() const noexcept { return msg_.c_str(); }
};
// Throws GzipErrorException on any gzip processing error.
@ -75,9 +73,7 @@ struct GunzipErrorException : public std::exception {
GunzipErrorException(int err, const char* msg) {
msg_ = std::string("ERROR ") + std::to_string(err) + " while gzipping with zlib. " + (msg ? msg : "");
}
virtual char const* what() const noexcept {
return msg_.c_str();
}
virtual char const* what() const noexcept { return msg_.c_str(); }
};
// Throws GunzipErrorException on any gunzip processing error.

View file

@ -87,7 +87,8 @@ class HTTPClientPlatformWrapper {
return *this;
}
// This method is mutually exclusive with set_post_file().
HTTPClientPlatformWrapper& set_post_body(const std::string& post_body, const std::string& content_type,
HTTPClientPlatformWrapper& set_post_body(const std::string& post_body,
const std::string& content_type,
const std::string& content_encoding = "") {
post_body_ = post_body;
content_type_ = content_type;
@ -98,7 +99,8 @@ class HTTPClientPlatformWrapper {
}
// Move version to avoid string copying.
// This method is mutually exclusive with set_post_file().
HTTPClientPlatformWrapper& set_post_body(std::string&& post_body, const std::string& content_type,
HTTPClientPlatformWrapper& set_post_body(std::string&& post_body,
const std::string& content_type,
const std::string& content_encoding = "") {
post_body_ = std::move(post_body);
post_file_.clear();

View file

@ -26,15 +26,15 @@
#include <array>
#include <fstream>
#include <iostream> // std::cerr
#include <stdexcept> // std::runtime_error
#include <stdio.h> // popen
#include <iostream> // std::cerr
#include <stdexcept> // std::runtime_error
#include <stdio.h> // popen
#ifdef _MSC_VER
#define popen _popen
#define pclose _pclose
#else
#include <unistd.h> // close
#include <unistd.h> // close
#endif
// Used as a test stub for basic HTTP client implementation.
@ -84,13 +84,13 @@ bool HTTPClientPlatformWrapper::RunHTTPRequest() {
ScopedTmpFileDeleter deleter;
if (!post_body_.empty()) {
// POST body through tmp file to avoid breaking command line.
// POST body through tmp file to avoid breaking command line.
#ifdef _MSC_VER
char tmp_file[L_tmpnam];
::tmpnam_s(tmp_file, L_tmpnam);
#else
char tmp_file[] = "/tmp/alohalyticstmp-XXXXXX";
int fd = ::mkstemp(tmp_file); // tmpnam is deprecated and insecure.
int fd = ::mkstemp(tmp_file); // tmpnam is deprecated and insecure.
if (fd < 0) {
std::cerr << "Error: failed to create temporary file." << std::endl;
return false;
@ -113,7 +113,7 @@ bool HTTPClientPlatformWrapper::RunHTTPRequest() {
// TODO(AlexZ): Do not store data in memory if received_file_ was specified.
server_response_ = RunCurl(cmd);
error_code_ = -1;
std::string & s = server_response_;
std::string& s = server_response_;
if (s.size() < kCurlHttpCodeSize) {
return false;
}
@ -126,7 +126,7 @@ bool HTTPClientPlatformWrapper::RunHTTPRequest() {
file.exceptions(std::ios::failbit | std::ios::badbit);
file << server_response_;
}
} catch (std::exception const & ex) {
} catch (std::exception const& ex) {
std::cerr << "Exception " << ex.what() << std::endl;
return false;
}