From 67eb154146ea90cd25a383bcdd4a028704ef2218 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 1 Feb 2007 23:08:15 +0000 Subject: Removed 'mode' parameter from creat(). It wasn't pure posix anyway, it was ignored on target and mixed into 'oflags' in the simulator. * Simplified io.c a bit by defining a dummy O_BINARY for OSes which don't have that. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12179 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.h | 6 +++--- apps/debug_menu.c | 12 ++++++------ apps/eq_menu.c | 2 +- apps/misc.c | 2 +- apps/onplay.c | 2 +- apps/plugin.h | 6 +++--- apps/plugins/calendar.c | 4 ++-- apps/plugins/clock.c | 2 +- apps/plugins/iriverify.c | 2 +- apps/plugins/lib/bmp.c | 2 +- apps/plugins/lib/configfile.c | 2 +- apps/plugins/search.c | 2 +- apps/plugins/sort.c | 2 +- apps/plugins/test_disk.c | 4 ++-- apps/plugins/vbrfix.c | 2 +- apps/plugins/viewer.c | 6 +++--- apps/plugins/vu_meter.c | 2 +- apps/plugins/wav2wv.c | 2 +- apps/plugins/zxbox/snapshot.c | 2 +- apps/recorder/radio.c | 2 +- apps/tree.c | 2 +- 21 files changed, 34 insertions(+), 34 deletions(-) (limited to 'apps') diff --git a/apps/codecs.h b/apps/codecs.h index cef14c3..730bacb 100644 --- a/apps/codecs.h +++ b/apps/codecs.h @@ -90,12 +90,12 @@ #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ /* increase this every time the api struct changes */ -#define CODEC_API_VERSION 10 +#define CODEC_API_VERSION 11 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define CODEC_MIN_API_VERSION 10 +#define CODEC_MIN_API_VERSION 11 /* codec return codes */ enum codec_status { @@ -174,7 +174,7 @@ struct codec_api { int (*close)(int fd); ssize_t (*read)(int fd, void* buf, size_t count); off_t (*PREFIX(lseek))(int fd, off_t offset, int whence); - int (*PREFIX(creat))(const char *pathname, mode_t mode); + int (*PREFIX(creat))(const char *pathname); ssize_t (*write)(int fd, const void* buf, size_t count); int (*PREFIX(remove))(const char* pathname); int (*PREFIX(rename))(const char* path, const char* newname); diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 99c00fa..1551b94 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1933,14 +1933,14 @@ static bool dbg_save_roms(void) int fd; int oldmode = system_memory_guard(MEMGUARD_NONE); - fd = creat("/internal_rom_0000-FFFF.bin", O_WRONLY); + fd = creat("/internal_rom_0000-FFFF.bin"); if(fd >= 0) { write(fd, (void *)0, 0x10000); close(fd); } - fd = creat("/internal_rom_2000000-203FFFF.bin", O_WRONLY); + fd = creat("/internal_rom_2000000-203FFFF.bin"); if(fd >= 0) { write(fd, (void *)0x2000000, 0x40000); @@ -1957,11 +1957,11 @@ static bool dbg_save_roms(void) int oldmode = system_memory_guard(MEMGUARD_NONE); #if defined(IRIVER_H100_SERIES) - fd = creat("/internal_rom_000000-1FFFFF.bin", O_WRONLY); + fd = creat("/internal_rom_000000-1FFFFF.bin"); #elif defined(IRIVER_H300_SERIES) - fd = creat("/internal_rom_000000-3FFFFF.bin", O_WRONLY); + fd = creat("/internal_rom_000000-3FFFFF.bin"); #elif defined(IAUDIO_X5) - fd = creat("/internal_rom_000000-3FFFFF.bin", O_WRONLY); + fd = creat("/internal_rom_000000-3FFFFF.bin"); #endif if(fd >= 0) { @@ -1971,7 +1971,7 @@ static bool dbg_save_roms(void) system_memory_guard(oldmode); #ifdef HAVE_EEPROM - fd = creat("/internal_eeprom.bin", O_WRONLY); + fd = creat("/internal_eeprom.bin"); if (fd >= 0) { int old_irq_level; diff --git a/apps/eq_menu.c b/apps/eq_menu.c index 798b05d..beaf385 100644 --- a/apps/eq_menu.c +++ b/apps/eq_menu.c @@ -716,7 +716,7 @@ static bool eq_save_preset(void) /* allow user to modify filename */ while (true) { if (!kbd_input(filename, sizeof filename)) { - fd = creat(filename, O_WRONLY); + fd = creat(filename); if (fd < 0) gui_syncsplash(HZ, true, str(LANG_FAILED)); else diff --git a/apps/misc.c b/apps/misc.c index 09a7c2e..8487da0 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -399,7 +399,7 @@ void screen_dump(void) IF_CNFN_NUM_(, NULL)); #endif - fh = creat(filename, O_WRONLY); + fh = creat(filename); if (fh < 0) return; diff --git a/apps/onplay.c b/apps/onplay.c index 5e7d1e0..b69999d 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -638,7 +638,7 @@ static bool clipboard_pastefile(const char *src, const char *target, bool copy) src_fd = open(src, O_RDONLY); if (src_fd >= 0) { - target_fd = creat(target, O_WRONLY); + target_fd = creat(target); if (target_fd >= 0) { result = true; diff --git a/apps/plugin.h b/apps/plugin.h index 70b5ebf..ad09a71 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -110,12 +110,12 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 41 +#define PLUGIN_API_VERSION 42 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 41 +#define PLUGIN_MIN_API_VERSION 42 /* plugin return codes */ enum plugin_status { @@ -300,7 +300,7 @@ struct plugin_api { int (*close)(int fd); ssize_t (*read)(int fd, void* buf, size_t count); off_t (*PREFIX(lseek))(int fd, off_t offset, int whence); - int (*PREFIX(creat))(const char *pathname, mode_t mode); + int (*PREFIX(creat))(const char *pathname); ssize_t (*write)(int fd, const void* buf, size_t count); int (*PREFIX(remove))(const char* pathname); int (*PREFIX(rename))(const char* path, const char* newname); diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index a57cade..34af474 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -316,7 +316,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) { int fp,fq; fp = rb->open("/.rockbox/.memo",O_RDONLY | O_CREAT); - fq = rb->creat("/.rockbox/~temp", O_WRONLY); + fq = rb->creat("/.rockbox/~temp"); if ( (fq != -1) && (fp != -1) ) { int i; @@ -345,7 +345,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) rb->write(fq,temp,1); } rb->close(fp); - fp = rb->creat("/.rockbox/.memo", O_WRONLY); + fp = rb->creat("/.rockbox/.memo"); rb->lseek(fp, 0, SEEK_SET); rb->lseek(fq, 0, SEEK_SET); for (i = 0; i < rb->filesize(fq); i++) diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 28cd223..19c7dac 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c @@ -903,7 +903,7 @@ void save_settings(bool interface) rb->lcd_update(); } - fd = rb->creat(default_filename, O_WRONLY); /* create the settings file */ + fd = rb->creat(default_filename); /* create the settings file */ if(fd >= 0) /* file exists, save successful */ { diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c index 47cb385..555c920 100644 --- a/apps/plugins/iriverify.c +++ b/apps/plugins/iriverify.c @@ -67,7 +67,7 @@ static int write_file(void) rb->snprintf(tmpfilename, MAX_PATH+1, "%s.tmp", filename); - fd = rb->creat(tmpfilename, O_WRONLY); + fd = rb->creat(tmpfilename); if(fd < 0) return 10 * fd - 1; diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c index 18968af..dc8432f 100644 --- a/apps/plugins/lib/bmp.c +++ b/apps/plugins/lib/bmp.c @@ -56,7 +56,7 @@ int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb ) int fh; int x,y; if( bm->format != FORMAT_NATIVE ) return -1; - fh = rb->PREFIX(creat)( filename, O_WRONLY ); + fh = rb->creat( filename ); if( fh < 0 ) return -1; rb->write( fh, header, sizeof( header ) ); diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index d5b60bc..3ca3805 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c @@ -34,7 +34,7 @@ int configfile_save(const char *filename, struct configdata *cfg, char buf[MAX_PATH]; cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename); - fd = cfg_rb->creat(buf, O_WRONLY); + fd = cfg_rb->creat(buf); if(fd < 0) return fd*10 - 1; diff --git a/apps/plugins/search.c b/apps/plugins/search.c index c174abf..5a30ce6 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c @@ -126,7 +126,7 @@ static bool search_init(char* file) if (fd==-1) return false; - fdw = rb->creat(resultfile, O_WRONLY); + fdw = rb->creat(resultfile); if (fdw < 0) { #ifdef HAVE_LCD_BITMAP diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index 77342f3..80ef22f 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c @@ -140,7 +140,7 @@ static int write_file(void) /* Create a temporary file */ rb->snprintf(tmpfilename, MAX_PATH+1, "%s.tmp", filename); - fd = rb->creat(tmpfilename, O_WRONLY); + fd = rb->creat(tmpfilename); if(fd < 0) return 10 * fd - 1; diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index 3292cfa..edc1dfb 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c @@ -102,7 +102,7 @@ static bool test_fs(void) rb->snprintf(text_buf, sizeof text_buf, "FS stress test: %dKB", (TEST_SIZE>>10)); log_lcd(text_buf, true); - fd = rb->creat(TEST_FILE, 0); + fd = rb->creat(TEST_FILE); if (fd < 0) { rb->splash(0, true, "Couldn't create testfile."); @@ -193,7 +193,7 @@ static bool test_speed(void) log_init(); log_lcd("Disk speed test", true); - fd = rb->creat(TEST_FILE, 0); + fd = rb->creat(TEST_FILE); if (fd < 0) { rb->splash(0, true, "Couldn't create testfile."); diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index d05419f..9bdaf49 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c @@ -50,7 +50,7 @@ static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes) return 10*orig_fd - 1; } - fd = rb->creat(tmpname, O_WRONLY); + fd = rb->creat(tmpname); if(fd < 0) { rb->close(orig_fd); return 10*fd - 2; diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index a8ef5eb..8590283 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -1074,7 +1074,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same if (i < data->bookmarked_files_count) { /* it is in the list, write everything back in the correct order, and reload the file correctly */ - settings_fd = rb->creat(BOOKMARKS_FILE, O_WRONLY); + settings_fd = rb->creat(BOOKMARKS_FILE); if (settings_fd >=0 ) { if (data->bookmarked_files_count > MAX_BOOKMARKED_FILES) @@ -1092,7 +1092,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same } else /* not in list, write the list to the file */ { - settings_fd = rb->creat(BOOKMARKS_FILE, O_WRONLY); + settings_fd = rb->creat(BOOKMARKS_FILE); if (settings_fd >=0 ) { if (++(data->bookmarked_files_count) > MAX_BOOKMARKED_FILES) @@ -1120,7 +1120,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same static void viewer_save_settings(void)/* same name as global, but not the same file.. */ { int settings_fd; - settings_fd = rb->creat(SETTINGS_FILE, O_WRONLY); /* create the settings file */ + settings_fd = rb->creat(SETTINGS_FILE); /* create the settings file */ rb->write (settings_fd, &prefs, sizeof(struct preferences)); rb->close(settings_fd); diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index cbfc0ee..4a68088 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -335,7 +335,7 @@ void load_settings(void) { } void save_settings(void) { - int fp = rb->creat("/.rockbox/rocks/.vu_meter", O_WRONLY); + int fp = rb->creat("/.rockbox/rocks/.vu_meter"); if(fp >= 0) { rb->write (fp, &settings, sizeof(struct saved_settings)); rb->close(fp); diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index 5b71e7e..2e2076c 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c @@ -174,7 +174,7 @@ static int wav2wv (char *filename) extension [1] = extension [2]; extension [2] = 0; - out_fd = rb->creat (filename, O_WRONLY); + out_fd = rb->creat (filename); extension [2] = extension [1]; extension [1] = save_a; diff --git a/apps/plugins/zxbox/snapshot.c b/apps/plugins/zxbox/snapshot.c index c67b7a8..d89e533 100644 --- a/apps/plugins/zxbox/snapshot.c +++ b/apps/plugins/zxbox/snapshot.c @@ -586,7 +586,7 @@ static void save_snapshot_file_type(char *name, int type) int snsh; snsh = rb->open(name, O_WRONLY); if(snsh < 0) { - snsh = rb->creat(name, O_WRONLY); + snsh = rb->creat(name); if(snsh < 0) { put_msg("Could not create snapshot file"); return; diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 45ddd3e..22ae7b0 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -972,7 +972,7 @@ static void radio_save_presets(void) int fd; int i; - fd = creat(filepreset, O_WRONLY); + fd = creat(filepreset); if(fd >= 0) { for(i = 0;i < num_presets;i++) diff --git a/apps/tree.c b/apps/tree.c index 7869696..8d70eb8 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1226,7 +1226,7 @@ bool create_playlist(void) gui_textarea_update(&screens[i]); #endif } - fd = creat(filename, O_WRONLY); + fd = creat(filename); if (fd < 0) return false; -- cgit v1.1