while (c != '\n' && c >= 0) {
/* #### Kludge -- Ignore any ESC x x ISO2022 sequences */
if (c == 27) {
- getc(infile);
- getc(infile);
+ (void)getc(infile);
+ (void)getc(infile);
goto nextchar;
}
break;
u = u->next;
}
-
+ if (na == &ures) {
+ /* Copy the local temporary to the heap */
+ na = xnew(struct ase_interval_union_item_s);
+ assert(na);
+ memcpy(na,&ures,sizeof(ures));
+ }
return na;
}
Lisp_Object build_ext_string(const char *str, Lisp_Object coding_system)
{
/* Some strlen's crash and burn if passed null. */
- return make_ext_string((const Extbyte*)str, strlen(str), coding_system);
+ return make_ext_string((const Extbyte*)str, (str ? strlen(str) : 0), coding_system);
}
Lisp_Object build_translated_string(const char *str)
{
char *tmpdir;
tmpdir = getenv("TMPDIR");
+ char path[5 /* strlen ("/tmp/") */ + 1 + _POSIX_PATH_MAX];
if (!tmpdir) {
struct stat st;
int myuid = getuid();
- char path[5 /* strlen ("/tmp/") */ + 1 +
- _POSIX_PATH_MAX];
strcpy(path, "/tmp/");
strncat(path, user_login_name(NULL), _POSIX_PATH_MAX);
case Lisp_Type_Record: {
enum lrecord_type type =
XRECORD_LHEADER_IMPLEMENTATION(arg)->lrecord_type_index;
-
+
switch ((unsigned int)type) {
case lrecord_type_marker:
return INT_T;
case lrecord_type_dynacat:
- if (SYMBOLP(XDYNACAT_TYPE(arg))) {
- /* must be an dynacat */
- /* now we've got two options, either compute a
- * hash-value from the symbol's address
- * or store a cookie in the plist of the symbol
- * for the moment, we prefer the latter option
- */
- return ase_optable_index_typesym(
- XDYNACAT_TYPE(arg));
- }
- break;
+ assert(SYMBOLP(XDYNACAT_TYPE(arg)));
+ /* must be an dynacat */
+ /* now we've got two options, either compute a
+ * hash-value from the symbol's address
+ * or store a cookie in the plist of the symbol
+ * for the moment, we prefer the latter option
+ */
+ return ase_optable_index_typesym(XDYNACAT_TYPE(arg));
default:
return type;
}
default:
return INT_T;
}
- return -1;
+ return -1; /* Should not reach here */
}
int
SXE_MUTEX_UNLOCK(&aj->mtx);
resolution = (sasd->mtap->samplerate * MTPSTATE_REACT_TIME) / 1000000;
- while (aj->play_state != MTPSTATE_STOP) {
+ while (mtp != MTPSTATE_STOP) {
#ifdef EF_USE_ASYNEQ
/* events are there? */
case MTPSTATE_RUN:
if (!ao_push(aj, resolution)) {
SXE_MUTEX_LOCK(&aj->mtx);
- aj->play_state = MTPSTATE_STOP;
- SXE_MUTEX_LOCK(&aj->mtx);
+ mtp = aj->play_state = MTPSTATE_STOP;
+ SXE_MUTEX_UNLOCK(&aj->mtx);
}
break;
case MTPSTATE_PAUSE:
file = Fexpand_file_name(file, Qnil);
if (((fp = fopen((char *)XSTRING_DATA(file),"rb")) == NULL) ||
- (fseek(fp, 0, SEEK_SET)))
+ (fseek(fp, 0, SEEK_SET))) {
+ if (fp)
+ fclose(fp);
return wrong_type_argument(Qfile_readable_p, file);
+ }
OpenSSL_add_all_digests();
xfree(hmacctx);
EVP_cleanup();
+ fclose(fp);
return make_ext_string((char*)outbuf, outlen, OSSL_CODING);
}
file = Fexpand_file_name(file, Qnil);
if (((fp = fopen((char *)XSTRING_DATA(file),"rb")) == NULL) ||
- (fseek(fp, 0, SEEK_SET)))
+ (fseek(fp, 0, SEEK_SET))) {
+ if (fp)
+ fclose(fp);
+ if (of)
+ fclose(of);
return wrong_type_argument(Qfile_readable_p, file);
+ }
fseek(fp, 0, SEEK_END);
file_size = ftell(fp);
if (!ciph) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
error ("no such cipher");
}
(unsigned char *)key_ext,
(unsigned char *)iv_ext)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error("error in EncryptInit");
}
if (string_len < 0) {
EVP_cleanup();
fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error("file corrupted");
return Qnil;
obp, &tmplen,
string_in, string_len)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error("error in EncryptUpdate");
}
*/
if (!EVP_EncryptFinal(ciphctx, obp, &tmplen)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error("error in EncryptFinal");
}
file = Fexpand_file_name(file, Qnil);
if (((fp = fopen((char *)XSTRING_DATA(file),"rb")) == NULL) ||
- (fseek(fp, 0, SEEK_SET)))
+ (fseek(fp, 0, SEEK_SET))) {
+ if (fp)
+ fclose(fp);
+ if (of)
+ fclose(of);
return wrong_type_argument(Qfile_readable_p, file);
+ }
fseek(fp, 0, SEEK_END);
file_size = ftell(fp);
if (!ciph) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
error ("no such cipher");
}
(unsigned char *)key_ext,
(unsigned char *)iv_ext)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error ("error in DecryptInit");
}
if (string_len < 0) {
EVP_cleanup();
fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error("file corrupted");
return Qnil;
obp, &tmplen,
string_in, string_len)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error ("error in DecryptUpdate");
}
*/
if (!EVP_DecryptFinal(ciphctx, obp, &tmplen)) {
EVP_cleanup();
+ fclose(fp);
+ if (of)
+ fclose(of);
xfree(ciphctx);
error ("error in DecryptFinal");
}
x_print_color_instance(Lisp_Color_Instance * c,
Lisp_Object printcharfun, int escapeflag)
{
- char buf[100];
+ char buf[256];
XColor color = COLOR_INSTANCE_X_COLOR(c);
- sprintf(buf, " %ld=(%X,%X,%X)",
+ snprintf(buf, sizeof(buf), " %ld=(%X,%X,%X)",
color.pixel, color.red, color.green, color.blue);
write_c_string(buf, printcharfun);
}
x_print_font_instance(Lisp_Font_Instance * f,
Lisp_Object printcharfun, int escapeflag)
{
- char buf[200];
- sprintf(buf, " 0x%lx", (unsigned long)FONT_INSTANCE_X_FONT(f)->fid);
+ char buf[64];
+ snprintf(buf, sizeof(buf), " 0x%lx", (unsigned long)FONT_INSTANCE_X_FONT(f)->fid);
write_c_string(buf, printcharfun);
}
print_specifier(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
{
Lisp_Specifier *sp = XSPECIFIER(obj);
- char buf[100];
+ char buf[128];
int count = specpdl_depth();
Lisp_Object the_specs;
error("printing unreadable object #<%s-specifier 0x%x>",
sp->methods->name, sp->header.uid);
- sprintf(buf, "#<%s-specifier global=", sp->methods->name);
+ snprintf(buf, sizeof(buf), "#<%s-specifier global=", sp->methods->name);
write_c_string(buf, printcharfun);
specbind(Qprint_string_length, make_int(100));
specbind(Qprint_length, make_int(5));
print_internal(sp->fallback, printcharfun, escapeflag);
}
unbind_to(count, Qnil);
- sprintf(buf, " 0x%x>", sp->header.uid);
+ snprintf(buf, sizeof(buf), " 0x%x>", sp->header.uid);
write_c_string(buf, printcharfun);
}
static void
print_window(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
{
- char buf[200];
+ char buf[64];
if (print_readably)
error("printing unreadable object #<window 0x%x>",
write_c_string(" on ", printcharfun);
print_internal(name, printcharfun, 1);
}
- sprintf(buf, " 0x%x>", XWINDOW(obj)->header.uid);
+ snprintf(buf, sizeof(buf), " 0x%x>", XWINDOW(obj)->header.uid);
write_c_string(buf, printcharfun);
}
print_window_config(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
{
struct window_config *config = XWINDOW_CONFIGURATION(obj);
- char buf[200];
+ char buf[64];
if (print_readably)
error("printing unreadable object #<window-configuration 0x%x>",
config->header.uid);