smaller bugfixes and type adaptions; refs #33

This commit is contained in:
Marc Wäckerlin
2014-09-16 07:47:26 +00:00
parent 8b704279b0
commit 40f64d476e
2 changed files with 10 additions and 9 deletions

View File

@@ -2027,7 +2027,7 @@ namespace cryptoki {
if (!check(_session._slot.library()->C_GetAttributeValue
(_session._session, _object, &attr, 1),
CRYPTOKI_FN_LOG("C_GetAttributeValue"))
|| !(long)attr.ulValueLen>0l)
|| !((long)attr.ulValueLen>0l))
//! Without exception handling, size and type must be checked too.
return res;
try {

View File

@@ -210,8 +210,9 @@ namespace pcsc {
//! State and attribute list of a reader.
class Status {
public:
Status(unsigned long s, const std::string& a): state(s), atr(a) {}
const unsigned long state;
Status(unsigned DWORD s, const std::string& a):
state(s), atr(a) {}
const unsigned DWORD state;
const std::string atr;
};
@@ -318,7 +319,7 @@ namespace pcsc {
/*!
* @note Take care: Strings may contain embedded @c 0.
*/
std::string control(unsigned long controlCode,
std::string control(unsigned DWORD controlCode,
std::string in) {
DWORD len(256); // arbitrary
UCHAR dataBuffer[256];
@@ -398,7 +399,7 @@ namespace pcsc {
//! Sets state and throws an exception if neccessary.
/*! @throw access_error if it is instanciated for exceptions and
an error occured in the last command. */
bool check(long state, const std::string context="") {
bool check(DWORD state, const std::string context="") {
_state = state;
return _connection->check(state, context);
}
@@ -585,7 +586,7 @@ namespace pcsc {
//! Throws an exception if neccessary.
/*! @throw access_error if it is instanciated for exceptions and
an error occured in the last command. */
bool check(long s, const std::string& context="") {
bool check(DWORD s, const std::string& context="") {
_state = s;
return check(context);
}
@@ -980,11 +981,11 @@ namespace pcsc {
return ss.str();
}
//! set state
void state(long s) {
void state(DWORD s) {
_state = s;
}
//! @returns state
long state() {
DWORD state() {
return _state;
}
//! @returns connection id
@@ -1000,7 +1001,7 @@ namespace pcsc {
bool _exc;
SCARDCONTEXT _id;
Scope _s;
long _state;
DWORD _state;
};