Browse Source

Fix late night coding issue

James Urquhart 10 years ago
parent
commit
20acbfed04
1 changed files with 5 additions and 4 deletions
  1. 5 4
      Engine/source/sfx/sfxSystem.cpp

+ 5 - 4
Engine/source/sfx/sfxSystem.cpp

@@ -1253,8 +1253,9 @@ DefineEngineFunction( sfxGetAvailableDevices, const char*, (),,
    "@ref SFX_devices\n"
    "@ref SFX_devices\n"
    "@ingroup SFX" )
    "@ingroup SFX" )
 {
 {
-   char* deviceList = Con::getReturnBuffer( 2048 );
-   S32 len = 2048;
+   const S32 bufferSize = 2048;
+   char* deviceList = Con::getReturnBuffer( bufferSize );
+   S32 len = bufferSize;
    char *ptr = deviceList;
    char *ptr = deviceList;
    *ptr = 0;
    *ptr = 0;
 
 
@@ -1270,8 +1271,8 @@ DefineEngineFunction( sfxGetAvailableDevices, const char*, (),,
          const char *infoName = info->name.c_str();
          const char *infoName = info->name.c_str();
          dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers);
          dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers);
 
 
-         ptr += dStrlen(deviceList);
-         len = 2048 - (ptr - deviceList);
+         ptr += dStrlen(ptr);
+         len = bufferSize - (ptr - deviceList);
 
 
          if (len <= 0)
          if (len <= 0)
             return deviceList;
             return deviceList;