Browse Source

Misc changes

tags/1.9.4
falkTX 11 years ago
parent
commit
f1b91417a4
3 changed files with 8 additions and 9 deletions
  1. +1
    -1
      source/tests/ANSI.cpp
  2. +5
    -6
      source/utils/CarlaBase64Utils.hpp
  3. +2
    -2
      source/utils/CarlaString.hpp

+ 1
- 1
source/tests/ANSI.cpp View File

@@ -16,7 +16,7 @@
*/

// still need qt classes check
//#include "CarlaPlugin.hpp"
#include "CarlaPlugin.hpp"
//#include "plugin/DssiPlugin.cpp"

#if 0


+ 5
- 6
source/utils/CarlaBase64Utils.hpp View File

@@ -73,15 +73,14 @@ void carla_base64_encode(const uint8_t* const raw, const size_t len, char* const
const uint8_t* rawBytes = (const uint8_t*)raw;
uint8_t* encodedBytes = (uint8_t*)encoded;
size_t rawBitLen = 8*len;
unsigned int bit;
unsigned int tmp;
size_t bit, tmp;

for (bit = 0; bit < rawBitLen; bit += 6)
{
tmp = (rawBytes[bit/8] << (bit % 8)) | (rawBytes[bit/8 + 1] >> (8 - (bit % 8)));
tmp = (tmp >> 2) & 0x3f;
tmp = static_cast<size_t>((rawBytes[bit/8] << (bit % 8)) | (rawBytes[bit/8 + 1] >> (8 - (bit % 8))));
tmp = static_cast<size_t>((tmp >> 2) & 0x3f);

*(encodedBytes++) = kBase64[tmp];
*(encodedBytes++) = static_cast<uint8_t>(kBase64[tmp]);
}

for (; (bit % 8) != 0; bit += 6)
@@ -155,7 +154,7 @@ unsigned int carla_base64_decode(const char* const encoded, uint8_t* const raw)
return 0;
}

int decoded = match - kBase64;
uint8_t decoded = static_cast<uint8_t>(match - kBase64);

/* Add to raw data */
decoded <<= 2;


+ 2
- 2
source/utils/CarlaString.hpp View File

@@ -50,7 +50,7 @@ public:

explicit CarlaString(const int value)
{
const size_t strBufSize = std::abs(value/10) + 3;
const size_t strBufSize = static_cast<size_t>(std::abs(value/10) + 3);
char strBuf[strBufSize];
std::snprintf(strBuf, strBufSize, "%d", value);

@@ -70,7 +70,7 @@ public:

explicit CarlaString(const long int value)
{
const size_t strBufSize = std::abs(value/10) + 3;
const size_t strBufSize = static_cast<size_t>(std::abs(value/10) + 3);
char strBuf[strBufSize];
std::snprintf(strBuf, strBufSize, "%ld", value);



Loading…
Cancel
Save