Imported Upstream version 0.8~alpha1
[platform/upstream/syncevolution.git] / src / client-api / src / c++ / windows / spds / DESEncoder.cpp
index 3627ce1..adbccb1 100644 (file)
@@ -43,6 +43,9 @@
 
 #include "base/util/utils.h"
 #include "spds/DESEncoder.h"
+#include "base/globalsdef.h"
+
+USE_NAMESPACE
 
 
 DESEncoder::DESEncoder() : DataTransformer(DT_DES) {
@@ -81,8 +84,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -96,8 +100,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -110,8 +115,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -125,8 +131,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -140,8 +147,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -155,8 +163,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -175,8 +184,9 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if ((res == FALSE) && (GetLastError() != ERROR_MORE_DATA)) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
@@ -196,13 +206,14 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
     );
 
     if (res == FALSE) {
-        lastErrorCode = ERR_DT_FAILURE;
-        sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        //lastErrorCode = ERR_DT_FAILURE;
+        //sprintf(lastErrorMsg, ERRMSG_DT_FAILURE, GetLastError());
+        setErrorF(ERR_DT_FAILURE, ERRMSG_DT_FAILURE, GetLastError());
         goto exit;
     }
 
     info.size = sizeIn;
-    info.newReturnedData = TRUE;
+    info.newReturnedData = true;
 
  exit:
 
@@ -224,4 +235,4 @@ char* DESEncoder::transform(char* data, TransformationInfo& info) {
 
    return ret;
 
-}
\ No newline at end of file
+}