Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit bee1d07

Browse files
committed
Merge pull request #27 from kbenamor/master
Replace conversion functions Replace asInteger() and asString() with to_string() and convertTo().
2 parents 68b11aa + fb7bf22 commit bee1d07

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tinyalsa/TinyAlsaCtlPortConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2016, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -92,7 +92,7 @@ bool TinyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std::s
9292
// Check Format is supported by the plugin
9393
if (portConfig.format >= pcmFormatTranslationTableSize) {
9494

95-
error = "The format n°" + asString(portConfig.format) +
95+
error = "The format n°" + std::to_string(int{portConfig.format}) +
9696
" is not supported by the TinyAlsa plugin";
9797
return false;
9898
}

tinyalsa/TinyAmixerControl.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2016, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -31,6 +31,7 @@
3131
#include "TinyAlsaSubsystem.hpp"
3232
#include "InstanceConfigurableElement.h"
3333
#include "MappingContext.h"
34+
#include <convert.hpp>
3435
#include <tinyalsa/asoundlib.h>
3536
#include <string>
3637
#include <string.h>
@@ -110,8 +111,9 @@ bool TinyAmixerControl::accessHW(bool receive, std::string &error)
110111

111112
// Get control handle
112113
if (isdigit(controlName[0])) {
113-
114-
mixerControl = mixer_get_ctl(mixer, asInteger(controlName));
114+
int32_t controlNumber = 0;
115+
convertTo(controlName,controlNumber);
116+
mixerControl = mixer_get_ctl(mixer, controlNumber);
115117
} else {
116118

117119
mixerControl = mixer_get_ctl_by_name(mixer, controlName.c_str());
@@ -132,9 +134,9 @@ bool TinyAmixerControl::accessHW(bool receive, std::string &error)
132134
// Check available size
133135
if (elementCount * scalarSize != getSize()) {
134136

135-
error = "ALSA: Control element count (" + asString(elementCount) +
137+
error = "ALSA: Control element count (" + std::to_string(elementCount) +
136138
") and configurable scalar element count (" +
137-
asString(getSize() / scalarSize) + ") mismatch";
139+
std::to_string((getSize() / scalarSize)) + ") mismatch";
138140

139141
return false;
140142
}

0 commit comments

Comments
 (0)