OVR_String_FormatUtil.cpp
Go to the documentation of this file.
00001 /************************************************************************************
00002 
00003 Filename    :   OVR_String_FormatUtil.cpp
00004 Content     :   String format functions.
00005 Created     :   February 27, 2013
00006 Notes       : 
00007 
00008 Copyright   :   Copyright 2013 Oculus VR, Inc. All Rights reserved.
00009 
00010 Use of this software is subject to the terms of the Oculus license
00011 agreement provided at the time of installation or download, or which
00012 otherwise accompanies this software in either electronic or hard copy form.
00013 
00014 ************************************************************************************/
00015 
00016 #include "OVR_String.h"
00017 #include "OVR_Log.h"
00018 
00019 namespace OVR {
00020 
00021 void StringBuffer::AppendFormat(const char* format, ...)
00022 {       
00023     va_list argList;
00024 
00025     va_start(argList, format);
00026     UPInt size = OVR_vscprintf(format, argList);
00027     va_end(argList);
00028 
00029     char* buffer = (char*) OVR_ALLOC(sizeof(char) * (size+1));
00030 
00031     va_start(argList, format);
00032     UPInt result = OVR_vsprintf(buffer, size+1, format, argList);
00033     OVR_UNUSED1(result);
00034     va_end(argList);
00035     OVR_ASSERT_LOG(result == size, ("Error in OVR_vsprintf"));
00036 
00037     AppendString(buffer);
00038 
00039     OVR_FREE(buffer);
00040 }
00041 
00042 } // OVR


oculus_sdk
Author(s): Tully Foote
autogenerated on Thu Jun 6 2019 20:13:48