* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
#include <string.h>
#include "share/alloc.h"
+#include "share/safe_str.h"
#include "utf8.h"
#include "charset.h"
if(wchars == 0)
{
- fprintf(stderr, "Unicode translation error %d\n", GetLastError());
+ fprintf(stderr, "Unicode translation error %d\n", (int)GetLastError());
return -1;
}
if(err != wchars)
{
free(unicode);
- fprintf(stderr, "Unicode translation error %d\n", GetLastError());
+ fprintf(stderr, "Unicode translation error %d\n", (int)GetLastError());
return -1;
}
if(chars == 0)
{
- fprintf(stderr, "Unicode translation error %d\n", GetLastError());
+ fprintf(stderr, "Unicode translation error %d\n", (int)GetLastError());
free(unicode);
return -1;
}
-1, *to, chars, NULL, NULL);
if(err != chars)
{
- fprintf(stderr, "Unicode translation error %d\n", GetLastError());
+ fprintf(stderr, "Unicode translation error %d\n", (int)GetLastError());
free(unicode);
free(*to);
*to = NULL;
s = safe_malloc_add_2op_(fromlen, /*+*/1);
if (!s)
return -1;
- strcpy(s, from);
+ safe_strncpy(s, from, fromlen + 1);
*to = s;
for (; *s; s++)
if (*s & ~0x7f)