@@ -187,8 +187,8 @@ void index_file(char *path, char* filename, bool new) {
187187 fileTypeEndPointer = b64Pointer ;
188188 }
189189
190- char * fileType = malloc (fileTypeEndPointer - fileTypePointer + 1 );
191- strncpy (fileType , fileTypePointer , fileTypeEndPointer - fileTypePointer );
190+ char * fileType = malloc (( size_t ) ( fileTypeEndPointer - fileTypePointer + 1 ) );
191+ strncpy (fileType , fileTypePointer , ( size_t ) ( fileTypeEndPointer - fileTypePointer ) );
192192 fileType [fileTypeEndPointer - fileTypePointer ] = '\0' ;
193193
194194 char * icon_sdr_path = asprintf_hd ( "%s/icon.%s" , sdr_path , fileType );
@@ -204,15 +204,15 @@ void index_file(char *path, char* filename, bool new) {
204204 if (header .icon [i ] >= 'A' && header .icon [i ] <= 'Z' ) {
205205 value = header .icon [i ] - 'A' ;
206206 } else if (header .icon [i ] >= 'a' && header .icon [i ] <= 'z' ) {
207- value = (header .icon [i ] - 'a' ) + 26 ;
207+ value = (char ) ( header .icon [i ] - 'a' ) + 26 ;
208208 } else if (header .icon [i ] >= '0' && header .icon [i ] <= '9' ) {
209- value = (header .icon [i ] - '0' ) + 52 ;
209+ value = (char ) ( header .icon [i ] - '0' ) + 52 ;
210210 } else if (header .icon [i ] == '+' ) {
211211 value = 62 ;
212212 } else if (header .icon [i ] == '/' ) {
213213 value = 63 ;
214214 } else if (header .icon [i ] != '=' ) {
215- Log ("Invalid B64 at position %i " , i ); // Warn
215+ Log ("Invalid B64 at position %zu " , i ); // Warn
216216 }
217217
218218 // Add data to the currentByte
@@ -231,7 +231,7 @@ void index_file(char *path, char* filename, bool new) {
231231
232232 // Set new currentByte to leftover bits
233233 currentByte = 0 ;
234- currentByte |= value << (2 + consumedBits );
234+ currentByte |= ( char ) value << (2 + consumedBits );
235235 processedBits = 6 - consumedBits ;
236236 }
237237 }
@@ -348,7 +348,7 @@ void remove_file(const char* path, const char* filename, char* uuid) {
348348 const int pid = fork ();
349349 if (pid == 0 ) {
350350 Log ("Hello from fork!" );
351- char * command = buildCommand ("source \"%s\"; on_remove;" , escapedPath );
351+ char * command = asprintf_hd ("source \"%s\"; on_remove;" , escapedPath );
352352 Log ("Executing command: %s" , command );
353353 free (escapedPath );
354354 execl ("/var/local/mkk/su" , command , NULL );
@@ -367,7 +367,7 @@ void remove_file(const char* path, const char* filename, char* uuid) {
367367 if (access (sdrPath , R_OK |W_OK ) == F_OK )
368368 {
369369 Log ("SDR exists - deleting" );
370- recursiveDelete (sdrPath );
370+ rmdir_r (sdrPath );
371371 }
372372
373373 free (sdrPath );
0 commit comments