oculus1

annotate libovr/Src/Kernel/OVR_String_FormatUtil.cpp @ 12:d797639e0234

moving on to the distortion... not correct yet
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 20 Sep 2013 10:14:29 +0300
parents e2f9e4603129
children
rev   line source
nuclear@3 1 /************************************************************************************
nuclear@3 2
nuclear@3 3 Filename : OVR_String_FormatUtil.cpp
nuclear@3 4 Content : String format functions.
nuclear@3 5 Created : February 27, 2013
nuclear@3 6 Notes :
nuclear@3 7
nuclear@3 8 Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
nuclear@3 9
nuclear@3 10 Use of this software is subject to the terms of the Oculus license
nuclear@3 11 agreement provided at the time of installation or download, or which
nuclear@3 12 otherwise accompanies this software in either electronic or hard copy form.
nuclear@3 13
nuclear@3 14 ************************************************************************************/
nuclear@3 15
nuclear@3 16 #include "OVR_String.h"
nuclear@3 17 #include "OVR_Log.h"
nuclear@3 18
nuclear@3 19 namespace OVR {
nuclear@3 20
nuclear@3 21 void StringBuffer::AppendFormat(const char* format, ...)
nuclear@3 22 {
nuclear@3 23 va_list argList;
nuclear@3 24
nuclear@3 25 va_start(argList, format);
nuclear@3 26 UPInt size = OVR_vscprintf(format, argList);
nuclear@3 27 va_end(argList);
nuclear@3 28
nuclear@3 29 char* buffer = (char*) OVR_ALLOC(sizeof(char) * (size+1));
nuclear@3 30
nuclear@3 31 va_start(argList, format);
nuclear@3 32 UPInt result = OVR_vsprintf(buffer, size+1, format, argList);
nuclear@3 33 OVR_UNUSED1(result);
nuclear@3 34 va_end(argList);
nuclear@3 35 OVR_ASSERT_LOG(result == size, ("Error in OVR_vsprintf"));
nuclear@3 36
nuclear@3 37 AppendString(buffer);
nuclear@3 38
nuclear@3 39 OVR_FREE(buffer);
nuclear@3 40 }
nuclear@3 41
nuclear@3 42 } // OVR