misc_funct.c (xorriso-1.5.2) | : | misc_funct.c (xorriso-1.5.4) | ||
---|---|---|---|---|
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. | |||
Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net> | Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net> | |||
Provided under GPL version 2 or later. | Provided under GPL version 2 or later. | |||
This file contains the miscellaneous helper functions of xorriso. | This file contains the miscellaneous helper functions of xorriso. | |||
*/ | */ | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include "../config.h" | #include "../config.h" | |||
#endif | #endif | |||
skipping to change at line 171 | skipping to change at line 171 | |||
if(copy2 != NULL) | if(copy2 != NULL) | |||
free(copy2); | free(copy2); | |||
return ret; | return ret; | |||
} | } | |||
/** Convert a text into a number of type double and multiply it by unit code | /** Convert a text into a number of type double and multiply it by unit code | |||
[kmgtpe] (2^10 to 2^60) or [s] (2048) or [d] (512). | [kmgtpe] (2^10 to 2^60) or [s] (2048) or [d] (512). | |||
(Also accepts capital letters.) | (Also accepts capital letters.) | |||
@param text Input like "42", "2k", "3.14m" or "-1g" | @param text Input like "42", "2k", "3.14m" or "-1g" | |||
@param flag Bitfield for control purposes: | @param flag Bitfield for control purposes: | |||
bit0= return -1 rathern than 0 on failure | bit0= return -1 rather than 0 on failure | |||
@return The derived double value | @return The derived double value | |||
*/ | */ | |||
double Scanf_io_size(char *text, int flag) | double Scanf_io_size(char *text, int flag) | |||
/* | /* | |||
bit0= default value -1 rather than 0 | bit0= default value -1 rather than 0 | |||
*/ | */ | |||
{ | { | |||
int c; | int c; | |||
double ret= 0.0; | double ret= 0.0; | |||
skipping to change at line 1038 | skipping to change at line 1038 | |||
goto overflow; | goto overflow; | |||
/* escape hard quote within the text */ | /* escape hard quote within the text */ | |||
out_text[w++]= '\''; | out_text[w++]= '\''; | |||
out_text[w++]= '"'; | out_text[w++]= '"'; | |||
out_text[w++]= '\''; | out_text[w++]= '\''; | |||
out_text[w++]= '"'; | out_text[w++]= '"'; | |||
out_text[w++]= '\''; | out_text[w++]= '\''; | |||
} else { | } else { | |||
if(w + 3 > limit) { | if(w + 3 > limit) { | |||
overflow:; | overflow:; | |||
strncpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... ",33); | strcpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... '"); | |||
break; | return(out_text); | |||
} | } | |||
out_text[w++]= in_text[i]; | out_text[w++]= in_text[i]; | |||
} | } | |||
} | } | |||
out_text[w++]= '\''; | out_text[w++]= '\''; | |||
out_text[w++]= 0; | out_text[w++]= 0; | |||
return(out_text); | return(out_text); | |||
} | } | |||
int Hex_to_bin(char *hex, | int Hex_to_bin(char *hex, | |||
skipping to change at line 1329 | skipping to change at line 1329 | |||
sprintf(text + strlen(text), "-"); | sprintf(text + strlen(text), "-"); | |||
for(i= 10; i <= 15; i++) | for(i= 10; i <= 15; i++) | |||
sprintf(text + strlen(text), "%-2.2x", (unsigned int) guid[i]); | sprintf(text + strlen(text), "%-2.2x", (unsigned int) guid[i]); | |||
} else { | } else { | |||
/* Plain hex string */ | /* Plain hex string */ | |||
for(i= 0; i < 16; i++) | for(i= 0; i < 16; i++) | |||
sprintf(text + i * 2, "%-2.2x", (unsigned int) guid[i]); | sprintf(text + i * 2, "%-2.2x", (unsigned int) guid[i]); | |||
} | } | |||
return(1); | return(1); | |||
} | } | |||
int Xorriso__parse_size_param(char *cpt, int key_l, int l, double *num) | ||||
{ | ||||
char text[16]; | ||||
*num= 0.0; | ||||
if(l <= key_l || l >= key_l + 16) | ||||
return(0); | ||||
strncpy(text, cpt + key_l, l - key_l); | ||||
text[l - key_l]= 0; | ||||
*num= Scanf_io_size(text, 0); | ||||
return(1); | ||||
} | ||||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |