oculus1
diff 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 diff
1.1 --- a/libovr/Src/Kernel/OVR_String_FormatUtil.cpp Sat Sep 14 17:51:03 2013 +0300 1.2 +++ b/libovr/Src/Kernel/OVR_String_FormatUtil.cpp Sun Sep 15 04:10:05 2013 +0300 1.3 @@ -1,1 +1,42 @@ 1.4 -/************************************************************************************ 1.5 1.6 Filename : OVR_String_FormatUtil.cpp 1.7 Content : String format functions. 1.8 Created : February 27, 2013 1.9 Notes : 1.10 1.11 Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved. 1.12 1.13 Use of this software is subject to the terms of the Oculus license 1.14 agreement provided at the time of installation or download, or which 1.15 otherwise accompanies this software in either electronic or hard copy form. 1.16 1.17 ************************************************************************************/ 1.18 1.19 #include "OVR_String.h" 1.20 #include "OVR_Log.h" 1.21 1.22 namespace OVR { 1.23 1.24 void StringBuffer::AppendFormat(const char* format, ...) 1.25 { 1.26 va_list argList; 1.27 1.28 va_start(argList, format); 1.29 UPInt size = OVR_vscprintf(format, argList); 1.30 va_end(argList); 1.31 1.32 char* buffer = (char*) OVR_ALLOC(sizeof(char) * (size+1)); 1.33 1.34 va_start(argList, format); 1.35 UPInt result = OVR_vsprintf(buffer, size+1, format, argList); 1.36 OVR_UNUSED1(result); 1.37 va_end(argList); 1.38 OVR_ASSERT_LOG(result == size, ("Error in OVR_vsprintf")); 1.39 1.40 AppendString(buffer); 1.41 1.42 OVR_FREE(buffer); 1.43 } 1.44 1.45 } // OVR 1.46 \ No newline at end of file 1.47 +/************************************************************************************ 1.48 + 1.49 +Filename : OVR_String_FormatUtil.cpp 1.50 +Content : String format functions. 1.51 +Created : February 27, 2013 1.52 +Notes : 1.53 + 1.54 +Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved. 1.55 + 1.56 +Use of this software is subject to the terms of the Oculus license 1.57 +agreement provided at the time of installation or download, or which 1.58 +otherwise accompanies this software in either electronic or hard copy form. 1.59 + 1.60 +************************************************************************************/ 1.61 + 1.62 +#include "OVR_String.h" 1.63 +#include "OVR_Log.h" 1.64 + 1.65 +namespace OVR { 1.66 + 1.67 +void StringBuffer::AppendFormat(const char* format, ...) 1.68 +{ 1.69 + va_list argList; 1.70 + 1.71 + va_start(argList, format); 1.72 + UPInt size = OVR_vscprintf(format, argList); 1.73 + va_end(argList); 1.74 + 1.75 + char* buffer = (char*) OVR_ALLOC(sizeof(char) * (size+1)); 1.76 + 1.77 + va_start(argList, format); 1.78 + UPInt result = OVR_vsprintf(buffer, size+1, format, argList); 1.79 + OVR_UNUSED1(result); 1.80 + va_end(argList); 1.81 + OVR_ASSERT_LOG(result == size, ("Error in OVR_vsprintf")); 1.82 + 1.83 + AppendString(buffer); 1.84 + 1.85 + OVR_FREE(buffer); 1.86 +} 1.87 + 1.88 +} // OVR