diff --git a/daemon/src/audio/audiorecord.cpp b/daemon/src/audio/audiorecord.cpp
index 9df38a352409dccfff3f20e20041fbcf043f8faf..8acdfa853fce8a11d8c025cd4619992e19284643 100644
--- a/daemon/src/audio/audiorecord.cpp
+++ b/daemon/src/audio/audiorecord.cpp
@@ -392,7 +392,7 @@ void AudioRecord::closeWavFile()
         WARN("AudioRecord: Error: can't close file");
 }
 
-void AudioRecord::recData(SFLDataFormat* buffer, int nSamples)
+void AudioRecord::recData(SFLDataFormat* buffer, size_t nSamples)
 {
     if (recordingEnabled_) {
         if (fileHandle_ == 0) {
@@ -400,11 +400,11 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples)
             return;
         }
 
-        if (fwrite(buffer, sizeof(SFLDataFormat), nSamples, fileHandle_) != (unsigned int) nSamples)
+        if (fwrite(buffer, sizeof(SFLDataFormat), nSamples, fileHandle_) != nSamples)
             WARN("AudioRecord: Could not record data! ");
         else {
             fflush(fileHandle_);
-            byteCounter_ += (unsigned long)(nSamples*sizeof(SFLDataFormat));
+            byteCounter_ += nSamples * sizeof(SFLDataFormat);
         }
     }
 }
diff --git a/daemon/src/audio/audiorecord.h b/daemon/src/audio/audiorecord.h
index efbe7f281d490c14cdf3f06c21fa0074297a3c45..47bfa28ac303771cc0d47eb73a8d2458e65d1c2e 100644
--- a/daemon/src/audio/audiorecord.h
+++ b/daemon/src/audio/audiorecord.h
@@ -102,7 +102,7 @@ class AudioRecord {
          * @param buffer  The data chunk to be recorded
          * @param nSamples Number of samples (number of bytes) to be recorded
          */
-        void recData(SFLDataFormat* buffer, int nSamples);
+        void recData(SFLDataFormat* buffer, size_t nSamples);
 
     protected:
 
diff --git a/daemon/src/audio/audiorecorder.cpp b/daemon/src/audio/audiorecorder.cpp
index 669e2ed27d93c59f5d852eea58551381d3904a6e..63cac9e7e56e64a704f8a893b721703b995b665b 100644
--- a/daemon/src/audio/audiorecorder.cpp
+++ b/daemon/src/audio/audiorecorder.cpp
@@ -58,14 +58,13 @@ AudioRecorder::AudioRecorder(AudioRecord  *arec, MainBuffer *mb) : ost::Thread()
  */
 void AudioRecorder::run()
 {
-    int bufferLength = 10000;
-    SFLDataFormat buffer[bufferLength];
+    const size_t BUFFER_LENGTH = 10000;
+    SFLDataFormat buffer[BUFFER_LENGTH];
 
     while (isRunning()) {
-        int availBytes = mbuffer_->availForGet(recorderId_);
-        int toGet = (availBytes < bufferLength) ? availBytes : bufferLength;
+        size_t availBytes = mbuffer_->availForGet(recorderId_);
 
-        mbuffer_->getData(buffer, toGet, recorderId_);
+        mbuffer_->getData(buffer, std::min(availBytes, BUFFER_LENGTH), recorderId_);
 
         if (availBytes > 0)
             arecord_->recData(buffer, availBytes / sizeof(SFLDataFormat));