2017-02-14 53 views
-1

我有下面的代碼「」:CPP:之前的預期基本表達式令牌

class SSLHashSHA1 
{ 
    SSLHashSHA1(); 
    ~SSLHashSHA1(); 
    public: 
     static OSStatus update(string*, int*); 
     static OSStatus final (string*, string*); 
}; 

OSStatus SSLHashSHA1::update(string* ctx, int* ran){ 
    return 0; 
} 

OSStatus SSLHashSHA1::final(string* ctx, string* out){ 
    return 0; 
} 

static OSStatus SSLVerifySignedServerKeyExchange(
    SSLContext *ctx, bool isRsa, SSLBuffer signedParams, uint8_t *signature, uint16_t signatureLen) 
{ 
    OSStatus err; 

    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) 
     goto fail; 
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) 
     goto fail; 
     goto fail; 
    if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) 
     goto fail; 


    fail: 
     SSLFreeBuffer(&signedHashes); 
     SSLFreeBuffer(&hashCtx); 
     return err; 
} 

和我在標題中提到的錯誤。 我得到了SSLHashSHA1.update和SSLHashSHA1.final調用。 爲什麼我得到那個?

我認爲當我讓類成員函數靜態我可以使用而不必創建一個對象。或者我應該改變類到一個結構或類似的東西?

+0

寫'SSLHashSHA1 ::更新(&hashCtx,&serverRandom)'調用靜態成員函數。 –

回答

2
SSLHashSHA1.update() 

這是完全錯誤的,SSLHashSHA1是一類,而不是一個實例,所以你不能使用.運營商在這裏調用一個方法,相反,正如你所說,你update是靜態函數,因此使用範圍分辨率算子(::)這樣調用它:

SSLHashSHA1::update(&hashCtx, &serverRandom)) 
相關問題