oculus1
view libovr/Src/Kernel/OVR_String_FormatUtil.cpp @ 3:b069a5c27388
added a couple more stuff, fixed all the LibOVR line endings
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 15 Sep 2013 04:10:05 +0300 |
parents | e2f9e4603129 |
children |
line source
1 /************************************************************************************
3 Filename : OVR_String_FormatUtil.cpp
4 Content : String format functions.
5 Created : February 27, 2013
6 Notes :
8 Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
10 Use of this software is subject to the terms of the Oculus license
11 agreement provided at the time of installation or download, or which
12 otherwise accompanies this software in either electronic or hard copy form.
14 ************************************************************************************/
16 #include "OVR_String.h"
17 #include "OVR_Log.h"
19 namespace OVR {
21 void StringBuffer::AppendFormat(const char* format, ...)
22 {
23 va_list argList;
25 va_start(argList, format);
26 UPInt size = OVR_vscprintf(format, argList);
27 va_end(argList);
29 char* buffer = (char*) OVR_ALLOC(sizeof(char) * (size+1));
31 va_start(argList, format);
32 UPInt result = OVR_vsprintf(buffer, size+1, format, argList);
33 OVR_UNUSED1(result);
34 va_end(argList);
35 OVR_ASSERT_LOG(result == size, ("Error in OVR_vsprintf"));
37 AppendString(buffer);
39 OVR_FREE(buffer);
40 }
42 } // OVR