@@ -66,14 +66,11 @@ static bool s_operation_cancelled = false;
6666// buffer must be freed by the caller.
6767char *utilityProcessPath (const char *p_path)
6868{
69- char *t_native_path;
70- t_native_path = os_path_to_native (p_path);
71-
72- char *t_resolved_path;
73- t_resolved_path = os_path_resolve (t_native_path);
74- free (t_native_path);
75-
76- return t_resolved_path;
69+ // SN-2014-11-17: [[ Bug 14032 ]] Now gets a UTF-8 encoded string as input
70+ char *t_resolved_path;
71+ t_resolved_path = os_path_resolve (p_path);
72+
73+ return t_resolved_path;
7774}
7875
7976/*
@@ -114,8 +111,9 @@ int zip_progress_callback(void *p_context, struct zip *p_archive, const char *p_
114111 char t_message[1024 ];
115112 int t_return_value;
116113
117- char *t_path;
118- t_path = os_path_from_native (zip_get_path (p_archive));
114+ // SN-2014-11-17: [[ Bug 14032 ]] The path is kept in UTF-8
115+ char *t_path;
116+ t_path = strdup (zip_get_path (p_archive));
119117
120118 sprintf (t_message, " %s \" %s\" , \" %s\" , \" %s\" , %lu, %lu, %lu, %lu" ,
121119 s_progress_callback,
@@ -127,7 +125,8 @@ int zip_progress_callback(void *p_context, struct zip *p_archive, const char *p_
127125 if (t_path != NULL )
128126 free (t_path);
129127
130- SendCardMessage (t_message, &t_return_value);
128+ // SN-2014-11-17: [[ Bug 14032 ]] The name of the callback, and the path, are UTF-8 encoded
129+ SendCardMessageUTF8 (t_message, &t_return_value);
131130
132131 if (s_operation_cancelled)
133132 return 1 ;
@@ -148,7 +147,8 @@ void revZipOpenArchive(char *p_arguments[], int p_argument_count, char **r_resul
148147
149148 if (!t_error)
150149 {
151- if (!SecurityCanAccessFile (p_arguments[0 ]))
150+ // SN-2014-11-17: [[ Bug 14032 ]] Update the parameters to UTF-8
151+ if (!SecurityCanAccessFileUTF8 (p_arguments[0 ]))
152152 {
153153 t_result = strdup (" ziperr,file access not permitted" );
154154 t_error = True;
@@ -301,7 +301,8 @@ void revZipOpenArchives(char *p_arguments[], int p_argument_count, char **r_resu
301301 for (zipmap_const_iterator_t it = s_zip_container.begin (); it != s_zip_container.end (); ++it)
302302 {
303303 char * t_line;
304- t_line = os_path_from_native (it->first .c_str ());
304+ // SN-2014-11-17: [[ Bug 14032 ]] We now keep the UTF-8 encoded string
305+ t_line = strdup (it->first .c_str ());
305306 if ( t_line )
306307 {
307308 t_strlist += std::string (t_line);
@@ -361,7 +362,8 @@ static void revZipAddItemWithDataAndCompression(char *p_arguments[], int p_argum
361362
362363 ExternalString mcData;
363364 int intRetValue;
364- GetVariableEx (p_arguments[2 ], " " , &mcData, &intRetValue);
365+ // SN-2014-11-17: [[ Bug 14032 ]] The variable name is UTF-8 encoded - not the data
366+ GetVariableExUTF8 (p_arguments[2 ], " " , &mcData, false , &intRetValue);
365367 if ( intRetValue != EXTERNAL_SUCCESS )
366368 {
367369 t_result = strdup (" ziperr,illegal variable" );
@@ -600,7 +602,8 @@ void revZipExtractItemToVariable(char *p_arguments[], int p_argument_count, char
600602
601603 t_mcData.buffer = t_data;
602604 t_mcData.length = t_stat . size;
603- SetVariableEx (p_arguments[2 ], " " , &t_mcData, &t_retval);
605+ // SN-2014-11-17: [[ Bug 14032 ]] The variable name is UTF-8 encoded - not the data
606+ SetVariableExUTF8 (p_arguments[2 ], " " , &t_mcData, false , &t_retval);
604607 if (t_retval != EXTERNAL_SUCCESS)
605608 {
606609 t_result = strdup (" ziperr,illegal variable" );
@@ -898,7 +901,8 @@ void revZipReplaceItemWithData(char *p_arguments[], int p_argument_count, char *
898901
899902 ExternalString mcData;
900903 int intRetValue;
901- GetVariableEx (p_arguments[2 ], " " , &mcData, &intRetValue);
904+ // SN-2014-11-17: [[ Bug 14032 ]] The variable name is UTF-8 encoded - not the data
905+ GetVariableExUTF8 (p_arguments[2 ], " " , &mcData, false , &intRetValue);
902906 if ( intRetValue != EXTERNAL_SUCCESS )
903907 {
904908 t_result = strdup (" ziperr,illegal variable" );
@@ -1450,26 +1454,26 @@ void revZipCancel(char *p_arguments[], int p_argument_count, char **r_result, Bo
14501454 *r_result = t_result;
14511455}
14521456
1457+ // SN-2014-11-17: [[ Bug 14032 ]] Update the appropriate functions to get UTF-8 parameters
14531458EXTERNAL_BEGIN_DECLARATIONS (" revZip" )
1454- EXTERNAL_DECLARE_COMMAND(" revZipOpenArchive" , revZipOpenArchive)
1455- EXTERNAL_DECLARE_COMMAND(" revZipOpenArchive" , revZipOpenArchive)
1456- EXTERNAL_DECLARE_COMMAND(" revZipCloseArchive" , revZipCloseArchive)
1457- EXTERNAL_DECLARE_COMMAND(" revZipAddItemWithFile" , revZipAddItemWithFile)
1458- EXTERNAL_DECLARE_COMMAND(" revZipAddUncompressedItemWithFile" , revZipAddUncompressedItemWithFile)
1459- EXTERNAL_DECLARE_COMMAND(" revZipAddItemWithData" , revZipAddItemWithData)
1460- EXTERNAL_DECLARE_COMMAND(" revZipAddUncompressedItemWithData" , revZipAddUncompressedItemWithData)
1461- EXTERNAL_DECLARE_FUNCTION(" revZipOpenArchives" , revZipOpenArchives)
1462- EXTERNAL_DECLARE_COMMAND(" revZipExtractItemToVariable" , revZipExtractItemToVariable)
1463- EXTERNAL_DECLARE_COMMAND(" revZipExtractItemToFile" , revZipExtractItemToFile)
1464- EXTERNAL_DECLARE_COMMAND(" revZipReplaceItemWithFile" , revZipReplaceItemWithFile)
1465- EXTERNAL_DECLARE_COMMAND(" revZipReplaceItemWithData" , revZipReplaceItemWithData)
1466- EXTERNAL_DECLARE_COMMAND(" revZipRenameItem" , revZipRenameItem)
1467- EXTERNAL_DECLARE_COMMAND(" revZipDeleteItem" , revZipDeleteItem)
1468- EXTERNAL_DECLARE_COMMAND(" revZipSetItemAttributes" , revZipSetItemAttributes)
1469- EXTERNAL_DECLARE_FUNCTION(" revZipGetItemAttributes" , revZipGetItemAttributes)
1470- EXTERNAL_DECLARE_FUNCTION(" revZipEnumerateItems" , revZipEnumerateItems)
1471- EXTERNAL_DECLARE_FUNCTION(" revZipDescribeItem" , revZipDescribeItem)
1472- EXTERNAL_DECLARE_COMMAND(" revZipSetProgressCallback" , revZipSetProgressCallback)
1459+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipOpenArchive" , revZipOpenArchive)
1460+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipCloseArchive" , revZipCloseArchive)
1461+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipAddItemWithFile" , revZipAddItemWithFile)
1462+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipAddUncompressedItemWithFile" , revZipAddUncompressedItemWithFile)
1463+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipAddItemWithData" , revZipAddItemWithData)
1464+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipAddUncompressedItemWithData" , revZipAddUncompressedItemWithData)
1465+ EXTERNAL_DECLARE_FUNCTION_UTF8(" revZipOpenArchives" , revZipOpenArchives)
1466+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipExtractItemToVariable" , revZipExtractItemToVariable)
1467+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipExtractItemToFile" , revZipExtractItemToFile)
1468+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipReplaceItemWithFile" , revZipReplaceItemWithFile)
1469+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipReplaceItemWithData" , revZipReplaceItemWithData)
1470+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipRenameItem" , revZipRenameItem)
1471+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipDeleteItem" , revZipDeleteItem)
1472+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipSetItemAttributes" , revZipSetItemAttributes)
1473+ EXTERNAL_DECLARE_FUNCTION_UTF8(" revZipGetItemAttributes" , revZipGetItemAttributes)
1474+ EXTERNAL_DECLARE_FUNCTION_UTF8(" revZipEnumerateItems" , revZipEnumerateItems)
1475+ EXTERNAL_DECLARE_FUNCTION_UTF8(" revZipDescribeItem" , revZipDescribeItem)
1476+ EXTERNAL_DECLARE_COMMAND_UTF8(" revZipSetProgressCallback" , revZipSetProgressCallback)
14731477 EXTERNAL_DECLARE_COMMAND(" revZipCancel" , revZipCancel)
14741478EXTERNAL_END_DECLARATIONS
14751479
0 commit comments