Skip to content

Misc fixes #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 2, 2024
9 changes: 7 additions & 2 deletions arch/all-unix/filesys/emul_handler/emul_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,14 @@ static inline int nocase_rename(struct emulbase *emulbase, char *oldpath, char *
{
struct stat st;
int ret;
int changecap = 0;

if ((strcmp(oldpath, newpath) != 0) && (Stricmp(oldpath, newpath) == 0))
changecap = 1; /* A request to change capitalisation of name */

fixcase(emulbase, oldpath);
fixcase(emulbase, newpath);
if (!changecap)
fixcase(emulbase, newpath);

/* AmigaDOS Rename does not allow overwriting */
ret = emulbase->pdata.SysIFace->lstat(newpath, &st);
Expand Down Expand Up @@ -816,7 +821,7 @@ LONG DoRename(struct emulbase *emulbase, char *filename, char *newfilename)
HostLib_Lock();

error = nocase_rename(emulbase, filename, newfilename);
if (error)
if (error && error != ERROR_OBJECT_EXISTS)
error = err_u2a(emulbase);

HostLib_Unlock();
Expand Down
4 changes: 2 additions & 2 deletions compiler/crt/posixc/__posixc_intbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <pwd.h>

/* Some private structs */
struct random_state;
struct __random_state;
struct __env_item;
struct _fdesc;
struct vfork_data;
Expand All @@ -39,7 +39,7 @@ struct PosixCIntBase
struct MsgPort timerPort;

/* random.c */
struct random_state *rs;
struct __random_state *rs;

/* getpwuid.c */
struct passwd pwd;
Expand Down
762 changes: 444 additions & 318 deletions compiler/crt/posixc/random.c

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions compiler/crt/posixc/random.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*-
* Copyright 2020 Conrad Meyer <[email protected]>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

#pragma once

/*
* For each of the currently supported random number generators, we have a
* break value on the amount of state information (you need at least this
* many bytes of state info to support this random number generator), a degree
* for the polynomial (actually a trinomial) that the R.N.G. is based on, and
* the separation between the two lower order coefficients of the trinomial.
*/
#define TYPE_0 0 /* linear congruential */
#define BREAK_0 8
#define DEG_0 0
#define SEP_0 0

#define TYPE_1 1 /* x**7 + x**3 + 1 */
#define BREAK_1 32
#define DEG_1 7
#define SEP_1 3

#define TYPE_2 2 /* x**15 + x + 1 */
#define BREAK_2 64
#define DEG_2 15
#define SEP_2 1

#define TYPE_3 3 /* x**31 + x**3 + 1 */
#define BREAK_3 128
#define DEG_3 31
#define SEP_3 3

#define TYPE_4 4 /* x**63 + x + 1 */
#define BREAK_4 256
#define DEG_4 63
#define SEP_4 1

/*
* Array versions of the above information to make code run faster --
* relies on fact that TYPE_i == i.
*/
#define MAX_TYPES 5 /* max number of types above */

/* A full instance of the random(3) generator. */
struct __random_state {
uint32_t *rst_fptr;
uint32_t *rst_rptr;
uint32_t *rst_state;
int rst_type;
int rst_deg;
int rst_sep;
uint32_t *rst_end_ptr;
/* Flexible array member must be last. */
uint32_t rst_randtbl[];
};

struct __random_state *allocatestate(unsigned type);
int initstate_r(struct __random_state *, unsigned, uint32_t *, size_t);
long random_r(struct __random_state *);
void srandom_r(struct __random_state *, unsigned);
void srandomdev_r(struct __random_state *);
10 changes: 7 additions & 3 deletions compiler/crt/stdc/__vcscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,23 @@ const static struct vcs_ieeetype undef[3] = /* Undefined numeric values, IEEE */
const unsigned char *ptr=format+1;
size_t i;

if(*ptr=='*')
{
ignore=1;
ptr++;
}

if(isdigit(*ptr))
{
width=0;
while(isdigit(*ptr))
width=width*10+(*ptr++-'0');
}

while(*ptr=='h'||*ptr=='l'||*ptr=='L'||*ptr=='*')
while(*ptr=='h'||*ptr=='l'||*ptr=='L')
{
if (subtype=='l'&&*ptr=='l')
lltype=1;
if(*ptr=='*')
ignore=1;
else
subtype=*ptr;
ptr++;
Expand Down
6 changes: 6 additions & 0 deletions developer/debug/gdb/gdbinit.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ define symbol_check
ignore-errors p $arg0
end_log

# Turns $1 = (type)addr into $symbol = (type)addr
shell sed -i -e '/^[^\$]/d' -e 's/^\$[0-9]* =/set $'$arg0' =/' symbol.tmp

# Hack. In case of C++, type is displayed without struct keyword and loading fails.
# Add struct keyword uncoditionally to any type after first removing it if it was there
shell sed -i -e 's/(APTR)//' -e 's/= (struct /= (/' -e 's/= (/= (struct /' symbol.tmp

source symbol.tmp
end

Expand Down
2 changes: 1 addition & 1 deletion rom/filesys/fat/fat.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##begin config
version 41.64
version 41.65
basename fat
residentpri -1
handler_func handler
Expand Down
13 changes: 8 additions & 5 deletions rom/filesys/fat/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,15 @@ LONG OpRenameFile(struct ExtFileLock *sdirlock, UBYTE *sname,
return ERROR_WRITE_PROTECTED;
}

/* Now see if the wanted name is in this dir. If it exists, do nothing */
/* Now see if the wanted name is in this dir. If it exists, and is not a capilazation change, do nothing */
if ((err = GetDirEntryByName(&ddh, dname, dnamelen, &dde, glob)) == 0)
{
ReleaseDirHandle(&ddh, glob);
ReleaseDirHandle(&sdh, glob);
return ERROR_OBJECT_EXISTS;
if ((dnamelen != snamelen) || (strnicmp(sname, dname, snamelen) != 0))
{
ReleaseDirHandle(&ddh, glob);
ReleaseDirHandle(&sdh, glob);
return ERROR_OBJECT_EXISTS;
}
}
else if (err != ERROR_OBJECT_NOT_FOUND)
{
Expand All @@ -579,7 +582,7 @@ LONG OpRenameFile(struct ExtFileLock *sdirlock, UBYTE *sname,
}

/* At this point we have the source entry in sde, and we know the dest
* doesn't exist */
* doesn't exist or it is a capitalization change */

/* XXX: if sdh and ddh are the same dir and there's room in the existing
* entries for the new name, just overwrite the name */
Expand Down
68 changes: 34 additions & 34 deletions workbench/classes/zune/listtree/Listtree_mcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#define MUIA_Listtree_DragDropSort (MUIB_MUI|0x00020031) /* [I..] BOOL */
#define MUIA_Listtree_SortHook (MUIB_MUI|0x00020010) /* [I..] struct Hook * */

#define MUIV_Listtree_FindName_ListNode_Root 0
#define MUIV_Listtree_FindName_ListNode_Active -2
#define MUIV_Listtree_FindName_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_FindName_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_FindName_Flags_Visible (1<<14)
#define MUIV_Listtree_FindName_Flags_SameLevel (1<<15)
Expand All @@ -36,65 +36,65 @@
#define MUIV_Listtree_GetEntry_Flags_Visible (1<<14)
#define MUIV_Listtree_GetEntry_Flags_SameLevel (1<<15)

#define MUIV_Listtree_GetEntry_ListNode_Root 0
#define MUIV_Listtree_GetEntry_ListNode_Active -2
#define MUIV_Listtree_GetEntry_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_GetEntry_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_GetNr_TreeNode_Active -2
#define MUIV_Listtree_GetNr_TreeNode_Active ((IPTR)-2)

#define MUIV_Listtree_GetNr_Flags_ListEmpty (1<<12)
#define MUIV_Listtree_GetNr_Flags_CountList (1<<13)
#define MUIV_Listtree_GetNr_Flags_CountLevel (1<<14)
#define MUIV_Listtree_GetNr_Flags_CountAll (1<<15)

#define MUIV_Listtree_Remove_ListNode_Root 0
#define MUIV_Listtree_Remove_ListNode_Active -2
#define MUIV_Listtree_Remove_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_Remove_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_Remove_TreeNode_Head 0
#define MUIV_Listtree_Remove_TreeNode_Tail -1
#define MUIV_Listtree_Remove_TreeNode_Active -2
#define MUIV_Listtree_Remove_TreeNode_All -3
#define MUIV_Listtree_Remove_TreeNode_Head ((IPTR)0)
#define MUIV_Listtree_Remove_TreeNode_Tail ((IPTR)-1)
#define MUIV_Listtree_Remove_TreeNode_Active ((IPTR)-2)
#define MUIV_Listtree_Remove_TreeNode_All ((IPTR)-3)

/* #define MUIV_Listtree_Remove_Flags_Visible (1<<14) Not supported */
/* #define MUIV_Listtree_Remove_Flags_Nr (1<<15) Not supported */

#define MUIV_Listtree_Rename_TreeNode_Active -2
#define MUIV_Listtree_Rename_TreeNode_Active ((IPTR)-2)

#define MUIV_Listtree_Rename_Flags_User (1<<8)
#define MUIV_Listtree_Rename_Flags_NoRefresh (1<<9)

#define MUIV_Listtree_Insert_ListNode_Root 0
#define MUIV_Listtree_Insert_ListNode_Active -2
#define MUIV_Listtree_Insert_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_Insert_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_Insert_PrevNode_Head 0
#define MUIV_Listtree_Insert_PrevNode_Tail -1
#define MUIV_Listtree_Insert_PrevNode_Active -2
#define MUIV_Listtree_Insert_PrevNode_Sorted -4
#define MUIV_Listtree_Insert_PrevNode_Head ((IPTR)0)
#define MUIV_Listtree_Insert_PrevNode_Tail ((IPTR)-1)
#define MUIV_Listtree_Insert_PrevNode_Active ((IPTR)-2)
#define MUIV_Listtree_Insert_PrevNode_Sorted ((IPTR)-4)

#define MUIV_Listtree_Insert_Flags_NextNode (1<<12)
#define MUIV_Listtree_Insert_Flags_Active (1<<13)
#define MUIV_Listtree_Insert_Flags_NextNode (1<<12)
#define MUIV_Listtree_Insert_Flags_Active (1<<13)
/* #define MUIV_Listtree_Insert_Flags_Visible (1<<14) Not supported */
/* #define MUIV_Listtree_Insert_Flags_Nr (1<<15) Not supported */

#define MUIV_Listtree_Open_ListNode_Root 0
#define MUIV_Listtree_Open_ListNode_Parent -1
#define MUIV_Listtree_Open_ListNode_Active -2
#define MUIV_Listtree_Open_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_Open_ListNode_Parent ((IPTR)-1)
#define MUIV_Listtree_Open_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_Open_TreeNode_Head 0
#define MUIV_Listtree_Open_TreeNode_Tail -1
#define MUIV_Listtree_Open_TreeNode_Active -2
#define MUIV_Listtree_Open_TreeNode_All -3
#define MUIV_Listtree_Open_TreeNode_Head ((IPTR)0)
#define MUIV_Listtree_Open_TreeNode_Tail ((IPTR)-1)
#define MUIV_Listtree_Open_TreeNode_Active ((IPTR)-2)
#define MUIV_Listtree_Open_TreeNode_All ((IPTR)-3)

/* #define MUIV_Listtree_Open_Flags_Visible (1<<14) Not supported */
/* #define MUIV_Listtree_Open_Flags_Nr (1<<15) Not supported */

#define MUIV_Listtree_Close_ListNode_Root 0
#define MUIV_Listtree_Close_ListNode_Parent -1
#define MUIV_Listtree_Close_ListNode_Active -2
#define MUIV_Listtree_Close_ListNode_Root ((IPTR)0)
#define MUIV_Listtree_Close_ListNode_Parent ((IPTR)-1)
#define MUIV_Listtree_Close_ListNode_Active ((IPTR)-2)

#define MUIV_Listtree_Close_TreeNode_Head 0
#define MUIV_Listtree_Close_TreeNode_Tail -1
#define MUIV_Listtree_Close_TreeNode_Active -2
#define MUIV_Listtree_Close_TreeNode_All -3
#define MUIV_Listtree_Close_TreeNode_Head ((IPTR)0)
#define MUIV_Listtree_Close_TreeNode_Tail ((IPTR)-1)
#define MUIV_Listtree_Close_TreeNode_Active ((IPTR)-2)
#define MUIV_Listtree_Close_TreeNode_All ((IPTR)-3)

/* #define MUIV_Listtree_Close_Flags_Visible (1<<14) Not supported */
/* #define MUIV_Listtree_Close_Flags_Nr (1<<15) Not supported */
Expand Down
Loading